finalcut/src/fevent.h

316 lines
6.7 KiB
C
Raw Normal View History

2015-05-23 13:35:12 +02:00
// fevent.h
// class FEvent
#ifndef _FEVENT_H
#define _FEVENT_H
#include "fpoint.h"
#define None_Event 0 // invalid event
#define KeyPress_Event 1 // key pressed
#define KeyUp_Event 2 // key released
#define KeyDown_Event 3 // key pressed
#define MouseDown_Event 4 // mouse button pressed
#define MouseUp_Event 5 // mouse button released
#define MouseDoubleClick_Event 6 // mouse button double click
#define MouseWheel_Event 7 // mouse wheel rolled
#define MouseMove_Event 8 // mouse move
#define FocusIn_Event 9 // focus in
#define FocusOut_Event 10 // focus out
#define WindowActive_Event 11 // activate window
#define WindowInactive_Event 12 // deactivate window
#define WindowRaised_Event 13 // raise window
#define WindowLowered_Event 14 // lower window
#define Accelerator_Event 15 // keyboard accelerator
#define Resize_Event 16 // terminal resize
#define Show_Event 17 // widget is shown
#define Hide_Event 18 // widget is hidden
#define Close_Event 19 // widget close
#define Timer_Event 20 // timer event occur
//----------------------------------------------------------------------
// class FEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FEvent // event base class
{
public:
explicit FEvent(int);
2015-09-22 04:18:20 +02:00
virtual ~FEvent();
2015-05-23 13:35:12 +02:00
int type() const;
protected:
int t;
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FKeyEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FKeyEvent : public FEvent // keyboard event
{
public:
FKeyEvent (int, int);
2015-09-20 05:44:50 +02:00
~FKeyEvent();
2015-05-23 13:35:12 +02:00
int key() const;
bool isAccepted() const;
void accept();
void ignore();
protected:
int k;
bool accpt;
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FMouseEvent
//----------------------------------------------------------------------
enum ButtonState // mouse/keyboard state values
{
NoButton = 0x00,
LeftButton = 0x01,
RightButton = 0x02,
MiddleButton = 0x04,
MouseButtonMask = 0x07,
ShiftButton = 0x08,
ControlButton = 0x10,
MetaButton = 0x20,
KeyButtonMask = 0x38
};
#pragma pack(push)
#pragma pack(1)
class FMouseEvent : public FEvent // mouse event
{
public:
FMouseEvent (int, const FPoint&, int);
FMouseEvent (int, const FPoint&, const FPoint&, int);
2015-09-20 05:44:50 +02:00
~FMouseEvent();
2015-05-23 13:35:12 +02:00
const FPoint& getPos() const;
const FPoint& getGlobalPos() const;
int getX() const;
int getY() const;
int getGlobalX() const;
int getGlobalY() const;
int getButton() const;
protected:
FPoint p;
FPoint g;
int b;
};
#pragma pack(pop)
2015-09-22 04:18:20 +02:00
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
// class FWheelEvent
//----------------------------------------------------------------------
enum WheelState // wheel state values
{
NoWheel = 0x00,
WheelUp = 0x01,
WheelDown = 0x02,
WheelMask = 0x03
};
#pragma pack(push)
#pragma pack(1)
2015-09-20 05:44:50 +02:00
class FWheelEvent : public FEvent // wheel event
2015-05-23 13:35:12 +02:00
{
public:
FWheelEvent (int, const FPoint&, int);
FWheelEvent (int, const FPoint&, const FPoint&, int);
2015-09-20 05:44:50 +02:00
~FWheelEvent();
2015-05-23 13:35:12 +02:00
const FPoint& getPos() const;
const FPoint& getGlobalPos() const;
int getX() const;
int getY() const;
int getGlobalX() const;
int getGlobalY() const;
int getWheel() const;
protected:
FPoint p;
FPoint g;
int w;
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FFocusEvent
//----------------------------------------------------------------------
enum FocusTypes
{
FocusNextWidget = 0x00,
FocusPreviousWidget = 0x01,
FocusDefiniteWidget = 0x03
};
#pragma pack(push)
#pragma pack(1)
class FFocusEvent : public FEvent // focus event
{
public:
explicit FFocusEvent (int);
2015-09-20 05:44:50 +02:00
~FFocusEvent();
2015-05-23 13:35:12 +02:00
bool gotFocus() const;
bool lostFocus() const;
FocusTypes getFocusType() const;
void setFocusType(FocusTypes);
bool isAccepted() const;
void accept();
void ignore();
protected:
bool accpt;
FocusTypes focus_type;
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FAccelEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FAccelEvent : public FEvent // focus event
{
2015-09-22 04:18:20 +02:00
private:
FAccelEvent (const FAccelEvent&); // Disabled copy constructor
FAccelEvent& operator = (const FAccelEvent&); // and operator '='
2015-05-23 13:35:12 +02:00
public:
FAccelEvent (int, void*);
2015-09-20 05:44:50 +02:00
~FAccelEvent();
2015-05-23 13:35:12 +02:00
void* focusedWidget() const;
bool isAccepted() const;
void accept();
void ignore();
protected:
2015-09-20 05:44:50 +02:00
bool accpt;
2015-05-23 13:35:12 +02:00
void* focus_widget;
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FResizeEvent
//----------------------------------------------------------------------
class FResizeEvent : public FEvent // resize event
{
public:
explicit FResizeEvent (int);
2015-09-20 05:44:50 +02:00
~FResizeEvent();
2015-05-23 13:35:12 +02:00
bool isAccepted() const;
void accept();
void ignore();
protected:
bool accpt;
};
//----------------------------------------------------------------------
// class FShowEvent
//----------------------------------------------------------------------
class FShowEvent : public FEvent // show event
{
public:
explicit FShowEvent (int);
2015-09-20 05:44:50 +02:00
~FShowEvent();
2015-05-23 13:35:12 +02:00
};
//----------------------------------------------------------------------
// class FHideEvent
//----------------------------------------------------------------------
class FHideEvent : public FEvent // hide event
{
public:
explicit FHideEvent (int);
2015-09-20 05:44:50 +02:00
~FHideEvent();
2015-05-23 13:35:12 +02:00
};
//----------------------------------------------------------------------
// class FCloseEvent
//----------------------------------------------------------------------
class FCloseEvent : public FEvent // close event
{
public:
explicit FCloseEvent(int);
2015-09-20 05:44:50 +02:00
~FCloseEvent();
2015-05-23 13:35:12 +02:00
bool isAccepted() const;
void accept();
void ignore();
protected:
bool accpt;
};
//----------------------------------------------------------------------
// class FTimerEvent
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FTimerEvent : public FEvent // timer event
{
public:
FTimerEvent(int, int);
2015-09-20 05:44:50 +02:00
~FTimerEvent();
2015-05-23 13:35:12 +02:00
int timerId() const;
protected:
int id;
};
#pragma pack(pop)
#endif // _FEVENT_H