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