GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

The initialization, main event loop and event namespace. More...

Classes

Initializers

Accessors

Main Event Loop

Signals


Detailed Description

The initialization, main event loop and event namespace.

Provides a set of methods and signals for handling program initialization and custom event loop processing.


Function Documentation

PangoLanguage* default_language  ) 
 

Get the default language currently in effect.

Returns:
The ISO language code for the default language currently in effect.

Note that this can change over the life of an application. The default language is derived from the current locale. It determines, for example, whether GFC uses the right-to-left or left-to-right text direction.

bool events_pending  ) 
 

Checks if any events are pending.

Returns:
true if any events are pending, false otherwise.

This can be used to update the GUI and invoke timeouts etc. while doing some time intensive computation.

Example: Updating the GUI during a long computation.

     // computation going on
     ...
     while (events_pending())
        iterate();
     ...
     // computation continued

Pointer<Gdk::Event> get_current_event  ) 
 

Obtains a copy of the event currently being processed by GTK+.

Returns:
A copy of the current event, or null if there is no current event.

For example, if you get a "clicked" signal from Gtk::Button, the current event will be the Gdk::EventButton that triggered the "clicked" signal. If there is no current event, the function returns null.

bool get_current_event_state Gdk::ModifierTypeField state  ) 
 

If there is a current event and it has a state field, place that state field in state and return true, otherwise return false.

Parameters:
state The location to store the state of the current event.
Returns:
true if there was a current event and it had a state field.

unsigned int get_current_event_time  ) 
 

If there is a current event and it has a timestamp, return that timestamp, otherwise return GDK_CURRENT_TIME.

Returns:
The timestamp from the current event, or GDK_CURRENT_TIME.

Pointer<Gtk::Widget> get_event_widget Gdk::Event &  event  ) 
 

Get the widget that originally received the event.

Parameters:
event A reference to a Gdk::Event.
Returns:
The widget that originally received event, or null.

If event is null or the event was not associated with any widget, returns null, otherwise returns the widget that received the event originally. The widget is returned as a smart pointer because there is the possiblity that the widget was wrapped for the first time and needs to be unreferenced.

void grab_add Gtk::Widget &  widget  ) 
 

Makes widget the current grabbed widget.

Parameters:
widget The widget that grabs keyboard and pointer events.

This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget.

Pointer<Gtk::Widget> grab_get_current  ) 
 

Queries the current grab.

Returns:
The widget which currently has the grab or null if no grab is active.

void grab_remove Gtk::Widget &  widget  ) 
 

Removes the grab from the given widget.

Parameters:
widget The widget which gives up the grab. You have to pair calls to grab_add() and grab_remove().

void init int *  argc,
char ***  argv
 

Initialize the GFC library.

Parameters:
argc Address of the argc parameter of your main function. Changed if any arguments were handled.
argv Address of the argv parameter of main(). Any parameters understood by init() are stripped before returning.

Call this method before using any other GFC methods in your GUI applications. It will initialize everything needed to operate the toolkit and parses some standard command line options. argc and argv are adjusted accordingly so your own code will never see those standard arguments.

void init_add const sigc::slot< bool > &  callback  ) 
 

Register a slot to be called when the mainloop is started.

Parameters:
callback A slot to invoke when main() is called next.

The callback slot should return false to remove it from the list of slots to call, otherwise it might get called again.

bool init_check int *  argc,
char ***  argv
 

Initialize the GFC library.

Parameters:
argc A reference to the argc of the main() function.
argv A reference to the argv of the main() function.
Returns:
true if the GUI has been successfully initialized, false otherwise.

This method does the same work as init() with only a single change: It does not terminate the program if the GUI can't be initialized. Instead it returns false on failure. This way the application can fall back to some other means of communication with the user - for example a command line interface.

bool iterate bool  blocking = true  ) 
 

Runs a single iteration of the mainloop.

Parameters:
blocking Set true if you want to block if no events are pending.
Returns:
true if quit() has been called for the innermost mainloop.

If blocking is true and no events are waiting to be processed GFC will block until the next event is noticed. If blocking is false and no events are available return.

int level  ) 
 

Asks for the current nesting level of the main loop.

Returns:
The nesting level of the current invocation of the main loop.

This can be useful when connecting a slot to the quit_signal.

void run  ) 
 

Runs the main loop until quit() is called.

You can nest calls to run(). In that case quit() will make the innermost invocation of the main loop return.


Generated on Tue Aug 24 00:34:45 2004 for GFC-UI by doxygen 1.3.8