New event FUserEvent for user-defined events
This commit is contained in:
parent
81a4e72916
commit
9a694ab267
|
@ -1,3 +1,7 @@
|
|||
2018-12-24 Markus Gans <guru.mail@muenster.de>
|
||||
* Events can not only be sent to FWidgets, but also to FObjects
|
||||
* New event FUserEvent for user-defined events
|
||||
|
||||
2018-12-19 Markus Gans <guru.mail@muenster.de>
|
||||
* Use of smart pointers
|
||||
* Add a "memory management" Chapter into the first steps document
|
||||
|
|
|
@ -40,8 +40,10 @@ class CheckList : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit CheckList (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
CheckList (const CheckList&) = delete;
|
||||
|
||||
// Destructor
|
||||
~CheckList();
|
||||
|
||||
|
|
|
@ -78,8 +78,10 @@ class Listbox : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Listbox (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Listbox (const Listbox&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Listbox();
|
||||
|
||||
|
|
|
@ -40,8 +40,10 @@ class Listview : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Listview (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Listview (const Listview&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Listview();
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ class Menu : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Menu (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Menu (const Menu&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Menu();
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ class ColorChooser : public finalcut::FWidget
|
|||
public:
|
||||
// Constructor
|
||||
explicit ColorChooser (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
ColorChooser (const ColorChooser&) = delete;
|
||||
|
||||
// Destructor
|
||||
~ColorChooser();
|
||||
|
||||
|
@ -171,8 +173,10 @@ class Brushes : public finalcut::FWidget
|
|||
public:
|
||||
// Constructor
|
||||
explicit Brushes (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Brushes (const Brushes&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Brushes();
|
||||
|
||||
|
@ -309,8 +313,10 @@ class MouseDraw : public finalcut::FDialog
|
|||
|
||||
// Constructor
|
||||
explicit MouseDraw (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
MouseDraw (const MouseDraw&) = delete;
|
||||
|
||||
// Destructor
|
||||
~MouseDraw();
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ class Scrollview : public finalcut::FScrollView
|
|||
public:
|
||||
// Constructor
|
||||
explicit Scrollview (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Scrollview (const Scrollview&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Scrollview ();
|
||||
|
||||
|
|
|
@ -36,8 +36,10 @@ class AttribDlg : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit AttribDlg (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
AttribDlg (const AttribDlg&) = delete;
|
||||
|
||||
// Destructor
|
||||
~AttribDlg();
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void Timer::draw()
|
|||
void Timer::onTimer (finalcut::FTimerEvent* ev)
|
||||
{
|
||||
bool is_last_line = false;
|
||||
int timer_id = ev->timerId();
|
||||
int timer_id = ev->getTimerId();
|
||||
|
||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||
is_last_line = true;
|
||||
|
|
|
@ -44,8 +44,10 @@ class Transparent : public finalcut::FDialog
|
|||
// Constructor
|
||||
explicit Transparent ( finalcut::FWidget* = nullptr
|
||||
, trans_type = transparent );
|
||||
|
||||
// Disable copy constructor
|
||||
Transparent (const Transparent&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Transparent();
|
||||
|
||||
|
@ -151,8 +153,10 @@ class MainWindow : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit MainWindow (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
MainWindow (const MainWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
~MainWindow();
|
||||
|
||||
|
|
|
@ -115,8 +115,10 @@ class Treeview : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Treeview (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Treeview (const Treeview&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Treeview();
|
||||
|
||||
|
|
|
@ -39,8 +39,10 @@ class ProgressDialog : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit ProgressDialog (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
ProgressDialog (const ProgressDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
~ProgressDialog();
|
||||
|
||||
|
@ -182,8 +184,10 @@ class TextWindow : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit TextWindow (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
TextWindow (const TextWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
~TextWindow();
|
||||
|
||||
|
@ -250,8 +254,10 @@ class MyDialog : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit MyDialog (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
MyDialog (const MyDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
~MyDialog();
|
||||
|
||||
|
|
|
@ -36,8 +36,10 @@ class Watch : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Watch (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Watch (const Watch&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Watch();
|
||||
|
||||
|
|
|
@ -36,8 +36,10 @@ class SmallWindow : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit SmallWindow (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
SmallWindow (const SmallWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
~SmallWindow();
|
||||
|
||||
|
@ -165,8 +167,10 @@ class Window : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Window (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Window (const Window&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Window();
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ FApplication::~FApplication() // destructor
|
|||
|
||||
// public methods of FApplication
|
||||
//----------------------------------------------------------------------
|
||||
FWidget* FApplication::getApplicationObject()
|
||||
FApplication* FApplication::getApplicationObject()
|
||||
{
|
||||
return static_cast<FWidget*>(app_object);
|
||||
return app_object;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -167,9 +167,8 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
if ( ! receiver )
|
||||
return false;
|
||||
|
||||
if ( ! receiver->isWidget() )
|
||||
return false;
|
||||
|
||||
if ( receiver->isWidget() )
|
||||
{
|
||||
const auto r_widget = static_cast<const FWidget*>(receiver);
|
||||
auto widget = const_cast<FWidget*>(r_widget);
|
||||
|
||||
|
@ -213,13 +212,11 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
&& event->type() <= fc::MouseMove_Event
|
||||
&& ! widget->isEnabled() )
|
||||
return false;
|
||||
|
||||
// For access to a protected base class member
|
||||
auto const_w = static_cast<const FApplication*>(widget);
|
||||
auto w = const_cast<FApplication*>(const_w);
|
||||
}
|
||||
|
||||
// Sends event event directly to receiver
|
||||
return w->event(const_cast<FEvent*>(event));
|
||||
auto r = const_cast<FObject*>(receiver);
|
||||
return r->event(const_cast<FEvent*>(event));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -359,7 +356,7 @@ void FApplication::closeConfirmationDialog (FWidget* w, FCloseEvent* ev)
|
|||
void FApplication::init (long key_time, long dblclick_time)
|
||||
{
|
||||
// Initialize keyboard
|
||||
keyboard = getKeyboard();
|
||||
keyboard = FVTerm::getKeyboard();
|
||||
|
||||
// Set the keyboard keypress timeout
|
||||
if ( keyboard )
|
||||
|
@ -374,7 +371,7 @@ void FApplication::init (long key_time, long dblclick_time)
|
|||
}
|
||||
|
||||
// Initialize mouse control
|
||||
mouse = getMouseControl();
|
||||
mouse = FVTerm::getMouseControl();
|
||||
|
||||
// Set stdin number for a gpm-mouse
|
||||
if ( mouse )
|
||||
|
@ -626,7 +623,7 @@ inline bool FApplication::sendKeyUpEvent (FWidget* widget)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FApplication::sendKeyboardAccelerator()
|
||||
{
|
||||
if ( getOpenMenu() )
|
||||
if ( FWidget::getOpenMenu() )
|
||||
return;
|
||||
|
||||
// Switch to a specific dialog with Meta + 1..9
|
||||
|
@ -760,7 +757,7 @@ bool FApplication::getMouseEvent()
|
|||
//----------------------------------------------------------------------
|
||||
FWidget*& FApplication::determineClickedWidget()
|
||||
{
|
||||
FWidget*& clicked = getClickedWidget();
|
||||
FWidget*& clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( clicked )
|
||||
return clicked;
|
||||
|
@ -812,7 +809,7 @@ void FApplication::closeOpenMenu()
|
|||
{
|
||||
// Close the open menu
|
||||
|
||||
auto openmenu = getOpenMenu();
|
||||
auto openmenu = FWidget::getOpenMenu();
|
||||
auto menu = static_cast<FMenu*>(openmenu);
|
||||
|
||||
if ( ! openmenu || ( mouse && mouse->isMoved()) )
|
||||
|
@ -840,11 +837,11 @@ void FApplication::closeOpenMenu()
|
|||
menu->hideSuperMenus();
|
||||
|
||||
// No widget was been clicked and the menu is no dialog menu
|
||||
if ( ! (getClickedWidget() || is_window_menu) )
|
||||
if ( ! (FWidget::getClickedWidget() || is_window_menu) )
|
||||
FWindow::switchToPrevWindow(this);
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
if ( FWidget::getStatusBar() )
|
||||
FWidget::getStatusBar()->drawMessage();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -855,8 +852,8 @@ void FApplication::unselectMenubarItems()
|
|||
{
|
||||
// Unselect the menu bar items
|
||||
|
||||
auto openmenu = getOpenMenu();
|
||||
auto menu_bar = getMenuBar();
|
||||
auto openmenu = FWidget::getOpenMenu();
|
||||
auto menu_bar = FWidget::getMenuBar();
|
||||
|
||||
if ( openmenu || (mouse && mouse->isMoved()) )
|
||||
return;
|
||||
|
@ -872,20 +869,20 @@ void FApplication::unselectMenubarItems()
|
|||
|
||||
const FPoint& mouse_position = mouse->getPos();
|
||||
|
||||
if ( ! getMenuBar()->getTermGeometry().contains(mouse_position) )
|
||||
if ( ! menu_bar->getTermGeometry().contains(mouse_position) )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
if ( FWidget::getStatusBar() )
|
||||
FWidget::getStatusBar()->clearMessage();
|
||||
|
||||
getMenuBar()->resetMenu();
|
||||
getMenuBar()->redraw();
|
||||
menu_bar->resetMenu();
|
||||
menu_bar->redraw();
|
||||
|
||||
// No widget was been clicked
|
||||
if ( ! getClickedWidget() )
|
||||
if ( ! FWidget::getClickedWidget() )
|
||||
FWindow::switchToPrevWindow(this);
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
if ( FWidget::getStatusBar() )
|
||||
FWidget::getStatusBar()->drawMessage();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -895,7 +892,7 @@ void FApplication::unselectMenubarItems()
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::sendMouseEvent()
|
||||
{
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( ! clicked )
|
||||
return;
|
||||
|
@ -941,7 +938,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isLeftButtonPressed() )
|
||||
{
|
||||
|
@ -979,7 +976,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isLeftButtonDoubleClick() )
|
||||
{
|
||||
|
@ -1021,7 +1018,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isRightButtonPressed() )
|
||||
{
|
||||
|
@ -1055,7 +1052,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isMiddleButtonPressed() )
|
||||
{
|
||||
|
@ -1094,7 +1091,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isWheelUp() )
|
||||
{
|
||||
|
|
|
@ -342,7 +342,7 @@ void FButton::onMouseMove (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::onTimer (FTimerEvent* ev)
|
||||
{
|
||||
delTimer(ev->timerId());
|
||||
delTimer(ev->getTimerId());
|
||||
setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FDialog::~FDialog() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
bool is_quit = fapp->isQuit();
|
||||
delete dialog_menu;
|
||||
dgl_menuitem = nullptr;
|
||||
|
@ -130,7 +130,7 @@ void FDialog::show()
|
|||
|
||||
if ( isModal() )
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->enter_loop();
|
||||
|
||||
if ( this == getMainWidget() )
|
||||
|
@ -145,7 +145,7 @@ void FDialog::hide()
|
|||
|
||||
if ( isModal() )
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->exit_loop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace finalcut
|
|||
// class FEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FEvent::FEvent(int ev_type) // constructor
|
||||
FEvent::FEvent (fc::events ev_type) // constructor
|
||||
: t{ev_type}
|
||||
{ }
|
||||
|
||||
|
@ -40,7 +40,7 @@ FEvent::~FEvent() // destructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FEvent::type() const
|
||||
fc::events FEvent::type() const
|
||||
{ return t; }
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ int FEvent::type() const
|
|||
// class FKeyEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FKeyEvent::FKeyEvent (int ev_type, FKey key_num) // constructor
|
||||
FKeyEvent::FKeyEvent (fc::events ev_type, FKey key_num) // constructor
|
||||
: FEvent(ev_type)
|
||||
, k{key_num}
|
||||
{ }
|
||||
|
@ -78,7 +78,7 @@ void FKeyEvent::ignore()
|
|||
// class FMouseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FMouseEvent::FMouseEvent ( int ev_type // constructor
|
||||
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, const FPoint& termPos
|
||||
, int button )
|
||||
|
@ -89,7 +89,7 @@ FMouseEvent::FMouseEvent ( int ev_type // constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FMouseEvent::FMouseEvent ( int ev_type // constructor
|
||||
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, int button )
|
||||
: FMouseEvent(ev_type, pos, FPoint(), button)
|
||||
|
@ -132,7 +132,7 @@ int FMouseEvent::getButton() const
|
|||
// class FWheelEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FWheelEvent::FWheelEvent ( int ev_type // constructor
|
||||
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, const FPoint& termPos
|
||||
, int wheel )
|
||||
|
@ -143,7 +143,7 @@ FWheelEvent::FWheelEvent ( int ev_type // constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWheelEvent::FWheelEvent ( int ev_type // constructor
|
||||
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, int wheel )
|
||||
: FWheelEvent(ev_type, pos, FPoint(), wheel)
|
||||
|
@ -186,7 +186,7 @@ int FWheelEvent::getWheel() const
|
|||
// class FFocusEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FFocusEvent::FFocusEvent (int ev_type) // constructor
|
||||
FFocusEvent::FFocusEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -231,7 +231,7 @@ void FFocusEvent::ignore()
|
|||
// class FAccelEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor
|
||||
FAccelEvent::FAccelEvent (fc::events ev_type, void* focused) // constructor
|
||||
: FEvent(ev_type)
|
||||
, focus_widget{focused}
|
||||
{ }
|
||||
|
@ -261,7 +261,7 @@ void FAccelEvent::ignore()
|
|||
// class FResizeEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FResizeEvent::FResizeEvent(int ev_type) // constructor
|
||||
FResizeEvent::FResizeEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -286,7 +286,7 @@ void FResizeEvent::ignore()
|
|||
// class FShowEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FShowEvent::FShowEvent(int ev_type) // constructor
|
||||
FShowEvent::FShowEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -294,11 +294,12 @@ FShowEvent::FShowEvent(int ev_type) // constructor
|
|||
FShowEvent::~FShowEvent() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FHideEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FHideEvent::FHideEvent(int ev_type) // constructor
|
||||
FHideEvent::FHideEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -306,11 +307,12 @@ FHideEvent::FHideEvent(int ev_type) // constructor
|
|||
FHideEvent::~FHideEvent() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FCloseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FCloseEvent::FCloseEvent(int ev_type) // constructor
|
||||
FCloseEvent::FCloseEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -335,7 +337,7 @@ void FCloseEvent::ignore()
|
|||
// class FTimerEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor
|
||||
FTimerEvent::FTimerEvent (fc::events ev_type, int timer_id) // constructor
|
||||
: FEvent(ev_type)
|
||||
, id{timer_id}
|
||||
{ }
|
||||
|
@ -345,7 +347,33 @@ FTimerEvent::~FTimerEvent() // destructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FTimerEvent::timerId() const
|
||||
int FTimerEvent::getTimerId() const
|
||||
{ return id; }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FUserEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FUserEvent::FUserEvent (fc::events ev_type, int user_event_id) // constructor
|
||||
: FEvent(ev_type)
|
||||
, uid{user_event_id}
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FUserEvent::~FUserEvent() // destructor
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FUserEvent::getUserId() const
|
||||
{ return uid; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FUserEvent::data_ptr FUserEvent::getData() const
|
||||
{ return data_pointer; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FUserEvent::setData (data_ptr data)
|
||||
{ data_pointer = data; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -53,7 +53,7 @@ FMenu::FMenu (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FMenu::~FMenu() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( ! fapp->isQuit() )
|
||||
switchToPrevWindow(this); // Switch to previous window
|
||||
|
|
|
@ -732,7 +732,7 @@ void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
|
|||
void FMenuItem::cb_destroyDialog (FWidget* widget, data_ptr)
|
||||
{
|
||||
auto win = static_cast<FDialog*>(widget);
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( win && fapp )
|
||||
{
|
||||
|
|
|
@ -166,6 +166,26 @@ void FObject::delChild (FObject* obj)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::event (FEvent* ev)
|
||||
{
|
||||
// Receives events on this object
|
||||
|
||||
if ( ev->type() == fc::Timer_Event )
|
||||
{
|
||||
onTimer ( static_cast<FTimerEvent*>(ev) );
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ev->type() == fc::User_Event )
|
||||
{
|
||||
onUserEvent ( static_cast<FUserEvent*>(ev) );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FObject::getCurrentTime (timeval* time)
|
||||
{
|
||||
|
@ -341,21 +361,11 @@ bool FObject::delAllTimer()
|
|||
|
||||
// protected methods of FObject
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::event (FEvent* ev)
|
||||
{
|
||||
// Receives events on this object
|
||||
|
||||
if ( ev->type() == fc::Timer_Event )
|
||||
{
|
||||
onTimer ( const_cast<FTimerEvent*>(static_cast<const FTimerEvent*>(ev)) );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
void FObject::onTimer (FTimerEvent*)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FObject::onTimer (FTimerEvent*)
|
||||
void FObject::onUserEvent (FUserEvent*)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -49,7 +49,7 @@ FToolTip::FToolTip (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FToolTip::~FToolTip() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( fapp->isQuit() )
|
||||
return;
|
||||
|
|
|
@ -240,7 +240,7 @@ void FVTerm::updateTerminal()
|
|||
// Updates pending changes to the terminal
|
||||
|
||||
if ( stop_terminal_updates
|
||||
|| static_cast<FApplication*>(init_object)->isQuit() )
|
||||
|| FApplication::getApplicationObject()->isQuit() )
|
||||
return;
|
||||
|
||||
if ( ! force_terminal_update )
|
||||
|
|
|
@ -1436,8 +1436,7 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::quit()
|
||||
{
|
||||
auto app_object = FApplication::getApplicationObject();
|
||||
auto fapp = static_cast<FApplication*>(app_object);
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->exit(0);
|
||||
}
|
||||
|
||||
|
@ -2340,7 +2339,7 @@ void FWidget::setColorTheme()
|
|||
wc.set16ColorTheme();
|
||||
|
||||
if ( isKdeTerminal() )
|
||||
wc.term_bg = fc::SteelBlue3;
|
||||
wc.term_bg = fc::SkyBlue2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ FWindow::FWindow(FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FWindow::~FWindow() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( previous_window == this )
|
||||
previous_window = nullptr;
|
||||
|
|
|
@ -47,6 +47,7 @@ class emptyFString
|
|||
public:
|
||||
// Constructors
|
||||
emptyFString() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
emptyFString (const emptyFString&) = delete;
|
||||
|
||||
|
|
|
@ -85,8 +85,10 @@ class FApplication : public FWidget
|
|||
public:
|
||||
// Constructor
|
||||
FApplication (const int&, char*[], bool = false);
|
||||
|
||||
// Disable copy constructor
|
||||
FApplication (const FApplication&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FApplication();
|
||||
|
||||
|
@ -97,7 +99,7 @@ class FApplication : public FWidget
|
|||
const char* getClassName() const;
|
||||
int getArgc() const;
|
||||
char** getArgv() const;
|
||||
static FWidget* getApplicationObject();
|
||||
static FApplication* getApplicationObject();
|
||||
|
||||
// Inquiry
|
||||
static bool isQuit();
|
||||
|
@ -122,7 +124,7 @@ class FApplication : public FWidget
|
|||
static void closeConfirmationDialog (FWidget*, FCloseEvent*);
|
||||
|
||||
// Callback method
|
||||
void cb_exitApp (FWidget*, data_ptr);
|
||||
void cb_exitApp (FWidget*, FWidget::data_ptr);
|
||||
|
||||
private:
|
||||
// Typedefs and Enumerations
|
||||
|
@ -207,7 +209,7 @@ inline char** FApplication::getArgv() const
|
|||
{ return app_argv; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FApplication::cb_exitApp (FWidget*, data_ptr)
|
||||
inline void FApplication::cb_exitApp (FWidget*, FWidget::data_ptr)
|
||||
{ close(); }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -70,8 +70,10 @@ class FButton : public FWidget
|
|||
// Constructors
|
||||
explicit FButton (FWidget* = nullptr);
|
||||
explicit FButton (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FButton (const FButton&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FButton();
|
||||
|
||||
|
|
|
@ -74,8 +74,10 @@ class FButtonGroup : public FScrollView
|
|||
// Constructors
|
||||
explicit FButtonGroup (FWidget* = nullptr);
|
||||
explicit FButtonGroup (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FButtonGroup (const FButtonGroup&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FButtonGroup();
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ enum events
|
|||
Show_Event, // widget is shown
|
||||
Hide_Event, // widget is hidden
|
||||
Close_Event, // widget close
|
||||
Timer_Event // timer event occur
|
||||
Timer_Event, // timer event occur
|
||||
User_Event // user defined event
|
||||
};
|
||||
|
||||
// Internal character encoding
|
||||
|
|
|
@ -75,8 +75,10 @@ class FCheckBox : public FToggleButton
|
|||
// Constructors
|
||||
explicit FCheckBox (FWidget* = nullptr);
|
||||
explicit FCheckBox (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FCheckBox (const FCheckBox&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FCheckBox();
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@ class FCheckMenuItem : public FMenuItem
|
|||
// Constructors
|
||||
explicit FCheckMenuItem (FWidget* = nullptr);
|
||||
explicit FCheckMenuItem (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FCheckMenuItem (const FCheckMenuItem&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FCheckMenuItem();
|
||||
|
||||
|
|
|
@ -89,8 +89,10 @@ class FDialog : public FWindow
|
|||
// Constructors
|
||||
explicit FDialog (FWidget* = nullptr);
|
||||
explicit FDialog (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FDialog (const FDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FDialog();
|
||||
|
||||
|
|
|
@ -81,8 +81,10 @@ class FDialogListMenu : public FMenu
|
|||
// Constructors
|
||||
explicit FDialogListMenu (FWidget* = nullptr);
|
||||
explicit FDialogListMenu (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FDialogListMenu (const FDialogListMenu&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FDialogListMenu();
|
||||
|
||||
|
|
|
@ -93,12 +93,12 @@ class FEvent // event base class
|
|||
{
|
||||
public:
|
||||
FEvent() = default;
|
||||
explicit FEvent(int);
|
||||
explicit FEvent(fc::events);
|
||||
virtual ~FEvent();
|
||||
int type() const;
|
||||
fc::events type() const;
|
||||
|
||||
protected:
|
||||
int t{fc::None_Event};
|
||||
fc::events t{fc::None_Event};
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
@ -115,7 +115,7 @@ class FKeyEvent : public FEvent // keyboard event
|
|||
{
|
||||
public:
|
||||
FKeyEvent() = default;
|
||||
FKeyEvent (int, FKey);
|
||||
FKeyEvent (fc::events, FKey);
|
||||
~FKeyEvent();
|
||||
|
||||
FKey key() const;
|
||||
|
@ -142,8 +142,8 @@ class FMouseEvent : public FEvent // mouse event
|
|||
{
|
||||
public:
|
||||
FMouseEvent() = default;
|
||||
FMouseEvent (int, const FPoint&, const FPoint&, int);
|
||||
FMouseEvent (int, const FPoint&, int);
|
||||
FMouseEvent (fc::events, const FPoint&, const FPoint&, int);
|
||||
FMouseEvent (fc::events, const FPoint&, int);
|
||||
~FMouseEvent();
|
||||
|
||||
const FPoint& getPos() const;
|
||||
|
@ -174,8 +174,8 @@ class FWheelEvent : public FEvent // wheel event
|
|||
{
|
||||
public:
|
||||
FWheelEvent() = default;
|
||||
FWheelEvent (int, const FPoint&, int);
|
||||
FWheelEvent (int, const FPoint&, const FPoint&, int);
|
||||
FWheelEvent (fc::events, const FPoint&, int);
|
||||
FWheelEvent (fc::events, const FPoint&, const FPoint&, int);
|
||||
~FWheelEvent();
|
||||
|
||||
const FPoint& getPos() const;
|
||||
|
@ -206,7 +206,7 @@ class FFocusEvent : public FEvent // focus event
|
|||
{
|
||||
public:
|
||||
FFocusEvent() = default;
|
||||
explicit FFocusEvent (int);
|
||||
explicit FFocusEvent (fc::events);
|
||||
~FFocusEvent();
|
||||
|
||||
bool gotFocus() const;
|
||||
|
@ -235,7 +235,7 @@ class FAccelEvent : public FEvent // focus event
|
|||
{
|
||||
public:
|
||||
FAccelEvent() = default;
|
||||
FAccelEvent (int, void*);
|
||||
FAccelEvent (fc::events, void*);
|
||||
FAccelEvent (const FAccelEvent&) = delete;
|
||||
~FAccelEvent();
|
||||
FAccelEvent& operator = (const FAccelEvent&) = delete;
|
||||
|
@ -261,7 +261,7 @@ class FResizeEvent : public FEvent // resize event
|
|||
{
|
||||
public:
|
||||
FResizeEvent() = default;
|
||||
explicit FResizeEvent (int);
|
||||
explicit FResizeEvent (fc::events);
|
||||
~FResizeEvent();
|
||||
|
||||
bool isAccepted() const;
|
||||
|
@ -273,7 +273,6 @@ class FResizeEvent : public FEvent // resize event
|
|||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FShowEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -282,12 +281,11 @@ class FShowEvent : public FEvent // show event
|
|||
{
|
||||
public:
|
||||
FShowEvent() = default;
|
||||
explicit FShowEvent (int);
|
||||
explicit FShowEvent (fc::events);
|
||||
~FShowEvent();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FHideEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -296,12 +294,11 @@ class FHideEvent : public FEvent // hide event
|
|||
{
|
||||
public:
|
||||
FHideEvent() = default;
|
||||
explicit FHideEvent (int);
|
||||
explicit FHideEvent (fc::events);
|
||||
~FHideEvent();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FCloseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -310,7 +307,7 @@ class FCloseEvent : public FEvent // close event
|
|||
{
|
||||
public:
|
||||
FCloseEvent() = default;
|
||||
explicit FCloseEvent(int);
|
||||
explicit FCloseEvent(fc::events);
|
||||
~FCloseEvent();
|
||||
|
||||
bool isAccepted() const;
|
||||
|
@ -322,7 +319,6 @@ class FCloseEvent : public FEvent // close event
|
|||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTimerEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -334,10 +330,10 @@ class FTimerEvent : public FEvent // timer event
|
|||
{
|
||||
public:
|
||||
FTimerEvent() = default;
|
||||
FTimerEvent(int, int);
|
||||
FTimerEvent (fc::events, int);
|
||||
~FTimerEvent();
|
||||
|
||||
int timerId() const;
|
||||
int getTimerId() const;
|
||||
|
||||
protected:
|
||||
int id;
|
||||
|
@ -345,6 +341,35 @@ class FTimerEvent : public FEvent // timer event
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FUserEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class FUserEvent : public FEvent // timer event
|
||||
{
|
||||
public:
|
||||
// Typedef
|
||||
typedef void* data_ptr;
|
||||
|
||||
FUserEvent() = default;
|
||||
FUserEvent (fc::events, int);
|
||||
~FUserEvent();
|
||||
|
||||
int getUserId() const;
|
||||
data_ptr getData() const;
|
||||
void setData (data_ptr);
|
||||
|
||||
protected:
|
||||
int uid;
|
||||
data_ptr data_pointer{nullptr};
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FEVENT_H
|
||||
|
|
|
@ -108,6 +108,7 @@ class FFileDialog : public FDialog
|
|||
, const FString&
|
||||
, DialogType = FFileDialog::Open
|
||||
, FWidget* = nullptr );
|
||||
|
||||
// Destructor
|
||||
virtual ~FFileDialog();
|
||||
|
||||
|
|
|
@ -92,8 +92,10 @@ class FKeyboard
|
|||
|
||||
// Constructor
|
||||
FKeyboard();
|
||||
|
||||
// Disable copy constructor
|
||||
FKeyboard (const FKeyboard&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FKeyboard();
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@ class FLabel : public FWidget
|
|||
// Constructor
|
||||
explicit FLabel (FWidget* = nullptr);
|
||||
explicit FLabel (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FLabel (const FLabel&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FLabel();
|
||||
|
||||
|
|
|
@ -78,8 +78,10 @@ class FLineEdit : public FWidget
|
|||
// Constructor
|
||||
explicit FLineEdit (FWidget* = nullptr);
|
||||
explicit FLineEdit (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FLineEdit (const FLineEdit&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FLineEdit();
|
||||
|
||||
|
|
|
@ -151,8 +151,10 @@ class FListBox : public FWidget
|
|||
FListBox (Iterator, Iterator, InsertConverter, FWidget* = nullptr);
|
||||
template <typename Container, typename LazyConverter>
|
||||
FListBox (Container, LazyConverter, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FListBox (const FListBox&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FListBox();
|
||||
|
||||
|
|
|
@ -273,8 +273,10 @@ class FListView : public FWidget
|
|||
|
||||
// Constructor
|
||||
explicit FListView (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FListView (const FListView&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FListView();
|
||||
|
||||
|
|
|
@ -80,8 +80,10 @@ class FMenu : public FWindow, public FMenuList
|
|||
// Constructor
|
||||
explicit FMenu (FWidget* = nullptr);
|
||||
explicit FMenu (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FMenu (const FMenu&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenu();
|
||||
|
||||
|
|
|
@ -78,8 +78,10 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
public:
|
||||
// Constructor
|
||||
explicit FMenuBar (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FMenuBar (const FMenuBar&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenuBar();
|
||||
|
||||
|
|
|
@ -85,8 +85,10 @@ class FMenuItem : public FWidget
|
|||
explicit FMenuItem (FWidget* = nullptr);
|
||||
explicit FMenuItem (const FString&, FWidget* = nullptr);
|
||||
FMenuItem (FKey, const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FMenuItem (const FMenuItem&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenuItem();
|
||||
|
||||
|
|
|
@ -63,8 +63,10 @@ class FMenuList
|
|||
public:
|
||||
// Constructor
|
||||
FMenuList() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FMenuList (const FMenuList&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenuList();
|
||||
|
||||
|
|
|
@ -73,8 +73,10 @@ class FObject
|
|||
|
||||
// Constructor
|
||||
explicit FObject (FObject* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FObject (const FObject&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FObject();
|
||||
|
||||
|
@ -107,6 +109,9 @@ class FObject
|
|||
void addChild (FObject*);
|
||||
void delChild (FObject*);
|
||||
|
||||
// Event handler
|
||||
virtual bool event (FEvent*);
|
||||
|
||||
// Timer methods
|
||||
static void getCurrentTime (timeval*);
|
||||
static bool isTimeout (timeval*, long);
|
||||
|
@ -138,8 +143,8 @@ class FObject
|
|||
uInt processTimerEvent();
|
||||
|
||||
// Event handler
|
||||
virtual bool event (FEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onUserEvent (FUserEvent*);
|
||||
|
||||
private:
|
||||
// Method
|
||||
|
|
|
@ -157,8 +157,10 @@ class FOptiAttr
|
|||
|
||||
// Constructor
|
||||
FOptiAttr();
|
||||
|
||||
// Disable copy constructor
|
||||
FOptiAttr (const FOptiAttr&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FOptiAttr();
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@ class FRadioButton : public FToggleButton
|
|||
// Constructors
|
||||
explicit FRadioButton (FWidget* = nullptr);
|
||||
explicit FRadioButton (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FRadioButton (const FRadioButton&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FRadioButton();
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@ class FRadioMenuItem : public FMenuItem
|
|||
// Constructors
|
||||
explicit FRadioMenuItem (FWidget* = nullptr);
|
||||
explicit FRadioMenuItem (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FRadioMenuItem (const FRadioMenuItem&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FRadioMenuItem();
|
||||
|
||||
|
|
|
@ -86,8 +86,10 @@ class FScrollbar : public FWidget
|
|||
// Constructors
|
||||
explicit FScrollbar (FWidget* = nullptr);
|
||||
explicit FScrollbar (int = fc::vertical, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FScrollbar (const FScrollbar&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FScrollbar();
|
||||
|
||||
|
|
|
@ -76,8 +76,10 @@ class FScrollView : public FWidget
|
|||
|
||||
// Constructor
|
||||
explicit FScrollView (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FScrollView (const FScrollView&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FScrollView();
|
||||
|
||||
|
|
|
@ -82,8 +82,10 @@ class FStatusKey : public FWidget
|
|||
// Constructors
|
||||
explicit FStatusKey (FWidget* = nullptr);
|
||||
FStatusKey (FKey, const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FStatusKey (const FStatusKey&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FStatusKey();
|
||||
|
||||
|
@ -193,8 +195,10 @@ class FStatusBar : public FWindow
|
|||
public:
|
||||
// Constructor
|
||||
explicit FStatusBar (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FStatusBar (const FStatusBar&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FStatusBar();
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@ class FSwitch : public FToggleButton
|
|||
// Constructors
|
||||
explicit FSwitch (FWidget* = nullptr);
|
||||
explicit FSwitch (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FSwitch (const FSwitch&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FSwitch();
|
||||
|
||||
|
|
|
@ -161,8 +161,10 @@ class FTerm
|
|||
|
||||
// Constructor
|
||||
explicit FTerm (bool = false);
|
||||
|
||||
// Disable copy constructor
|
||||
FTerm (const FTerm&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FTerm();
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ class FTermBuffer
|
|||
|
||||
// Constructor
|
||||
FTermBuffer() = default;
|
||||
|
||||
// Destructor
|
||||
virtual ~FTermBuffer();
|
||||
|
||||
|
|
|
@ -61,8 +61,10 @@ class FTermData
|
|||
|
||||
// Constructors
|
||||
FTermData() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermData (const FTermData&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FTermData() = default;
|
||||
|
||||
|
|
|
@ -48,8 +48,10 @@ class FTermDebugData
|
|||
public:
|
||||
// Constructors
|
||||
FTermDebugData() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermDebugData (const FTermDebugData&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FTermDebugData() = default;
|
||||
|
||||
|
|
|
@ -64,8 +64,10 @@ class FTermFreeBSD
|
|||
|
||||
// Constructors
|
||||
FTermFreeBSD() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermFreeBSD (const FTermFreeBSD&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FTermFreeBSD() = default;
|
||||
|
||||
|
|
|
@ -71,8 +71,10 @@ class FTermLinux
|
|||
public:
|
||||
// Constructors
|
||||
FTermLinux() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermLinux (const FTermLinux&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FTermLinux();
|
||||
|
||||
|
|
|
@ -57,8 +57,10 @@ class FTermOpenBSD
|
|||
public:
|
||||
// Constructors
|
||||
FTermOpenBSD() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermOpenBSD (const FTermOpenBSD&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FTermOpenBSD() = default;
|
||||
|
||||
|
|
|
@ -78,8 +78,10 @@ class FTextView : public FWidget
|
|||
|
||||
// Constructor
|
||||
explicit FTextView (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FTextView (const FTextView&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FTextView();
|
||||
|
||||
|
|
|
@ -76,8 +76,10 @@ class FToggleButton : public FWidget
|
|||
// Constructors
|
||||
explicit FToggleButton (FWidget* = nullptr);
|
||||
explicit FToggleButton (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FToggleButton (const FToggleButton&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FToggleButton();
|
||||
|
||||
|
|
|
@ -77,8 +77,10 @@ class FToolTip : public FWindow
|
|||
// Constructor
|
||||
explicit FToolTip (FWidget* = nullptr);
|
||||
explicit FToolTip (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FToolTip (const FToolTip&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FToolTip ();
|
||||
|
||||
|
|
|
@ -118,8 +118,10 @@ class FVTerm
|
|||
|
||||
// Constructor
|
||||
explicit FVTerm (bool, bool = false);
|
||||
|
||||
// Disable copy constructor
|
||||
FVTerm (const FVTerm&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FVTerm();
|
||||
|
||||
|
|
|
@ -167,8 +167,10 @@ class FWidget : public FVTerm, public FObject
|
|||
|
||||
// Constructor
|
||||
explicit FWidget (FWidget* = nullptr, bool = false);
|
||||
|
||||
// Disable copy constructor
|
||||
FWidget (const FWidget&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FWidget();
|
||||
|
||||
|
|
|
@ -83,8 +83,10 @@ class FWindow : public FWidget
|
|||
|
||||
// Constructor
|
||||
explicit FWindow (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FWindow (const FWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FWindow ();
|
||||
|
||||
|
|
|
@ -82,6 +82,62 @@ class FObject_protected : public finalcut::FObject
|
|||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class FObject_timer : public finalcut::FObject
|
||||
{
|
||||
public:
|
||||
FObject_timer()
|
||||
{ }
|
||||
|
||||
int getValue() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void onTimer (finalcut::FTimerEvent* ev)
|
||||
{
|
||||
if ( ev->getTimerId() == 1 )
|
||||
value++;
|
||||
}
|
||||
|
||||
private:
|
||||
// Data Member
|
||||
int value{0};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class FObject_userEvent : public finalcut::FObject
|
||||
{
|
||||
public:
|
||||
FObject_userEvent()
|
||||
{ }
|
||||
|
||||
int getValue() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void onUserEvent (finalcut::FUserEvent* ev)
|
||||
{
|
||||
if ( ev->getUserId() == 42 )
|
||||
value = *(static_cast<int*>(ev->getData()));
|
||||
}
|
||||
|
||||
private:
|
||||
// Data Member
|
||||
int value{0};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FObjectTest
|
||||
|
@ -108,6 +164,7 @@ class FObjectTest : public CPPUNIT_NS::TestFixture
|
|||
void timeTest();
|
||||
void timerTest();
|
||||
void performTimerActionTest();
|
||||
void userEventTest();
|
||||
|
||||
private:
|
||||
// Adds code needed to register the test suite
|
||||
|
@ -125,6 +182,7 @@ class FObjectTest : public CPPUNIT_NS::TestFixture
|
|||
CPPUNIT_TEST (timeTest);
|
||||
CPPUNIT_TEST (timerTest);
|
||||
CPPUNIT_TEST (performTimerActionTest);
|
||||
CPPUNIT_TEST (userEventTest);
|
||||
|
||||
// End of test suite definition
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
@ -494,14 +552,14 @@ void FObjectTest::timerTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FObjectTest::performTimerActionTest()
|
||||
{
|
||||
FObject_protected t;
|
||||
FObject_protected t1;
|
||||
uInt num_events = 0;
|
||||
uInt loop = 0;
|
||||
t.addTimer(100);
|
||||
t1.addTimer(100);
|
||||
|
||||
while ( loop < 10 )
|
||||
{
|
||||
num_events += t.processEvent();
|
||||
num_events += t1.processEvent();
|
||||
// Wait 100 ms
|
||||
nanosleep ((const struct timespec[]){{0, 100000000L}}, NULL);
|
||||
loop++;
|
||||
|
@ -509,7 +567,29 @@ void FObjectTest::performTimerActionTest()
|
|||
|
||||
CPPUNIT_ASSERT ( loop == 10 );
|
||||
CPPUNIT_ASSERT ( num_events == 9 );
|
||||
CPPUNIT_ASSERT ( t.count == 9 );
|
||||
CPPUNIT_ASSERT ( t1.count == 9 );
|
||||
|
||||
FObject_timer t2;
|
||||
CPPUNIT_ASSERT ( t2.getValue() == 0 );
|
||||
finalcut::FTimerEvent timer_ev (finalcut::fc::Timer_Event, 1);
|
||||
|
||||
for (int x = 0; x < 10; x++)
|
||||
finalcut::FApplication::sendEvent (&t2, &timer_ev);
|
||||
|
||||
CPPUNIT_ASSERT ( t2.getValue() == 10 );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FObjectTest::userEventTest()
|
||||
{
|
||||
FObject_userEvent user;
|
||||
CPPUNIT_ASSERT ( user.getValue() == 0 );
|
||||
|
||||
int n = 9;
|
||||
finalcut::FUserEvent user_ev (finalcut::fc::User_Event, 42);
|
||||
user_ev.setData( (void*)(&n) );
|
||||
finalcut::FApplication::sendEvent (&user, &user_ev);
|
||||
CPPUNIT_ASSERT ( user.getValue() == 9 );
|
||||
}
|
||||
|
||||
// Put the test suite in the registry
|
||||
|
|
Loading…
Reference in New Issue