finalcut/src/fevent.h

317 lines
7.0 KiB
C
Raw Normal View History

// File: fevent.h
// Provides: class FEvent
//
// 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
#include "fc.h"
2015-05-23 13:35:12 +02:00
#include "fpoint.h"
//----------------------------------------------------------------------
// 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
//----------------------------------------------------------------------
#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& getTermPos() const;
2015-05-23 13:35:12 +02:00
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
2015-05-23 13:35:12 +02:00
int getButton() const;
protected:
FPoint p;
FPoint tp;
2015-05-23 13:35:12 +02:00
int b;
};
#pragma pack(pop)
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
// class FWheelEvent
//----------------------------------------------------------------------
#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& getTermPos() const;
2015-05-23 13:35:12 +02:00
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
2015-05-23 13:35:12 +02:00
int getWheel() const;
protected:
FPoint p;
FPoint tp;
2015-05-23 13:35:12 +02:00
int w;
};
#pragma pack(pop)
//----------------------------------------------------------------------
// class FFocusEvent
//----------------------------------------------------------------------
#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;
2016-01-17 02:57:08 +01:00
fc::FocusTypes getFocusType() const;
void setFocusType(fc::FocusTypes);
2015-05-23 13:35:12 +02:00
bool isAccepted() const;
void accept();
void ignore();
protected:
bool accpt;
2016-01-17 02:57:08 +01:00
fc::FocusTypes focus_type;
2015-05-23 13:35:12 +02:00
};
#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:
// Disable copy constructor
FAccelEvent (const FAccelEvent&);
// Disable assignment operator (=)
FAccelEvent& operator = (const FAccelEvent&);
2015-09-22 04:18:20 +02:00
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