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>
* 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>
* FWidget now inherits directly from FObject

View File

@ -85,9 +85,6 @@ class Listbox : public FDialog
// Event handlers
void onClose (FCloseEvent*);
// Callback method
void cb_exitApp (FWidget*, data_ptr);
// Data Member
std::list<double>* double_list;
};
@ -150,7 +147,7 @@ Listbox::Listbox (FWidget* parent)
Quit->addCallback
(
"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();
}
//----------------------------------------------------------------------
void Listbox::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//----------------------------------------------------------------------
// main part

View File

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

View File

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

View File

@ -60,9 +60,6 @@ class Treeview : public FDialog
// Event handlers
void onClose (FCloseEvent*);
// Callback methods
void cb_exitApp (FWidget*, data_ptr);
// Data Members
FListView* listView;
FButton* Quit;
@ -275,7 +272,7 @@ Treeview::Treeview (FWidget* parent)
Quit->addCallback
(
"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();
}
//----------------------------------------------------------------------
void Treeview::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//----------------------------------------------------------------------
// main part

View File

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

View File

@ -54,7 +54,6 @@ class Watch : public FDialog
// Callback methods
void cb_clock (FWidget*, data_ptr);
void cb_seconds (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
protected:
// Method
@ -125,7 +124,7 @@ Watch::Watch (FWidget* parent)
quit_btn->addCallback
(
"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()
{

View File

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

View File

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