Inherits sigc::trackable.
|
| Main (int & argc, char **& argv, Glib::OptionContext & option_context) |
| Scans the argument vector, and strips off all parameters parsed by GTK+ or your option_context. More...
|
|
| Main (int * argc, char *** argv, bool set_locale=true) |
| Scans the argument vector, and strips off all parameters known to GTK+. More...
|
|
| Main (int & argc, char **& argv, bool set_locale=true) |
| Scans the argument vector, and strips off all parameters known to GTK+. More...
|
|
| Main (bool set_locale=true) |
| Initialization without command-line arguments. More...
|
|
virtual | ~Main () |
|
|
static Gtk::Main * | instance () |
| Access to the one global instance of Gtk::Main. More...
|
|
static void | run () |
| Start the event loop. More...
|
|
static void | run (Window & window) |
| Returns from the main loop when the window is closed. More...
|
|
static void | quit () |
| Makes the innermost invocation of the main loop return when it regains control. More...
|
|
static guint | level () |
|
static void | add_gtk_option_group (Glib::OptionContext & option_context, bool open_default_display=true) |
| Add a Glib::OptionGroup, for the commandline arguments recognized by GTK+ and GDK, to a Glib::OptionContext, so that these commandline arguments will be processed in addition to the existing commandline arguments specified by the Glib::OptionContext. More...
|
|
static bool | iteration (bool blocking=true) |
| Runs a single iteration of the main loop. More...
|
|
static bool | events_pending () |
| Checks if any events are pending. More...
|
|
static KeySnooperSig & | signal_key_snooper () |
| KeySnooper signal Allows you to channel keypresses to a signal handler without registering with the widget. More...
|
|
static void | init_gtkmm_internals () |
| Initialize the table of wrap_new functions. More...
|
|
Main application class.
Every application must have one of these objects. It may not be global and must be the first gtkmm object created. It is a singleton so declaring more than one will simply access the first created.
You would normally use this class in your main() function to initialize gtkmm and optionally to give argc and argv to the GTK+ initialization. After calling Gtk::Main::run(), you may use Gtk::Main::quit() to exit from the application, or just pass your main window to run(), to make run() return when that window closes.
A minimal gtkmm application would be something like this:
int main(int argc, char *argv[])
{
... create some widgets and windows...
kit.run(window);
}
Main application class.
Definition: main.h:96
- Deprecated:
- Use Gtk::Application instead.
Gtk::Main::Main |
( |
int & |
argc, |
|
|
char **& |
argv, |
|
|
Glib::OptionContext & |
option_context |
|
) |
| |
Scans the argument vector, and strips off all parameters parsed by GTK+ or your option_context.
Add a Glib::OptionGroup to the Glib::OptionContext to parse your own command-line arguments.
Note: The argument strings themself won't be modified, although the pointers to them might change. This makes it possible to create your own argv of string literals, which have the type 'const char[]' in standard C++. (You might need to use const_cast<>, though.)
This function automatically generates nicely formatted –help
output. Note that your program will be terminated after writing out the help output.
- Parameters
-
argc | a reference to the number of command line arguments. |
argv | a reference to the array of command line arguments. |
option_context | A Glib::OptionContext containing Glib::OptionGroups which described the command-line arguments taken by your program. |
- Exceptions
-
- Deprecated:
- Use Gtk::Application instead.
Gtk::Main::Main |
( |
int * |
argc, |
|
|
char *** |
argv, |
|
|
bool |
set_locale = true |
|
) |
| |
Scans the argument vector, and strips off all parameters known to GTK+.
Your application may then handle the remaining arguments.
Note: The argument strings themself won't be modified, although the pointers to them might change. This makes it possible to create your own argv of string literals, which have the type 'const char[]' in standard C++. (You might need to use const_cast<>, though.)
- Parameters
-
argc | a pointer to the number of command line arguments. |
argv | a pointer to the array of command line arguments. |
set_locale | Passing false prevents GTK+ from automatically calling setlocale(LC_ALL, ""). You would want to pass false if you wanted to set the locale for your program to something other than the user's locale, or if you wanted to set different values for different locale categories. |
- Deprecated:
- Use Gtk::Application instead.
static void Gtk::Main::add_gtk_option_group |
( |
Glib::OptionContext & |
option_context, |
|
|
bool |
open_default_display = true |
|
) |
| |
|
static |
Add a Glib::OptionGroup, for the commandline arguments recognized by GTK+ and GDK, to a Glib::OptionContext, so that these commandline arguments will be processed in addition to the existing commandline arguments specified by the Glib::OptionContext.
You do not need to use this method if you pass your Glib::OptionContext to the Main constructor, because it adds the gtk option group automatically.
- Parameters
-
option_context | Option Context to which the group will be added. |
open_default_display | Whether to open the default display when parsing the commandline arguments. |
- Deprecated:
- Use Gtk::Application instead.