Add a standardized close confirmation dialog
This commit is contained in:
parent
b0b44582e8
commit
686283cb01
|
@ -1,5 +1,6 @@
|
||||||
2017-10-30 Markus Gans <guru.mail@muenster.de>
|
2017-10-30 Markus Gans <guru.mail@muenster.de>
|
||||||
* Fix scrollview functionality with new inheritance structure
|
* Fix scrollview functionality with new inheritance structure
|
||||||
|
* Add a standardized close confirmation dialog
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -574,13 +574,7 @@ void Calc::onAccel (FAccelEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::onClose (FCloseEvent* ev)
|
void Calc::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit",
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
"Do you really want\n"
|
|
||||||
"to quit the program ?",
|
|
||||||
FMessageBox::Yes,
|
|
||||||
FMessageBox::No );
|
|
||||||
|
|
||||||
( ret == FMessageBox::Yes ) ? ev->accept() : ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -161,15 +161,7 @@ Listbox::~Listbox() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Listbox::onClose (FCloseEvent* ev)
|
void Listbox::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -159,15 +159,7 @@ Listview::~Listview() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Listview::onClose (FCloseEvent* ev)
|
void Listview::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -126,16 +126,7 @@ void Mandelbrot::onAccel (FAccelEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Mandelbrot::onClose (FCloseEvent* ev)
|
void Mandelbrot::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -263,16 +263,7 @@ void Menu::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::onClose (FCloseEvent* ev)
|
void Menu::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -404,16 +404,7 @@ void MouseDraw::onAccel (FAccelEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MouseDraw::onClose (FCloseEvent* ev)
|
void MouseDraw::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -257,16 +257,7 @@ void Scrollviewdemo::cb_quit (FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Scrollviewdemo::onClose (FCloseEvent* ev)
|
void Scrollviewdemo::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,16 +126,7 @@ void AttribDlg::onWheel (FWheelEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void AttribDlg::onClose (FCloseEvent* ev)
|
void AttribDlg::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -251,15 +251,7 @@ void MainWindow::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MainWindow::onClose (FCloseEvent* ev)
|
void MainWindow::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -304,15 +304,7 @@ void Treeview::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Treeview::onClose (FCloseEvent* ev)
|
void Treeview::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -669,15 +669,7 @@ void MyDialog::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::onClose (FCloseEvent* ev)
|
void MyDialog::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -162,15 +162,7 @@ void Watch::onTimer (FTimerEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Watch::onClose (FCloseEvent* ev)
|
void Watch::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
ev->accept();
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -407,18 +407,7 @@ void Window::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Window::onClose (FCloseEvent* ev)
|
void Window::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
int ret = FMessageBox::info ( this, "Quit"
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
, "Do you really want\n"
|
|
||||||
"to quit the program ?"
|
|
||||||
, FMessageBox::Yes
|
|
||||||
, FMessageBox::No );
|
|
||||||
if ( ret == FMessageBox::Yes )
|
|
||||||
{
|
|
||||||
cb_closeWindows(0,0);
|
|
||||||
ev->accept();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -106,6 +106,7 @@ class FApplication : public FWidget
|
||||||
static bool eventInQueue();
|
static bool eventInQueue();
|
||||||
static bool removeQueuedEvent (const FObject*);
|
static bool removeQueuedEvent (const FObject*);
|
||||||
static FWidget* showParameterUsage (const int&, char*[]);
|
static FWidget* showParameterUsage (const int&, char*[]);
|
||||||
|
static void closeConfirmationDialog (FWidget*, FCloseEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_exitApp (FWidget*, data_ptr);
|
void cb_exitApp (FWidget*, data_ptr);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "final/fapplication.h"
|
#include "final/fapplication.h"
|
||||||
#include "final/fmenu.h"
|
#include "final/fmenu.h"
|
||||||
|
#include "final/fmessagebox.h"
|
||||||
#include "final/fstatusbar.h"
|
#include "final/fstatusbar.h"
|
||||||
#include "final/fwindow.h"
|
#include "final/fwindow.h"
|
||||||
|
|
||||||
|
@ -335,6 +336,19 @@ FWidget* FApplication::showParameterUsage (const int& argc, char* argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FApplication::closeConfirmationDialog (FWidget* w, FCloseEvent* ev)
|
||||||
|
{
|
||||||
|
int ret = FMessageBox::info ( w, "Quit"
|
||||||
|
, "Do you really want\n"
|
||||||
|
"to quit the program ?"
|
||||||
|
, FMessageBox::Yes
|
||||||
|
, FMessageBox::No );
|
||||||
|
if ( ret == FMessageBox::Yes )
|
||||||
|
ev->accept();
|
||||||
|
else
|
||||||
|
ev->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
// private methods of FApplication
|
// private methods of FApplication
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue