Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List

main.hh File Reference

Initialization and main processing loop interface. More...

#include <xfc/pointer.hh>
#include <xfc/gdk/types.hh>
#include <sigc++/sigc++.h>
#include <gtk/gtkmain.h>
#include <vector>





Main Event Loop



Detailed Description

Initialization and main processing loop interface.

XFC wraps the GTK+ initialization functions and events into the Main namespace rather than a static class. Before using XFC, you need to initialize it. Initialization connects to the window system display, and parses some standard command line arguments. The init() function initializes XFC. init() exits the application if errors occur; to avoid this, use init_check(). init_check() allows you to recover from a failed XFC initialization - you might start up your application in text mode instead.

Like all GUI toolkits, XFC uses an event-driven programming model. When the user is doing nothing, XFC sits in the main loop and waits for input. If the user performs some action - say, a mouse click - then the main loop "wakes up" and delivers an event to XFC. XFC forwards the event to one or more widgets.

When widgets receive an event, they frequently emit one or more signals. Signals notify your program that "something interesting happened" by invoking slots you've connected to the signal with the signal's connect() method. Slots are callable objects that can be connected to signals. Slots can be used to connect static functions, class methods and function objects to a signal. When your slot is called it invokes your function or method.

When your methods are invoked, you would typically take some action - for example, when an Open button is clicked you might display a Gtk::FileSelectionDialog. After a callback finishes, XFC will return to the main loop and await more user input. Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team XFC 4.3