2017-11-04 07:03:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* fevent.h - Base event class of widgets *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2018-09-20 23:59:01 +02:00
|
|
|
* Copyright 2014-2018 Markus Gans *
|
2017-11-04 07:03:53 +01:00
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
2015-09-25 21:37:19 +02:00
|
|
|
|
2017-10-02 07:32:33 +02:00
|
|
|
/* Inheritance diagram
|
|
|
|
* ═══════════════════
|
|
|
|
*
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FEvent ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FKeyEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FMouseEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FWheelEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FFocusEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FAccelEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FResizeEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FShowEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FHideEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ├─────▏FCloseEvent ▏
|
|
|
|
* │ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* │
|
|
|
|
* │ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* └─────▏FTimerEvent ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FEVENT_H
|
|
|
|
#define FEVENT_H
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-10-31 00:41:59 +01:00
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fc.h"
|
|
|
|
#include "final/fpoint.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
int t{fc::None_Event};
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FKeyEvent() = default;
|
2018-11-21 20:07:08 +01:00
|
|
|
FKeyEvent (int, FKey);
|
2017-09-11 03:06:02 +02:00
|
|
|
~FKeyEvent();
|
|
|
|
|
2018-11-21 20:07:08 +01:00
|
|
|
FKey key() const;
|
2017-09-11 03:06:02 +02:00
|
|
|
bool isAccepted() const;
|
|
|
|
void accept();
|
|
|
|
void ignore();
|
|
|
|
|
|
|
|
protected:
|
2018-12-03 03:22:36 +01:00
|
|
|
FKey k{0};
|
|
|
|
bool accpt{false};
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FMouseEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
FMouseEvent (int, const FPoint&, const FPoint&, int);
|
2018-12-03 03:22:36 +01:00
|
|
|
FMouseEvent (int, const FPoint&, int);
|
2017-09-11 03:06:02 +02:00
|
|
|
~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)
|
|
|
|
|
2016-06-16 00:39:01 +02:00
|
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FWheelEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FFocusEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
bool accpt{true};
|
|
|
|
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
|
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
|
|
|
public:
|
2018-12-03 03:22:36 +01:00
|
|
|
FAccelEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
FAccelEvent (int, void*);
|
2018-12-09 22:04:55 +01:00
|
|
|
FAccelEvent (const FAccelEvent&) = delete;
|
2017-09-11 03:06:02 +02:00
|
|
|
~FAccelEvent();
|
2018-12-09 22:04:55 +01:00
|
|
|
FAccelEvent& operator = (const FAccelEvent&) = delete;
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
void* focusedWidget() const;
|
|
|
|
bool isAccepted() const;
|
|
|
|
void accept();
|
|
|
|
void ignore();
|
|
|
|
|
|
|
|
protected:
|
2018-12-03 03:22:36 +01:00
|
|
|
bool accpt{false};
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FResizeEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
bool accpt{false};
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FShowEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FHideEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FCloseEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
bool accpt{false};
|
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:
|
2018-12-03 03:22:36 +01:00
|
|
|
FTimerEvent() = default;
|
2017-09-11 03:06:02 +02:00
|
|
|
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)
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
} // namespace finalcut
|
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FEVENT_H
|