Top |
#define | GTK_PRIORITY_REDRAW |
#define | GTK_PRIORITY_RESIZE |
#define | GTK_PRIORITY_HIGH |
#define | GTK_PRIORITY_INTERNAL |
#define | GTK_PRIORITY_DEFAULT |
#define | GTK_PRIORITY_LOW |
gchar *
gtk_set_locale (void
);
gtk_set_locale
has been deprecated since version 2.24 and should not be used in newly-written code.
Use setlocale()
directly
Initializes internationalization support for GTK+. gtk_init()
automatically does this, so there is typically no point
in calling this function.
If you are calling this function because you changed the locale after GTK+ is was initialized, then calling this function may help a bit. (Note, however, that changing the locale after GTK+ is initialized may produce inconsistent results and is not really supported.)
In detail - sets the current locale according to the
program environment. This is the same as calling the C library function
setlocale (LC_ALL, "")
but also takes care of the
locale specific setup of the windowing system used by GDK.
a string corresponding to the locale set, typically in the
form lang_COUNTRY, where lang is an ISO-639 language code, and
COUNTRY is an ISO-3166 country code. On Unix, this form matches the
result of the setlocale()
; it is also used on other machines, such as
Windows, where the C library returns a different result. The string is
owned by GTK+ and should not be modified or freed.
void
gtk_disable_setlocale (void
);
Prevents gtk_init()
, gtk_init_check()
, gtk_init_with_args()
and
gtk_parse_args()
from automatically
calling setlocale (LC_ALL, "")
. You would
want to use this function 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.
Most programs should not need to call this function.
PangoLanguage *
gtk_get_default_language (void
);
Returns the PangoLanguage 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 GTK+ uses the right-to-left or left-to-right text direction.
This function is equivalent to pango_language_get_default()
. See
that function for details.
gboolean gtk_parse_args (int *argc
,char ***argv
);
Parses command line arguments, and initializes global
attributes of GTK+, but does not actually open a connection
to a display. (See gdk_display_open()
, gdk_get_display_arg_name()
)
Any arguments used by GTK+ or GDK are removed from the array and
argc
and argv
are updated accordingly.
There is no need to call this function explicitely if you are using
gtk_init()
, or gtk_init_check()
.
void gtk_init (int *argc
,char ***argv
);
Call this function before using any other GTK+ functions 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.
Note that there are some alternative ways to initialize GTK+:
if you are calling gtk_parse_args()
, gtk_init_check()
,
gtk_init_with_args()
or g_option_context_parse()
with
the option group returned by gtk_get_option_group()
,
you don't have to call gtk_init()
.
This function will terminate your program if it was unable to
initialize the windowing system for some reason. If you want
your program to fall back to a textual interface you want to
call gtk_init_check()
instead.
Since 2.18, GTK+ calls signal (SIGPIPE, SIG_IGN)
during initialization, to ignore SIGPIPE signals, since these are
almost never wanted in graphical applications. If you do need to
handle SIGPIPE for some reason, reset the handler after gtk_init()
,
but notice that other libraries (e.g. libdbus or gvfs) might do
similar things.
gboolean gtk_init_check (int *argc
,char ***argv
);
This function does the same work as gtk_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 curses or command line interface.
argc |
Address of the |
[inout] |
argv |
Address of the |
[array length=argc][inout][allow-none] |
gboolean gtk_init_with_args (int *argc
,char ***argv
,const char *parameter_string
,GOptionEntry *entries
,const char *translation_domain
,GError **error
);
This function does the same work as gtk_init_check()
.
Additionally, it allows you to add your own commandline options,
and it automatically generates nicely formatted
--help
output. Note that your program will
be terminated after writing out the help output.
argc |
a pointer to the number of command line arguments. |
|
argv |
a pointer to the array of command line arguments. |
[inout][array length=argc] |
parameter_string |
a string which is displayed in
the first line of |
|
entries |
a |
[array zero-terminated=1] |
translation_domain |
a translation domain to use for translating
the |
|
error |
a return location for errors |
Since: 2.6
GOptionGroup *
gtk_get_option_group (gboolean open_default_display
);
Returns a GOptionGroup for the commandline arguments recognized
by GTK+ and GDK. You should add this group to your GOptionContext
with g_option_context_add_group()
, if you are using
g_option_context_parse()
to parse your commandline arguments.
open_default_display |
whether to open the default display when parsing the commandline arguments |
Since: 2.6
void
gtk_exit (gint error_code
);
gtk_exit
is deprecated and should not be used in newly-written code.
GtkWidget *
gtk_grab_get_current (void
);
Queries the current grab of the default window group.
void gtk_init_add (GtkFunction function
,gpointer data
);
gtk_init_add
is deprecated and should not be used in newly-written code.
void gtk_quit_add_destroy (guint main_level
,GtkObject *object
);
gtk_quit_add_destroy
is deprecated and should not be used in newly-written code.
guint gtk_quit_add (guint main_level
,GtkFunction function
,gpointer data
);
gtk_quit_add
is deprecated and should not be used in newly-written code.
guint gtk_quit_add_full (guint main_level
,GtkFunction function
,GtkCallbackMarshal marshal
,gpointer data
,GDestroyNotify destroy
);
gtk_quit_add_full
is deprecated and should not be used in newly-written code.
void
gtk_quit_remove (guint quit_handler_id
);
gtk_quit_remove
is deprecated and should not be used in newly-written code.
void
gtk_quit_remove_by_data (gpointer data
);
gtk_quit_remove_by_data
is deprecated and should not be used in newly-written code.
guint gtk_timeout_add_full (guint32 interval
,GtkFunction function
,GtkCallbackMarshal marshal
,gpointer data
,GDestroyNotify destroy
);
gtk_timeout_add_full
is deprecated and should not be used in newly-written code.
guint gtk_timeout_add (guint32 interval
,GtkFunction function
,gpointer data
);
gtk_timeout_add
is deprecated and should not be used in newly-written code.
void
gtk_timeout_remove (guint timeout_handler_id
);
gtk_timeout_remove
is deprecated and should not be used in newly-written code.
guint gtk_idle_add (GtkFunction function
,gpointer data
);
gtk_idle_add
is deprecated and should not be used in newly-written code.
guint gtk_idle_add_priority (gint priority
,GtkFunction function
,gpointer data
);
gtk_idle_add_priority
is deprecated and should not be used in newly-written code.
guint gtk_idle_add_full (gint priority
,GtkFunction function
,GtkCallbackMarshal marshal
,gpointer data
,GDestroyNotify destroy
);
gtk_idle_add_full
is deprecated and should not be used in newly-written code.
void
gtk_idle_remove (guint idle_handler_id
);
gtk_idle_remove
is deprecated and should not be used in newly-written code.
void
gtk_idle_remove_by_data (gpointer data
);
gtk_idle_remove_by_data
is deprecated and should not be used in newly-written code.
guint gtk_input_add_full (gint source
,GdkInputCondition condition
,GdkInputFunction function
,GtkCallbackMarshal marshal
,gpointer data
,GDestroyNotify destroy
);
gtk_input_add_full
is deprecated and should not be used in newly-written code.
void
gtk_input_remove (guint input_handler_id
);
gtk_input_remove
is deprecated and should not be used in newly-written code.
guint gtk_key_snooper_install (GtkKeySnoopFunc snooper
,gpointer func_data
);
gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget
,GdkEventKey *event
,gpointer func_data
);
GdkEvent *
gtk_get_current_event (void
);
Obtains a copy of the event currently being processed by GTK+. For
example, if you get a "clicked" signal from GtkButton, the current
event will be the GdkEventButton that triggered the "clicked"
signal. The returned event must be freed with gdk_event_free()
.
If there is no current event, the function returns NULL
.
guint32
gtk_get_current_event_time (void
);
If there is a current event and it has a timestamp, return that
timestamp, otherwise return GDK_CURRENT_TIME
.
gboolean
gtk_get_current_event_state (GdkModifierType *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
.
GtkWidget *
gtk_get_event_widget (GdkEvent *event
);
If event
is NULL
or the event was not associated with any widget,
returns NULL
, otherwise returns the widget that received the event
originally.
void gtk_propagate_event (GtkWidget *widget
,GdkEvent *event
);
Sends an event to a widget, propagating the event to parent widgets
if the event remains unhandled. Events received by GTK+ from GDK
normally begin in gtk_main_do_event()
. Depending on the type of
event, existence of modal dialogs, grabs, etc., the event may be
propagated; if so, this function is used. gtk_propagate_event()
calls gtk_widget_event()
on each widget it decides to send the
event to. So gtk_widget_event()
is the lowest-level function; it
simply emits the "event" and possibly an event-specific signal on a
widget. gtk_propagate_event()
is a bit higher-level, and
gtk_main_do_event()
is the highest level.
All that said, you most likely don't want to use any of these
functions; synthesizing events is rarely needed. Consider asking on
the mailing list for better ways to achieve your goals. For
example, use gdk_window_invalidate_rect()
or
gtk_widget_queue_draw()
instead of making up expose events.
#define GTK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
GTK_PRIORITY_REDRAW
is deprecated and should not be used in newly-written code.
#define GTK_PRIORITY_HIGH G_PRIORITY_HIGH
GTK_PRIORITY_HIGH
is deprecated and should not be used in newly-written code.
#define GTK_PRIORITY_INTERNAL GTK_PRIORITY_REDRAW
GTK_PRIORITY_INTERNAL
is deprecated and should not be used in newly-written code.
#define GTK_PRIORITY_DEFAULT G_PRIORITY_DEFAULT_IDLE
GTK_PRIORITY_DEFAULT
is deprecated and should not be used in newly-written code.