Add a standardized cb_exitApp callback method to FApplication

This commit is contained in:
Markus Gans 2017-10-29 18:27:38 +01:00
parent 7caeb02217
commit 9b47e5c980
9 changed files with 20 additions and 64 deletions

View File

@ -1,5 +1,6 @@
2017-10-29 Markus Gans <guru.mail@muenster.de> 2017-10-29 Markus Gans <guru.mail@muenster.de>
* Adaptation of the inheritance diagrams in the header files * Adaptation of the inheritance diagrams in the header files
* Add a standardized cb_exitApp callback method to FApplication
2017-10-27 Markus Gans <guru.mail@muenster.de> 2017-10-27 Markus Gans <guru.mail@muenster.de>
* FWidget now inherits directly from FObject * FWidget now inherits directly from FObject

View File

@ -85,9 +85,6 @@ class Listbox : public FDialog
// Event handlers // Event handlers
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback method
void cb_exitApp (FWidget*, data_ptr);
// Data Member // Data Member
std::list<double>* double_list; std::list<double>* double_list;
}; };
@ -150,7 +147,7 @@ Listbox::Listbox (FWidget* parent)
Quit->addCallback Quit->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Listbox::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
} }
@ -175,12 +172,6 @@ void Listbox::onClose (FCloseEvent* ev)
ev->ignore(); ev->ignore();
} }
//----------------------------------------------------------------------
void Listbox::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// main part // main part

View File

@ -54,8 +54,7 @@ class Listview : public FDialog
// Event handlers // Event handlers
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods // Callback method
void cb_exitApp (FWidget*, data_ptr);
void cb_showInMessagebox (FWidget*, data_ptr); void cb_showInMessagebox (FWidget*, data_ptr);
}; };
#pragma pack(pop) #pragma pack(pop)
@ -143,7 +142,7 @@ Listview::Listview (FWidget* parent)
Quit->addCallback Quit->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Listview::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
listView->addCallback listView->addCallback
@ -171,12 +170,6 @@ void Listview::onClose (FCloseEvent* ev)
ev->ignore(); ev->ignore();
} }
//----------------------------------------------------------------------
void Listview::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Listview::cb_showInMessagebox (FWidget* widget, data_ptr) void Listview::cb_showInMessagebox (FWidget* widget, data_ptr)
{ {

View File

@ -60,9 +60,8 @@ class Menu : public FDialog
// Event handler // Event handler
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods // Callback method
void cb_message (FWidget*, data_ptr); void cb_message (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
}; };
#pragma pack(pop) #pragma pack(pop)
@ -194,7 +193,7 @@ Menu::Menu (FWidget* parent)
Quit->addCallback Quit->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Menu::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
// Statusbar at the bottom // Statusbar at the bottom
@ -285,12 +284,6 @@ void Menu::cb_message (FWidget* widget, data_ptr)
FMessageBox::info (this, "Info", "You have chosen \"" + text + "\""); FMessageBox::info (this, "Info", "You have chosen \"" + text + "\"");
} }
//----------------------------------------------------------------------
void Menu::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// main part // main part

View File

@ -60,9 +60,6 @@ class Treeview : public FDialog
// Event handlers // Event handlers
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods
void cb_exitApp (FWidget*, data_ptr);
// Data Members // Data Members
FListView* listView; FListView* listView;
FButton* Quit; FButton* Quit;
@ -275,7 +272,7 @@ Treeview::Treeview (FWidget* parent)
Quit->addCallback Quit->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Treeview::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
} }
@ -318,11 +315,6 @@ void Treeview::onClose (FCloseEvent* ev)
ev->ignore(); ev->ignore();
} }
//----------------------------------------------------------------------
void Treeview::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// main part // main part

View File

@ -292,7 +292,6 @@ class MyDialog : public FDialog
void cb_activateButton (FWidget*, data_ptr); void cb_activateButton (FWidget*, data_ptr);
void cb_view (FWidget*, data_ptr); void cb_view (FWidget*, data_ptr);
void cb_setInput (FWidget*, data_ptr); void cb_setInput (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
// Data Members // Data Members
FLineEdit* myLineEdit; FLineEdit* myLineEdit;
@ -377,7 +376,7 @@ MyDialog::MyDialog (FWidget* parent)
Quit->addCallback Quit->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &MyDialog::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
Cut->addCallback Cut->addCallback
@ -596,7 +595,7 @@ MyDialog::MyDialog (FWidget* parent)
MyButton6->addCallback MyButton6->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &MyDialog::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
myLineEdit->addCallback myLineEdit->addCallback
@ -641,7 +640,7 @@ MyDialog::MyDialog (FWidget* parent)
key_F3->addCallback key_F3->addCallback
( (
"activate", "activate",
F_METHOD_CALLBACK (this, &MyDialog::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
} }
@ -918,12 +917,6 @@ void MyDialog::cb_setInput (FWidget* widget, data_ptr data)
lineedit->redraw(); lineedit->redraw();
} }
//----------------------------------------------------------------------
void MyDialog::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// main part // main part

View File

@ -54,7 +54,6 @@ class Watch : public FDialog
// Callback methods // Callback methods
void cb_clock (FWidget*, data_ptr); void cb_clock (FWidget*, data_ptr);
void cb_seconds (FWidget*, data_ptr); void cb_seconds (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
protected: protected:
// Method // Method
@ -125,7 +124,7 @@ Watch::Watch (FWidget* parent)
quit_btn->addCallback quit_btn->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Watch::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
} }
@ -211,12 +210,6 @@ void Watch::cb_seconds (FWidget*, data_ptr)
} }
} }
//----------------------------------------------------------------------
void Watch::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Watch::adjustSize() void Watch::adjustSize()
{ {

View File

@ -214,7 +214,6 @@ class Window : public FDialog
void cb_closeWindows (FWidget*, data_ptr); void cb_closeWindows (FWidget*, data_ptr);
void cb_next (FWidget*, data_ptr); void cb_next (FWidget*, data_ptr);
void cb_previous (FWidget*, data_ptr); void cb_previous (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
void cb_destroyWindow (FWidget*, data_ptr); void cb_destroyWindow (FWidget*, data_ptr);
// Data Members // Data Members
@ -311,7 +310,7 @@ Window::Window (FWidget* parent)
Quit->addCallback Quit->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Window::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
// Add button callback // Add button callback
@ -330,7 +329,7 @@ Window::Window (FWidget* parent)
QuitButton->addCallback QuitButton->addCallback
( (
"clicked", "clicked",
F_METHOD_CALLBACK (this, &Window::cb_exitApp) F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
); );
for (int n = 1; n <= 6; n++) for (int n = 1; n <= 6; n++)
@ -561,12 +560,6 @@ void Window::cb_previous (FWidget*, data_ptr)
while ( iter != dialog_list->begin() ); while ( iter != dialog_list->begin() );
} }
//----------------------------------------------------------------------
void Window::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Window::cb_destroyWindow (FWidget*, data_ptr data) void Window::cb_destroyWindow (FWidget*, data_ptr data)
{ {

View File

@ -107,6 +107,9 @@ class FApplication : public FWidget
static bool removeQueuedEvent (const FObject*); static bool removeQueuedEvent (const FObject*);
static FWidget* showParameterUsage (const int&, char*[]); static FWidget* showParameterUsage (const int&, char*[]);
// Callback method
void cb_exitApp (FWidget*, data_ptr);
private: private:
// Typedefs and Enumerations // Typedefs and Enumerations
typedef std::pair<const FObject*, const FEvent*> eventPair; typedef std::pair<const FObject*, const FEvent*> eventPair;
@ -256,5 +259,9 @@ inline FWidget* FApplication::getMainWidget() const
inline FWidget* FApplication::getFocusWidget() const inline FWidget* FApplication::getFocusWidget() const
{ return focus_widget; } { return focus_widget; }
//----------------------------------------------------------------------
inline void FApplication::cb_exitApp (FWidget*, data_ptr)
{ close(); }
#endif // FAPPLICATION_H #endif // FAPPLICATION_H