finalcut/include/final/fevent.h

335 lines
8.5 KiB
C
Raw Normal View History

/************************************************************************
* fevent.h - Base event class of widgets *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2014-2017 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* The Final Cut is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
************************************************************************/
/* Inheritance diagram
*
*
*
* FEvent
*
*
*
*
* FKeyEvent
*
*
*
* FMouseEvent
*
*
*
* FWheelEvent
*
*
*
* FFocusEvent
*
*
*
* FAccelEvent
*
*
*
* FResizeEvent
*
*
*
* FShowEvent
*
*
*
* FHideEvent
*
*
*
* FCloseEvent
*
*
*
* FTimerEvent
*
*/
2015-05-23 13:35:12 +02:00
#ifndef FEVENT_H
#define FEVENT_H
2015-05-23 13:35:12 +02:00
#include "final/fc.h"
#include "final/fpoint.h"
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
// class FEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FEvent // event base class
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
explicit FEvent(int);
virtual ~FEvent();
int type() const;
2015-05-23 13:35:12 +02:00
2017-09-11 03:06:02 +02:00
protected:
int t;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FKeyEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FKeyEvent : public FEvent // keyboard event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
FKeyEvent (int, int);
~FKeyEvent();
int key() const;
bool isAccepted() const;
void accept();
void ignore();
protected:
int k;
bool accpt;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FMouseEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FMouseEvent : public FEvent // mouse event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
FMouseEvent (int, const FPoint&, int);
FMouseEvent (int, const FPoint&, const FPoint&, int);
~FMouseEvent();
const FPoint& getPos() const;
const FPoint& getTermPos() const;
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
int getButton() const;
protected:
FPoint p;
FPoint tp;
int b;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
// class FWheelEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FWheelEvent : public FEvent // wheel event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
FWheelEvent (int, const FPoint&, int);
FWheelEvent (int, const FPoint&, const FPoint&, int);
~FWheelEvent();
const FPoint& getPos() const;
const FPoint& getTermPos() const;
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
int getWheel() const;
protected:
FPoint p;
FPoint tp;
int w;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FFocusEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FFocusEvent : public FEvent // focus event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
explicit FFocusEvent (int);
~FFocusEvent();
bool gotFocus() const;
bool lostFocus() const;
fc::FocusTypes getFocusType() const;
void setFocusType(fc::FocusTypes);
bool isAccepted() const;
void accept();
void ignore();
protected:
bool accpt;
fc::FocusTypes focus_type;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FAccelEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FAccelEvent : public FEvent // focus event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
private:
// Disable copy constructor
FAccelEvent (const FAccelEvent&);
// Disable assignment operator (=)
FAccelEvent& operator = (const FAccelEvent&);
public:
FAccelEvent (int, void*);
~FAccelEvent();
void* focusedWidget() const;
bool isAccepted() const;
void accept();
void ignore();
protected:
bool accpt;
void* focus_widget;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FResizeEvent
//----------------------------------------------------------------------
2017-09-11 03:06:02 +02:00
class FResizeEvent : public FEvent // resize event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
explicit FResizeEvent (int);
~FResizeEvent();
2015-09-20 05:44:50 +02:00
2017-09-11 03:06:02 +02:00
bool isAccepted() const;
void accept();
void ignore();
2015-05-23 13:35:12 +02:00
2017-09-11 03:06:02 +02:00
protected:
bool accpt;
2015-05-23 13:35:12 +02:00
};
//----------------------------------------------------------------------
// class FShowEvent
//----------------------------------------------------------------------
2017-09-11 03:06:02 +02:00
class FShowEvent : public FEvent // show event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
explicit FShowEvent (int);
~FShowEvent();
2015-05-23 13:35:12 +02:00
};
//----------------------------------------------------------------------
// class FHideEvent
//----------------------------------------------------------------------
2017-09-11 03:06:02 +02:00
class FHideEvent : public FEvent // hide event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
explicit FHideEvent (int);
~FHideEvent();
2015-05-23 13:35:12 +02:00
};
//----------------------------------------------------------------------
// class FCloseEvent
//----------------------------------------------------------------------
2017-09-11 03:06:02 +02:00
class FCloseEvent : public FEvent // close event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
explicit FCloseEvent(int);
~FCloseEvent();
2015-09-20 05:44:50 +02:00
2017-09-11 03:06:02 +02:00
bool isAccepted() const;
void accept();
void ignore();
2015-05-23 13:35:12 +02:00
2017-09-11 03:06:02 +02:00
protected:
bool accpt;
2015-05-23 13:35:12 +02:00
};
//----------------------------------------------------------------------
// class FTimerEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
2017-09-11 03:06:02 +02:00
class FTimerEvent : public FEvent // timer event
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
FTimerEvent(int, int);
~FTimerEvent();
2015-09-20 05:44:50 +02:00
2017-09-11 03:06:02 +02:00
int timerId() const;
2015-05-23 13:35:12 +02:00
2017-09-11 03:06:02 +02:00
protected:
int id;
2015-05-23 13:35:12 +02:00
};
#pragma pack(pop)
#endif // FEVENT_H