The Gnome Chemistry Utils  0.14.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gcugtk::Dialog Class Reference

#include <gcugtk/dialog.h>

Inheritance diagram for gcugtk::Dialog:
gcugtk::UIBuilder gcu::Dialog gcp::DocPropDlg gcp::HPosDlg gcp::NewFileDlg gcp::PrefsDlg gcp::ReactionPropDlg gcp::Tools gcp::ZoomDlg gcr::AtomsDlg gcr::CellDlg gcr::CleavagesDlg gcr::LinesDlg gcr::PrefsDlg gcr::SizeDlg gcr::ViewSettingsDlg gcugtk::PrintSetupDlg gcugtk::StringDlg gcugtk::StringInputDlg

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)
- Public Member Functions inherited from gcugtk::UIBuilder
 UIBuilder (char const *filename, char const *domain) throw (std::runtime_error)
virtual ~UIBuilder ()
GtkWidget * GetWidget (char const *wname)
GtkWidget * GetRefdWidget (char const *wname)
GObject * GetObject (char const *name)
GtkBuilder * GetBuilder (void) const
- Public Member Functions inherited from gcu::Dialog
 Dialog (Application *App, const char *windowname, DialogOwner *owner=NULL) throw (std::runtime_error)
void SetRealName (char const *name, DialogOwner *owner) throw (std::runtime_error)
std::string & GetWindowName ()
ApplicationGetApp (void)

Protected Member Functions

bool GetNumber (GtkEntry *Entry, double *x, CheckType c=NoCheck, double min=0, double max=0)

Protected Attributes

GtkWindow * dialog
- Protected Attributes inherited from gcu::Dialog
Applicationm_App

Detailed Description

This class is base class for dialog boxes. It provides some basic services.

Definition at line 73 of file tk/dialog.h.

Constructor & Destructor Documentation

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)
Parameters
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.

Member Function Documentation

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.
Returns
true if everything worked, false if something when wrong and the dialog should not be closed.

Reimplemented in gcugtk::StringDlg, and gcugtk::StringInputDlg.

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
Parameters
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.

Returns
true if the value is valid, false if something went wrong.
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 ( )
inlinevirtual

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)
Parameters
windowthe parent window.

Make the diaolg box transient for window.

Member Data Documentation

GtkWindow* gcugtk::Dialog::dialog
protected

The associated GtkWindow instance.

Definition at line 161 of file tk/dialog.h.

Referenced by GetWindow(), and Present().


The documentation for this class was generated from the following file: