The Gnome Chemistry Utils
0.13.6
|
#include <gcugtk/dialog.h>
Public Member Functions | |
Dialog (Application *App, char const *filename, const char *windowname, char const *domainname, gcu::DialogOwner *owner=NULL, void(*extra_destroy)(gpointer)=NULL, gpointer data=NULL) throw (std::runtime_error) | |
virtual | ~Dialog () |
virtual void | Destroy () |
virtual bool | Apply () |
virtual void | Closed () |
GtkWindow * | GetWindow () |
void | Present () |
void | SetTransientFor (GtkWindow *window) |
Protected Member Functions | |
bool | GetNumber (GtkEntry *Entry, double *x, CheckType c=NoCheck, double min=0, double max=0) |
Protected Attributes | |
GtkWindow * | dialog |
This class is base class for dialog boxes. It provides some basic services.
Definition at line 73 of file tk/dialog.h.
gcugtk::Dialog::Dialog | ( | Application * | App, |
char const * | filename, | ||
const char * | windowname, | ||
char const * | domainname, | ||
gcu::DialogOwner * | owner = NULL , |
||
void(*)(gpointer) | extra_destroy = NULL , |
||
gpointer | data = NULL |
||
) | throw (std::runtime_error) |
App,: | the Application which owns the dialog. |
filename,: | the name of the ui file which contains the description of the dialog. |
windowname,: | the name of the top level GtkWidget of the dialog box in the glade file. This name should be unique for the application. It is used to access the contextual help and to ensure the uniqueness of the dialog (in some cases). |
domainname,: | the translation domain. |
owner,: | the address of an owner object, might be App or a document or NULL (the default). when owner is not NULL, the dialog will be unique for it. |
extra_destroy,: | a callback to be called when the dialog is detroyed by calling Dialog::Destroy. Useful to perform non standard cleaning operations before calling gtk_widget_destroy. The destructor being called afterwards, it cannot access the widget. |
data,: | the data to be passed to extra_destroy. |
If the ui file declares buttons with names "OK", "apply", "cancel" and "help", default actions will be associated with these buttons. If the Application does not provide help support, the Help button will be hidden.
virtual gcugtk::Dialog::~Dialog | ( | ) | [virtual] |
The destructor.
Reimplemented from gcu::Dialog.
virtual bool gcugtk::Dialog::Apply | ( | ) | [virtual] |
Called after a click on the OK or Apply buttons. After clicking the OK button and if the method returns true, Destroy will be called to close the dialog box. A derived class should implement this method, as the default just returns true.
Reimplemented in gcugtk::StringDlg, gcugtk::StringInputDlg, and gcp::NewFileDlg.
virtual void gcugtk::Dialog::Closed | ( | ) | [virtual] |
Called when the dialog closes. Default does nothing.
virtual void gcugtk::Dialog::Destroy | ( | ) | [virtual] |
Called when closing the dialog box after a click on the OK or Cancel buttons. If a child class implements this method, it should call Dialog::Destroy after performing its task or it must destroy the window. The defaut implementation calls extra_destroy and gtk_widget_destroy.
Implements gcu::Dialog.
bool gcugtk::Dialog::GetNumber | ( | GtkEntry * | Entry, |
double * | x, | ||
CheckType | c = NoCheck , |
||
double | min = 0 , |
||
double | max = 0 |
||
) | [protected] |
Entry,: | the GtkEntry from which the number should be retrieved. |
x,: | a pointer to the value which will be replaced by the result. |
c,: | the type of check to perform on the value. |
min,: | the minimum accepted value, if needed. |
max,: | the maximum accepted value, if needed. |
This method retrieves the text displayed in Entry, converts it to a number and perform bounds tests if needed. If an error occurs, a message box is displayed which let the user know why the value is not correct.
GtkWindow* gcugtk::Dialog::GetWindow | ( | void | ) | [inline] |
/return the top level window of the dialog box.
Definition at line 128 of file tk/dialog.h.
References dialog.
void gcugtk::Dialog::Present | ( | ) | [inline, virtual] |
Brings the dialog to top of the windows stack.
Implements gcu::Dialog.
Definition at line 133 of file tk/dialog.h.
References dialog.
void gcugtk::Dialog::SetTransientFor | ( | GtkWindow * | window | ) |
window | the parent window. |
Make the diaolg box transient for window.
GtkWindow* gcugtk::Dialog::dialog [protected] |
The associated GtkWindow instance.
Definition at line 161 of file tk/dialog.h.
Referenced by GetWindow(), and Present().