MeshTex  3.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
GenericDialog Class Reference

Framework for a basic dialog window with OK/Apply/Cancel actions. More...

#include <GenericDialog.h>

Inheritance diagram for GenericDialog:
RefCounted GeneralFunctionDialog GetInfoDialog SetScaleDialog

List of all members.

Public Member Functions

Interrogation
const std::string & GetKey () const
 Get the unique key that identifies this dialog widget.
Window management
virtual void SetWindow (GtkWidget *window)
 Mark this window widget as a modal dialog for a parent window.
virtual void Raise ()
 Raise this dialog window to the top of the window stack.
virtual void Show (const std::string &triggerCommand)
 Make this dialog window visible and foreground.
virtual void Hide ()
 Hide this dialog window.
Callback implementation
virtual bool Apply ()
 Default handler for Apply logic.
virtual gint CloseEventCallback (GtkWidget *widget, GdkEvent *event, gpointer callbackID)
 Callback for window-close event.
virtual void FinalizeCallback (GtkWidget *widget, gpointer callbackID)
 Callback for clicking on OK/Apply/Cancel button.
Callback creation
void CreateWindowCloseCallback ()
 Register the callback for the close-window event.
void CreateOkButtonCallback (GtkWidget *button)
 Register the callback for the OK button.
void CreateApplyButtonCallback (GtkWidget *button)
 Register the callback for the Apply button.
void CreateCancelButtonCallback (GtkWidget *button)
 Register the callback for the Cancel button.
- Public Member Functions inherited from RefCounted
 RefCounted ()
 Default constructor.
virtual ~RefCounted ()
 Virtual destructor.
void IncRef ()
 Increment reference count.
void DecRef ()
 Decrement reference count, and self-delete if count is <= 0.

Protected Member Functions

Lifecycle
 GenericDialog (const std::string &key)
 Constructor.
virtual ~GenericDialog ()
 Virtual destructor.

Protected Attributes

GtkWidget * _dialog
 This dialog widget.
GtkWidget * _window
 Parent window.
const std::string _key
 Unique key for this dialog.
std::string _triggerCommand
 Command token that most recently summoned this dialog.
gpointer _okCallbackID
 Callback ID associated with an OK button; 0 if none.
gpointer _applyCallbackID
 Callback ID associated with an Apply button; 0 if none.
gpointer _cancelCallbackID
 Callback ID associated with a Cancel button; 0 if none.

Private Member Functions

Unimplemented to prevent copy/assignment
 GenericDialog (const GenericDialog &)
const GenericDialogoperator= (const GenericDialog &)

Detailed Description

Framework for a basic dialog window with OK/Apply/Cancel actions.

A subclass should handle decorating/customizing the window, populating it with contained widgets, customizing the Apply logic, and registering the appropriate OK/Apply/Cancel buttons.


Constructor & Destructor Documentation

GenericDialog::GenericDialog ( const std::string &  key)
protected

Constructor.

Create the GTK+ widget for the dialog window (not visible yet). Initialize callback IDs to zero (invalid). Note that as this is a protected method, GenericDialog objects cannot be created directly; only subclasses of GenericDialog can be created.

Parameters:
keyUnique key to identify this dialog widget.
GenericDialog::~GenericDialog ( )
protectedvirtual

Virtual destructor.

Destroy the GTK+ dialog widget (and therefore its contained widgets) if necessary.


Member Function Documentation

bool GenericDialog::Apply ( )
virtual

Default handler for Apply logic.

This method should be overriden by subclass implementations that need to execute some logic when OK or Apply is clicked. The return value should be the success of that logic. A successful OK will cause the window to be hidden.

Returns:
true if the apply logic executed; always the case in this skeleton implementation.

Reimplemented in SetScaleDialog, GeneralFunctionDialog, and GetInfoDialog.

gint GenericDialog::CloseEventCallback ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  callbackID 
)
virtual

Callback for window-close event.

Parameters:
widgetThis dialog window widget.
eventThe event that instigated the callback.
callbackIDUnique numerical ID for the callback.
Returns:
TRUE as defined by glib.
void GenericDialog::CreateApplyButtonCallback ( GtkWidget *  button)

Register the callback for the Apply button.

Parameters:
buttonThe Apply button widget.
void GenericDialog::CreateCancelButtonCallback ( GtkWidget *  button)

Register the callback for the Cancel button.

Parameters:
buttonThe Cancel button widget.
void GenericDialog::CreateOkButtonCallback ( GtkWidget *  button)

Register the callback for the OK button.

Parameters:
buttonThe OK button widget.
void GenericDialog::FinalizeCallback ( GtkWidget *  widget,
gpointer  callbackID 
)
virtual

Callback for clicking on OK/Apply/Cancel button.

Parameters:
widgetThis dialog window widget.
callbackIDUnique numerical ID for the callback.
const std::string & GenericDialog::GetKey ( ) const

Get the unique key that identifies this dialog widget.

Returns:
The key.
void GenericDialog::SetWindow ( GtkWidget *  window)
virtual

Mark this window widget as a modal dialog for a parent window.

Parameters:
windowThe parent window.
void GenericDialog::Show ( const std::string &  triggerCommand)
virtual

Make this dialog window visible and foreground.

Parameters:
triggerCommandThe command token that summoned the dialog.

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