2015-05-23 13:35:12 +02:00
|
|
|
// fevent.cpp
|
|
|
|
// class FEvent
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
#include "fevent.h"
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FKeyEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FKeyEvent::FKeyEvent(int ev_type, int key_num) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, k(key_num)
|
|
|
|
, accpt(false)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FKeyEvent::~FKeyEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FKeyEvent::key() const
|
|
|
|
{ return k; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FKeyEvent::isAccepted() const
|
|
|
|
{ return accpt; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FKeyEvent::accept()
|
|
|
|
{ accpt = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FKeyEvent::ignore()
|
|
|
|
{ accpt = false; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouseEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FMouseEvent::FMouseEvent ( int ev_type, // constructor
|
|
|
|
const FPoint& pos,
|
|
|
|
int button )
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, p(pos)
|
|
|
|
, b(button)
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-20 05:44:50 +02:00
|
|
|
FMouseEvent::FMouseEvent ( int ev_type, // constructor
|
|
|
|
const FPoint& pos,
|
|
|
|
const FPoint& globalPos,
|
|
|
|
int button )
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, p(pos)
|
|
|
|
, g(globalPos)
|
|
|
|
, b(button)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FMouseEvent::~FMouseEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const FPoint& FMouseEvent::getPos() const
|
|
|
|
{ return p; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const FPoint& FMouseEvent::getGlobalPos() const
|
|
|
|
{ return g; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FMouseEvent::getX() const
|
|
|
|
{ return p.getX(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FMouseEvent::getY() const
|
|
|
|
{ return p.getY(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FMouseEvent::getGlobalX() const
|
|
|
|
{ return g.getX(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FMouseEvent::getGlobalY() const
|
|
|
|
{ return g.getY(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FMouseEvent::getButton() const
|
|
|
|
{ return b; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FWheelEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FWheelEvent::FWheelEvent ( int ev_type, // constructor
|
|
|
|
const FPoint& pos,
|
|
|
|
int wheel )
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, p(pos)
|
|
|
|
, w(wheel)
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2015-09-20 05:44:50 +02:00
|
|
|
FWheelEvent::FWheelEvent (int ev_type, // constructor
|
2015-05-23 13:35:12 +02:00
|
|
|
const FPoint& pos,
|
|
|
|
const FPoint& globalPos,
|
2015-09-20 05:44:50 +02:00
|
|
|
int wheel)
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, p(pos)
|
|
|
|
, g(globalPos)
|
|
|
|
, w(wheel)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FWheelEvent::~FWheelEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const FPoint& FWheelEvent::getPos() const
|
|
|
|
{ return p; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const FPoint& FWheelEvent::getGlobalPos() const
|
|
|
|
{ return g; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FWheelEvent::getX() const
|
|
|
|
{ return p.getX(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FWheelEvent::getY() const
|
|
|
|
{ return p.getY(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FWheelEvent::getGlobalX() const
|
|
|
|
{ return g.getX(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FWheelEvent::getGlobalY() const
|
|
|
|
{ return g.getY(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FWheelEvent::getWheel() const
|
|
|
|
{ return w; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FFocusEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FFocusEvent::FFocusEvent (int ev_type) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, accpt(true)
|
|
|
|
, focus_type(FocusDefiniteWidget)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FFocusEvent::~FFocusEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FFocusEvent::gotFocus() const
|
|
|
|
{
|
|
|
|
return (type() == FocusIn_Event);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FFocusEvent::lostFocus() const
|
|
|
|
{
|
|
|
|
return (type() == FocusOut_Event);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FocusTypes FFocusEvent::getFocusType() const
|
|
|
|
{ return focus_type; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FFocusEvent::setFocusType(FocusTypes ft)
|
|
|
|
{ focus_type = ft; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FFocusEvent::isAccepted() const
|
|
|
|
{ return accpt; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FFocusEvent::accept()
|
|
|
|
{ accpt = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FFocusEvent::ignore()
|
|
|
|
{ accpt = false; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FAccelEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, accpt(false)
|
|
|
|
, focus_widget(focused)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FAccelEvent::~FAccelEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void* FAccelEvent::focusedWidget() const
|
|
|
|
{ return focus_widget; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FAccelEvent::isAccepted() const
|
|
|
|
{ return accpt; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FAccelEvent::accept()
|
|
|
|
{ accpt = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FAccelEvent::ignore()
|
|
|
|
{ accpt = false; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FResizeEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FResizeEvent::FResizeEvent(int ev_type) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, accpt(false)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FResizeEvent::~FResizeEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FResizeEvent::isAccepted() const
|
|
|
|
{ return accpt; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FResizeEvent::accept()
|
|
|
|
{ accpt = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FResizeEvent::ignore()
|
|
|
|
{ accpt = false; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FShowEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FShowEvent::FShowEvent(int ev_type) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FShowEvent::~FShowEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FHideEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FHideEvent::FHideEvent(int ev_type) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FHideEvent::~FHideEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FCloseEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FCloseEvent::FCloseEvent(int ev_type) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, accpt(false)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FCloseEvent::~FCloseEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool FCloseEvent::isAccepted() const
|
|
|
|
{ return accpt; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FCloseEvent::accept()
|
|
|
|
{ accpt = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FCloseEvent::ignore()
|
|
|
|
{ accpt = false; }
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FTimerEvent
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2015-09-20 05:44:50 +02:00
|
|
|
FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor
|
|
|
|
: FEvent(ev_type)
|
|
|
|
, id(timer_id)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FTimerEvent::~FTimerEvent() // destructor
|
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int FTimerEvent::timerId() const
|
|
|
|
{ return id; }
|