Framework for a manager of a command menu and dialog windows. More...
#include <GenericPluginUI.h>
Classes | |
| class | DialogEventCallbackMethod |
| An instance of this class can be used as a GenericPluginUI::DialogEventCallback, in situations where the callback is a method to be invoked on a target object. More... | |
| class | DialogSignalCallbackMethod |
| An instance of this class can be used as a GenericPluginUI::DialogSignalCallback, in situations where the callback is a method to be invoked on a target object. More... | |
Public Types | |
| typedef Callback3< GtkWidget *, GdkEvent *, gpointer, gint > | DialogEventCallback |
| Type for GTK+ event callbacks. | |
| typedef Callback2< GtkWidget *, gpointer, void > | DialogSignalCallback |
| Type for GTK+ signal callbacks. | |
Public Member Functions | |
Setup | |
| void | RegisterMainMenu (SmartPointer< GenericMainMenu > &mainMenu) |
| Register the command menu. | |
| void | RegisterDialog (SmartPointer< GenericDialog > &dialog) |
| Register a dialog window. | |
| void | SetWindow (GtkWidget *window) |
| Specify the main application window. | |
Lookup | |
| GenericMainMenu * | MainMenu () |
| Get the command menu. | |
| GenericDialog * | Dialog (const std::string &key) |
| Get the dialog identified by the specified key. | |
Widget dependence | |
| void | RegisterWidgetDependence (GtkWidget *controller, GtkWidget *controllee) |
| Declare that the controllee widget should be active only when the controller widget is active. | |
| void | RegisterWidgetAntiDependence (GtkWidget *controller, GtkWidget *controllee) |
| Declare that the controllee widget should be active only when the controller widget is inactive. | |
| void | WidgetControlCallback (GtkWidget *widget, gpointer callbackID) |
| Manage the state of controllee widgets when a controller widget is clicked. | |
Static Public Member Functions | |
Message popups | |
| static void | ErrorReportDialog (const char *title, const char *message) |
| Generate an error dialog. | |
| static void | WarningReportDialog (const char *title, const char *message) |
| Generate a warning dialog. | |
| static void | InfoReportDialog (const char *title, const char *message) |
| Generate an info dialog. | |
Protected Member Functions | |
Lifecycle | |
| GenericPluginUI () | |
| Default constructor. | |
| virtual | ~GenericPluginUI () |
| Virtual destructor. | |
Private Types | |
|
typedef std::map< std::string, SmartPointer< GenericDialog > > | DialogMap |
| Type for a map between string and reference-counted dialog window. | |
|
typedef std::map< gpointer, DialogEventCallback > | DialogEventCallbackMap |
| Type for a map between gpointer (for callback ID) and event callback. | |
|
typedef std::map< gpointer, DialogSignalCallback > | DialogSignalCallbackMap |
| Type for a map between gpointer (for callback ID) and signal callback. | |
|
typedef std::map< GtkWidget *, std::vector< GtkWidget * > > | WidgetDependenceMap |
| Type for a map between a widget and a vector of widgets. | |
Private Member Functions | |
Unimplemented to prevent copy/assignment | |
| GenericPluginUI (const GenericPluginUI &) | |
| const GenericPluginUI & | operator= (const GenericPluginUI &) |
Private Attributes | |
| GtkWidget * | _window |
| The parent window. | |
| SmartPointer< GenericMainMenu > * | _mainMenu |
| Reference-counted handle on the main menu object. | |
| unsigned | _callbackID |
| Next ID to use when registering an event or signal callback. | |
|
const DialogSignalCallbackMethod < GenericPluginUI,&GenericPluginUI::WidgetControlCallback > | _widgetControlCallback |
| Callback to implement widget-active dependences. | |
| DialogMap | _dialogMap |
| Associations between keys and dialog windows. | |
| DialogEventCallbackMap | _dialogEventCallbackMap |
| Associations between callback IDs and event callbacks. | |
| DialogSignalCallbackMap | _dialogSignalCallbackMap |
| Associations between callback IDs and signal callbacks. | |
| WidgetDependenceMap | _widgetControlMap |
| Associations between controller and controllee widgets for all dependences and anti-dependences. | |
| WidgetDependenceMap | _widgetControlledByMap |
| Associations between controller and controllee widgets for dependences only. | |
| WidgetDependenceMap | _widgetAntiControlledByMap |
| Associations between controller and controllee widgets for anti- dependences only. | |
Related Functions | |
(Note that these are not member functions.) | |
| GenericPluginUI & | UIInstance () |
| Get the singleton instance of the UI manager. | |
Event/signal dispatch | |
| gpointer | RegisterDialogEventCallback (GtkWidget *widget, const gchar *name, const DialogEventCallback &callback) |
| Register a function to be invoked when a widget generates an event. | |
| gpointer | RegisterDialogSignalCallback (GtkWidget *widget, const gchar *name, const DialogSignalCallback &callback) |
| Register a function to be invoked when a widget generates a signal. | |
| static gint | DialogEventCallbackDispatch (GtkWidget *widget, GdkEvent *event, gpointer data) |
| Generic event callback used to invoke the specific callback functions registered with this manager. | |
| static void | DialogSignalCallbackDispatch (GtkWidget *widget, gpointer data) |
| Generic signal callback used to invoke the specific callback functions registered with this manager. | |
Framework for a manager of a command menu and dialog windows.
It is responsible for:
A subclass should handle the creation and registration of the UI objects.
| typedef Callback3<GtkWidget *, GdkEvent *, gpointer, gint> GenericPluginUI::DialogEventCallback |
Type for GTK+ event callbacks.
The callback takes a GtkWidget* argument (widget generating the event), a GdkEvent* argument (the event), and a gpointer argument (the callback ID); it returns gint (success as TRUE or FALSE).
| typedef Callback2<GtkWidget *, gpointer, void> GenericPluginUI::DialogSignalCallback |
Type for GTK+ signal callbacks.
The callback takes a GtkWidget* argument (widget generating the signal) and a gpointer argument (the callback data); it has no return value.
|
protected |
Default constructor.
Initialize object state; the initial callback ID to use is 1 because 0 is reserved for "invalid". Note that as this is a protected method, GenericPluginUI objects cannot be created directly; only subclasses of GenericPluginUI can be created.
|
protectedvirtual |
Virtual destructor.
Remove references to UI elements (which should trigger garbage collection).
| GenericDialog * GenericPluginUI::Dialog | ( | const std::string & | key | ) |
Get the dialog identified by the specified key.
| key | The key. |
|
static |
Generic event callback used to invoke the specific callback functions registered with this manager.
Those specific callbacks are not themselves registered directly with GTK+ because they may be methods that must be invoked on objects. (Unlike this function, which is a static method.)
| widget | The widget generating the event. |
| event | The event. |
| data | ID of the specific callback registered with this manager. |
|
static |
Generic signal callback used to invoke the specific callback functions registered with this manager.
Those specific callbacks are not themselves registered directly with GTK+ because they may be methods that must be invoked on objects. (Unlike this function, which is a static method.)
| widget | The widget generating the signal. |
| data | ID of the specific callback registered with this manager. |
|
static |
Generate an error dialog.
| title | The dialog title. |
| message | The error message. |
|
static |
Generate an info dialog.
| title | The dialog title. |
| message | The info message. |
| GenericMainMenu * GenericPluginUI::MainMenu | ( | ) |
Get the command menu.
| void GenericPluginUI::RegisterDialog | ( | SmartPointer< GenericDialog > & | dialog | ) |
Register a dialog window.
| dialog | The dialog. |
| gpointer GenericPluginUI::RegisterDialogEventCallback | ( | GtkWidget * | widget, |
| const gchar * | name, | ||
| const DialogEventCallback & | callback | ||
| ) |
Register a function to be invoked when a widget generates an event.
| widget | The widget generating the event. |
| name | The name of the event. |
| callback | The callback function. |
| gpointer GenericPluginUI::RegisterDialogSignalCallback | ( | GtkWidget * | widget, |
| const gchar * | name, | ||
| const DialogSignalCallback & | callback | ||
| ) |
Register a function to be invoked when a widget generates a signal.
| widget | The widget generating the signal. |
| name | The name of the signal. |
| callback | The callback function. |
| void GenericPluginUI::RegisterMainMenu | ( | SmartPointer< GenericMainMenu > & | mainMenu | ) |
Register the command menu.
| mainMenu | The command menu. |
| void GenericPluginUI::RegisterWidgetAntiDependence | ( | GtkWidget * | controller, |
| GtkWidget * | controllee | ||
| ) |
Declare that the controllee widget should be active only when the controller widget is inactive.
| controller | The controller widget. |
| controllee | The controllee widget. |
| void GenericPluginUI::RegisterWidgetDependence | ( | GtkWidget * | controller, |
| GtkWidget * | controllee | ||
| ) |
Declare that the controllee widget should be active only when the controller widget is active.
| controller | The controller widget. |
| controllee | The controllee widget. |
| void GenericPluginUI::SetWindow | ( | GtkWidget * | window | ) |
Specify the main application window.
| window | The main window. |
|
static |
Generate a warning dialog.
| title | The dialog title. |
| message | The warning message. |
| void GenericPluginUI::WidgetControlCallback | ( | GtkWidget * | widget, |
| gpointer | callbackID | ||
| ) |
Manage the state of controllee widgets when a controller widget is clicked.
| widget | The controller widget. |
| callbackID | Unique numerical ID for the callback. |
|
related |
Get the singleton instance of the UI manager.
|
private |
Next ID to use when registering an event or signal callback.
Starts at 1; 0 is reserved to mean invalid.