Move docs for gtkmain inline

At the same time, introduce a gtkmainprivate.h header
and various other cleanups.

Based on a patch by Tadej Borovšak.
https://bugzilla.gnome.org/show_bug.cgi?id=617471
This commit is contained in:
Matthias Clasen 2011-01-04 17:32:12 -05:00
parent 98440ad031
commit b123bc41fd
28 changed files with 923 additions and 1202 deletions

View File

@ -23,6 +23,7 @@ gtkentry.sgml
gtkentrybuffer.sgml gtkentrybuffer.sgml
gtkeventbox.sgml gtkeventbox.sgml
gtkexpander.sgml gtkexpander.sgml
gtkfeatures.sgml
gtkhbox.sgml gtkhbox.sgml
gtkiconview.sgml gtkiconview.sgml
gtkimcontextsimple.sgml gtkimcontextsimple.sgml
@ -30,6 +31,7 @@ gtkimmulticontext.sgml
gtkitemfactory.sgml gtkitemfactory.sgml
gtklayout.sgml gtklayout.sgml
gtklinkbutton.sgml gtklinkbutton.sgml
gtkmain.sgml
gtkmessagedialog.sgml gtkmessagedialog.sgml
gtknotebook.sgml gtknotebook.sgml
gtkobject.sgml gtkobject.sgml

View File

@ -1,135 +0,0 @@
<!-- ##### SECTION Title ##### -->
Version Information
<!-- ##### SECTION Short_Description ##### -->
Variables and functions to check the GTK+ version
<!-- ##### SECTION Long_Description ##### -->
<para>
GTK+ provides version information, primarily useful in configure checks
for builds that have a configure script. Applications will not
typically use the features described here.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### FUNCTION gtk_get_major_version ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_minor_version ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_micro_version ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_binary_age ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_interface_age ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_check_version ##### -->
<para>
</para>
@required_major:
@required_minor:
@required_micro:
@Returns:
<!-- ##### MACRO GTK_MAJOR_VERSION ##### -->
<para>
Like #gtk_major_version, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para>
<!-- ##### MACRO GTK_MINOR_VERSION ##### -->
<para>
Like #gtk_minor_version, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para>
<!-- ##### MACRO GTK_MICRO_VERSION ##### -->
<para>
Like #gtk_micro_version, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para>
<!-- ##### MACRO GTK_BINARY_AGE ##### -->
<para>
Like #gtk_binary_age, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para>
<!-- ##### MACRO GTK_INTERFACE_AGE ##### -->
<para>
Like #gtk_interface_age, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para>
<!-- ##### MACRO GTK_CHECK_VERSION ##### -->
<para>
Returns %TRUE if the version of the GTK+ header files is the same
as or newer than the passed-in version.
</para>
@major: major version (e.g. 1 for version 1.2.5)
@minor: minor version (e.g. 2 for version 1.2.5)
@micro: micro version (e.g. 5 for version 1.2.5)

View File

@ -1,554 +0,0 @@
<!-- ##### SECTION Title ##### -->
Main loop and Events
<!-- ##### SECTION Short_Description ##### -->
Library initialization, main event loop, and events
<!-- ##### SECTION Long_Description ##### -->
<para>
Before using GTK+, you need to initialize it; initialization connects
to the window system display, and parses some standard command line
arguments. The gtk_init() function initializes GTK+. gtk_init() exits
the application if errors occur; to avoid this, use gtk_init_check().
gtk_init_check() allows you to recover from a failed GTK+
initialization - you might start up your application in text mode instead.
</para>
<para>
Like all GUI toolkits, GTK+ uses an event-driven programming
model. When the user is doing nothing, GTK+ sits in the
<firstterm>main loop</firstterm> 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 GTK+. GTK+ forwards the event to one or
more widgets.
</para>
<para>
When widgets receive an event, they frequently emit one or more
<firstterm>signals</firstterm>. Signals notify your program that
"something interesting happened" by invoking functions you've
connected to the signal with g_signal_connect(). Functions connected
to a signal are often termed <firstterm>callbacks</firstterm>.
</para>
<para>
When your callbacks are invoked, you would typically take some action
- for example, when an Open button is clicked you might display a
#GtkFileSelectionDialog. After a callback finishes, GTK+ will return
to the main loop and await more user input.
</para>
<example>
<title>Typical <function>main</function> function for a GTK+ application</title>
<programlisting>
int
main (int argc, char **argv)
{
/* Initialize i18n support */
gtk_set_locale (<!-- -->);
/* Initialize the widget set */
gtk_init (&amp;argc, &amp;argv);
/* Create the main window */
mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Set up our GUI elements */
...
/* Show the application window */
gtk_widget_show_all (mainwin);
/* Enter the main event loop, and wait for user interaction */
gtk_main (<!-- -->);
/* The user lost interest */
return 0;
}
</programlisting>
</example>
<para>
It's OK to use the GLib main loop directly instead of gtk_main(),
though it involves slightly more typing. See #GMainLoop in the GLib
documentation.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
See the GLib manual, especially #GMainLoop and signal-related
functions such as g_signal_connect().
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### FUNCTION gtk_set_locale ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_disable_setlocale ##### -->
<para>
</para>
@void:
<!-- ##### FUNCTION gtk_get_default_language ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_parse_args ##### -->
<para>
</para>
@argc:
@argv:
@Returns:
<!-- ##### FUNCTION gtk_init ##### -->
<para>
</para>
<note>
<para>
</para>
</note>
@argc:
@argv:
<!-- ##### FUNCTION gtk_init_check ##### -->
<para>
</para>
@argc:
@argv:
@Returns:
<!-- ##### FUNCTION gtk_init_with_args ##### -->
<para>
</para>
@argc:
@argv:
@parameter_string:
@entries:
@translation_domain:
@error:
@Returns:
<!-- ##### FUNCTION gtk_get_option_group ##### -->
<para>
</para>
@open_default_display:
@Returns:
<!-- ##### FUNCTION gtk_events_pending ##### -->
<para>
Checks if any events are pending. This can be used to update the GUI
and invoke timeouts etc. while doing some time intensive computation.
</para>
<example>
<title>Updating the GUI during a long computation.</title>
<programlisting>
/* computation going on */
...
while (gtk_events_pending (<!-- -->))
gtk_main_iteration (<!-- -->);
...
/* computation continued */
</programlisting>
</example>
@void:
@Returns: %TRUE if any events are pending, %FALSE otherwise.
<!-- ##### FUNCTION gtk_main ##### -->
<para>
Runs the main loop until gtk_main_quit() is called. You can nest calls to
gtk_main(). In that case gtk_main_quit() will make the innermost invocation
of the main loop return.
</para>
@void:
<!-- ##### FUNCTION gtk_main_level ##### -->
<para>
Asks for the current nesting level of the main loop.
</para>
@void:
@Returns: the nesting level of the current invocation of the main loop.
<!-- ##### FUNCTION gtk_main_quit ##### -->
<para>
Makes the innermost invocation of the main loop return when it regains
control.
</para>
@void:
<!-- ##### FUNCTION gtk_main_iteration ##### -->
<para>
Runs a single iteration of the mainloop. If no events are waiting to be
processed GTK+ will block until the next event is noticed. If you don't
want to block look at gtk_main_iteration_do() or check if any events are
pending with gtk_events_pending() first.
</para>
@void:
@Returns: %TRUE if gtk_main_quit() has been called for the innermost mainloop.
<!-- ##### FUNCTION gtk_main_iteration_do ##### -->
<para>
Runs a single iteration of the mainloop. If no events are available either
return or block dependent on the value of @blocking.
</para>
@blocking: %TRUE if you want GTK+ to block if no events are pending.
@Returns: %TRUE if gtk_main_quit() has been called for the innermost mainloop.
<!-- ##### FUNCTION gtk_main_do_event ##### -->
<para>
Processes a single GDK event. This is public only to allow filtering of events
between GDK and GTK+. You will not usually need to call this function directly.
</para>
<para>
While you should not call this function directly, you might want to know
how exactly events are handled. So here is what this function does with
the event:
</para>
<orderedlist>
<listitem><para>
Compress enter/leave notify events. If the event passed build an
enter/leave pair together with the next event (peeked from GDK)
both events are thrown away. This is to avoid a backlog of (de-)highlighting
widgets crossed by the pointer.
</para></listitem>
<listitem><para>
Find the widget which got the event. If the widget can't be determined
the event is thrown away unless it belongs to a INCR transaction. In that
case it is passed to gtk_selection_incr_event().
</para></listitem>
<listitem><para>
Then the event is passed on a stack so you can query the currently handled
event with gtk_get_current_event().
</para></listitem>
<listitem><para>
The event is sent to a widget. If a grab is active all events for
widgets that are not in the contained in the grab widget are sent to the
latter with a few exceptions:
<itemizedlist>
<listitem><para>
Deletion and destruction events are still sent to the event widget for
obvious reasons.
</para></listitem>
<listitem><para>
Events which directly relate to the visual representation of the event
widget.
</para></listitem>
<listitem><para>
Leave events are delivered to the event widget if there was an enter
event delivered to it before without the paired leave event.
</para></listitem>
<listitem><para>
Drag events are not redirected because it is unclear what the semantics
of that would be.
</para></listitem>
</itemizedlist>
Another point of interest might be that all key events are first passed
through the key snooper functions if there are any. Read the description
of gtk_key_snooper_install() if you need this feature.
</para></listitem>
<listitem><para>
After finishing the delivery the event is popped from the event stack.
</para></listitem>
</orderedlist>
@event: An event to process (normally) passed by GDK.
<!-- ##### USER_FUNCTION GtkModuleInitFunc ##### -->
<para>
Each GTK+ module must have a function gtk_module_init() with this prototype.
This function is called after loading the module with the @argc and @argv
cleaned from any arguments that GTK+ handles itself.
</para>
@argc: Pointer to the number of arguments remaining after gtk_init().
@argv: Points to the argument vector.
<!-- ##### USER_FUNCTION GtkModuleDisplayInitFunc ##### -->
<para>
</para>
@display:
@Since: 2.2
<!-- ##### FUNCTION gtk_true ##### -->
<para>
All this function does it to return %TRUE. This can be useful for example
if you want to inhibit the deletion of a window. Of course you should
not do this as the user expects a reaction from clicking the close
icon of the window...
</para>
<example>
<title>A persistent window</title>
<programlisting>
##include &lt;gtk/gtk.h&gt;
int
main (int argc, char **argv)
{
GtkWidget *win, *but;
gtk_init( &amp;argc, &amp;argv );
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (win, "delete-event",
G_CALLBACK (gtk_true), NULL);
g_signal_connect (win, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
but = gtk_button_new_with_label ("Close yourself. I mean it!");
g_signal_connect_swapped (but, "clicked",
G_CALLBACK (gtk_object_destroy), win);
gtk_container_add (GTK_CONTAINER (win), but);
gtk_widget_show_all (win);
gtk_main (<!-- -->);
return 0;
}
</programlisting>
</example>
@void:
@Returns: %TRUE
<!-- ##### FUNCTION gtk_false ##### -->
<para>
Analogical to gtk_true() this function does nothing
but always returns %FALSE.
</para>
@void:
@Returns: %FALSE
<!-- ##### FUNCTION gtk_grab_add ##### -->
<para>
Makes @widget the current grabbed widget. 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.
</para>
<para>
If @widget is not sensitive, it is not set as the current grabbed
widget and this function does nothing.
</para>
@widget: The widget that grabs keyboard and pointer events.
<!-- ##### FUNCTION gtk_grab_get_current ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_grab_remove ##### -->
<para>
Removes the grab from the given widget. You have to pair calls to gtk_grab_add()
and gtk_grab_remove().
</para>
<para>
If @widget does not have the grab, this function does nothing.
</para>
@widget: The widget which gives up the grab.
<!-- ##### FUNCTION gtk_device_grab_add ##### -->
<para>
</para>
@widget:
@device:
@block_others:
<!-- ##### FUNCTION gtk_device_grab_remove ##### -->
<para>
</para>
@widget:
@device:
<!-- ##### USER_FUNCTION GtkFunction ##### -->
<para>
</para>
@data:
@Returns:
<!-- ##### USER_FUNCTION GtkCallbackMarshal ##### -->
<para>
</para>
@object:
@data:
@n_args:
@args:
<!-- ##### STRUCT GtkArg ##### -->
<para>
</para>
@type:
@name:
<!-- ##### MACRO GTK_PRIORITY_RESIZE ##### -->
<para>
Use this priority for resizing related stuff. It is used internally by
GTK+ to compute the sizes of widgets. This priority is higher than
%GDK_PRIORITY_REDRAW to avoid resizing a widget which was just redrawn.
</para>
<!-- ##### FUNCTION gtk_key_snooper_install ##### -->
<para>
Installs a key snooper function, which will get called on all key events
before delivering them normally.
</para>
@snooper: a #GtkKeySnoopFunc.
@func_data: data to pass to @snooper.
@Returns: a unique id for this key snooper for use with gtk_key_snooper_remove().
<!-- ##### USER_FUNCTION GtkKeySnoopFunc ##### -->
<para>
Key snooper functions are called before normal event delivery.
They can be used to implement custom key event handling.
</para>
@grab_widget: the widget to which the event will be delivered.
@event: the key event.
@func_data: the @func_data supplied to gtk_key_snooper_install().
@Returns: %TRUE to stop further processing of @event, %FALSE to continue.
<!-- ##### FUNCTION gtk_key_snooper_remove ##### -->
<para>
Removes the key snooper function with the given id.
</para>
@snooper_handler_id: Identifies the key snooper to remove.
<!-- ##### FUNCTION gtk_get_current_event ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_current_event_time ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_current_event_state ##### -->
<para>
</para>
@state:
@Returns:
<!-- ##### FUNCTION gtk_get_current_event_device ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_get_event_widget ##### -->
<para>
</para>
@event:
@Returns:
<!-- ##### FUNCTION gtk_propagate_event ##### -->
<para>
</para>
@widget:
@event:

View File

@ -394,6 +394,7 @@ gtk_private_h_sources = \
gtkimcontextsimpleseqs.h \ gtkimcontextsimpleseqs.h \
gtkintl.h \ gtkintl.h \
gtkkeyhash.h \ gtkkeyhash.h \
gtkmainprivate.h \
gtkmenuprivate.h \ gtkmenuprivate.h \
gtkmenuitemprivate.h \ gtkmenuitemprivate.h \
gtkmenushellprivate.h \ gtkmenushellprivate.h \

View File

@ -51,7 +51,7 @@
#include "gtkvbox.h" #include "gtkvbox.h"
#include "gtkiconfactory.h" #include "gtkiconfactory.h"
#include "gtkshow.h" #include "gtkshow.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmessagedialog.h" #include "gtkmessagedialog.h"
#include "gtktogglebutton.h" #include "gtktogglebutton.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"

View File

@ -30,10 +30,10 @@
#include "gtkaccelgroup.h" #include "gtkaccelgroup.h"
#include "gtkaccelgroupprivate.h" #include "gtkaccelgroupprivate.h"
#include "gtkaccellabel.h" /* For _gtk_accel_label_class_get_accelerator_label */ #include "gtkaccellabel.h"
#include "gtkaccelmap.h" #include "gtkaccelmap.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkmain.h" /* For _gtk_boolean_handled_accumulator */ #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"

View File

@ -35,7 +35,7 @@
#include "gtkvbox.h" #include "gtkvbox.h"
#include "gtkwindow.h" #include "gtkwindow.h"
#include "gtkentry.h" #include "gtkentry.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkprivate.h" #include "gtkprivate.h"

View File

@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include <string.h> #include <string.h>
#include "gtkimcontext.h" #include "gtkimcontext.h"
#include "gtkmain.h" /* For _gtk_boolean_handled_accumulator */ #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkintl.h" #include "gtkintl.h"

View File

@ -35,7 +35,7 @@
#include "gtkimmodule.h" #include "gtkimmodule.h"
#include "gtkimcontextsimple.h" #include "gtkimcontextsimple.h"
#include "gtksettings.h" #include "gtksettings.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkrc.h" #include "gtkrc.h"
#include "gtkintl.h" #include "gtkintl.h"

View File

@ -31,7 +31,7 @@
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkaccellabel.h" #include "gtkaccellabel.h"
#include "gtkdnd.h" #include "gtkdnd.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkpango.h" #include "gtkpango.h"
#include "gtkwindow.h" #include "gtkwindow.h"

View File

@ -5,7 +5,7 @@
* All rights reserved. * All rights reserved.
* *
* Based on gnome-href code by: * Based on gnome-href code by:
* James Henstridge <james@daa.com.au> * James Henstridge <james@daa.com.au>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -55,7 +55,7 @@
#include "gtkdnd.h" #include "gtkdnd.h"
#include "gtkimagemenuitem.h" #include "gtkimagemenuitem.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkmenu.h" #include "gtkmenu.h"
#include "gtkmenuitem.h" #include "gtkmenuitem.h"

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
@ -41,15 +41,33 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* Priorities for redrawing and resizing /**
* GTK_PRIORITY_RESIZE:
*
* Use this priority for functionality related to size allocation.
*
* It is used internally by GTK+ to compute the sizes of widgets.
* This priority is higher than %GDK_PRIORITY_REDRAW to avoid
* resizing a widget which was just redrawn.
*/ */
#define GTK_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 10) #define GTK_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 10)
typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget, /**
GdkEventKey *event, * GtkKeySnoopFunc:
gpointer func_data); * @grab_widget: the widget to which the event will be delivered
* @event: the key event
* @func_data: data supplied to gtk_key_snooper_install()
*
* Key snooper functions are called before normal event delivery.
* They can be used to implement custom key event handling.
*
* Returns: %TRUE to stop further processing of @event, %FALSE to continue.
*/
typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
GdkEventKey *event,
gpointer func_data);
/* Gtk version. /* GTK+ version
*/ */
guint gtk_get_major_version (void) G_GNUC_CONST; guint gtk_get_major_version (void) G_GNUC_CONST;
guint gtk_get_minor_version (void) G_GNUC_CONST; guint gtk_get_minor_version (void) G_GNUC_CONST;
@ -63,16 +81,16 @@ guint gtk_get_interface_age (void) G_GNUC_CONST;
#define gtk_binary_age gtk_get_binary_age () #define gtk_binary_age gtk_get_binary_age ()
#define gtk_interface_age gtk_get_interface_age () #define gtk_interface_age gtk_get_interface_age ()
const gchar* gtk_check_version (guint required_major, const gchar* gtk_check_version (guint required_major,
guint required_minor, guint required_minor,
guint required_micro); guint required_micro);
/* Initialization, exit, mainloop and miscellaneous routines /* Initialization, exit, mainloop and miscellaneous routines
*/ */
gboolean gtk_parse_args (int *argc, gboolean gtk_parse_args (int *argc,
char ***argv); char ***argv);
void gtk_init (int *argc, void gtk_init (int *argc,
char ***argv); char ***argv);
@ -94,16 +112,16 @@ GOptionGroup *gtk_get_option_group (gboolean open_default_display);
/* Variants that are used to check for correct struct packing /* Variants that are used to check for correct struct packing
* when building GTK+-using code. * when building GTK+-using code.
*/ */
void gtk_init_abi_check (int *argc, void gtk_init_abi_check (int *argc,
char ***argv, char ***argv,
int num_checks, int num_checks,
size_t sizeof_GtkWindow, size_t sizeof_GtkWindow,
size_t sizeof_GtkBox); size_t sizeof_GtkBox);
gboolean gtk_init_check_abi_check (int *argc, gboolean gtk_init_check_abi_check (int *argc,
char ***argv, char ***argv,
int num_checks, int num_checks,
size_t sizeof_GtkWindow, size_t sizeof_GtkWindow,
size_t sizeof_GtkBox); size_t sizeof_GtkBox);
#define gtk_init(argc, argv) gtk_init_abi_check (argc, argv, 2, sizeof (GtkWindow), sizeof (GtkBox)) #define gtk_init(argc, argv) gtk_init_abi_check (argc, argv, 2, sizeof (GtkWindow), sizeof (GtkBox))
#define gtk_init_check(argc, argv) gtk_init_check_abi_check (argc, argv, 2, sizeof (GtkWindow), sizeof (GtkBox)) #define gtk_init_check(argc, argv) gtk_init_check_abi_check (argc, argv, 2, sizeof (GtkWindow), sizeof (GtkBox))
@ -114,25 +132,19 @@ void gtk_disable_setlocale (void);
PangoLanguage *gtk_get_default_language (void); PangoLanguage *gtk_get_default_language (void);
gboolean gtk_events_pending (void); gboolean gtk_events_pending (void);
/* The following is the event func GTK+ registers with GDK void gtk_main_do_event (GdkEvent *event);
* we expose it mainly to allow filtering of events between void gtk_main (void);
* GDK and GTK+. guint gtk_main_level (void);
*/ void gtk_main_quit (void);
void gtk_main_do_event (GdkEvent *event); gboolean gtk_main_iteration (void);
gboolean gtk_main_iteration_do (gboolean blocking);
void gtk_main (void); gboolean gtk_true (void) G_GNUC_CONST;
guint gtk_main_level (void); gboolean gtk_false (void) G_GNUC_CONST;
void gtk_main_quit (void);
gboolean gtk_main_iteration (void);
/* gtk_main_iteration() calls gtk_main_iteration_do(TRUE) */
gboolean gtk_main_iteration_do (gboolean blocking);
gboolean gtk_true (void) G_GNUC_CONST; void gtk_grab_add (GtkWidget *widget);
gboolean gtk_false (void) G_GNUC_CONST; GtkWidget* gtk_grab_get_current (void);
void gtk_grab_remove (GtkWidget *widget);
void gtk_grab_add (GtkWidget *widget);
GtkWidget* gtk_grab_get_current (void);
void gtk_grab_remove (GtkWidget *widget);
void gtk_device_grab_add (GtkWidget *widget, void gtk_device_grab_add (GtkWidget *widget,
GdkDevice *device, GdkDevice *device,
@ -140,29 +152,20 @@ void gtk_device_grab_add (GtkWidget *widget,
void gtk_device_grab_remove (GtkWidget *widget, void gtk_device_grab_remove (GtkWidget *widget,
GdkDevice *device); GdkDevice *device);
guint gtk_key_snooper_install (GtkKeySnoopFunc snooper, guint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
gpointer func_data); gpointer func_data);
void gtk_key_snooper_remove (guint snooper_handler_id); void gtk_key_snooper_remove (guint snooper_handler_id);
GdkEvent* gtk_get_current_event (void); GdkEvent * gtk_get_current_event (void);
guint32 gtk_get_current_event_time (void); guint32 gtk_get_current_event_time (void);
gboolean gtk_get_current_event_state (GdkModifierType *state); gboolean gtk_get_current_event_state (GdkModifierType *state);
GdkDevice * gtk_get_current_event_device (void); GdkDevice *gtk_get_current_event_device (void);
GtkWidget* gtk_get_event_widget (GdkEvent *event); GtkWidget *gtk_get_event_widget (GdkEvent *event);
void gtk_propagate_event (GtkWidget *widget,
GdkEvent *event);
/* Private routines internal to GTK+
*/
void gtk_propagate_event (GtkWidget *widget,
GdkEvent *event);
gboolean _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gchar *_gtk_get_lc_ctype (void);
G_END_DECLS G_END_DECLS

35
gtk/gtkmainprivate.h Normal file
View File

@ -0,0 +1,35 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GTK_MAIN_PRIVATE_H__
#define __GTK_MAIN_PRIVATE_H__
#include "gtkmain.h"
G_BEGIN_DECLS
gboolean _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gchar *_gtk_get_lc_ctype (void);
G_END_DECLS
#endif /* __GTK_MAIN_PRIVATE_H__ */

View File

@ -29,7 +29,7 @@
#include "gtkbindings.h" #include "gtkbindings.h"
#include "gtkkeyhash.h" #include "gtkkeyhash.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkmenubar.h" #include "gtkmenubar.h"
#include "gtkmenuitemprivate.h" #include "gtkmenuitemprivate.h"

View File

@ -30,22 +30,30 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/**
/* Functions for use within GTK+ * GtkModuleInitFunc:
* @argc: Pointer to the number of arguments remaining after gtk_init()
* @argv: Points to the argument vector
*
* Each GTK+ module must have a function gtk_module_init()
* with this prototype. This function is called after loading
* the module with the @argc and @argv cleaned from any arguments
* that GTK+ handles itself.
*/ */
gchar * _gtk_find_module (const gchar *name, typedef void (*GtkModuleInitFunc) (gint *argc,
const gchar *type); gchar ***argv);
gchar **_gtk_get_module_path (const gchar *type);
void _gtk_modules_init (gint *argc, /**
gchar ***argv, * GtkModuleDisplayInitFunc:
const gchar *gtk_modules_args); * @display: an open #GdkDisplay
void _gtk_modules_settings_changed (GtkSettings *settings, *
const gchar *modules); * A multihead-aware GTK+ module may have a gtk_module_display_init()
* function with this prototype. GTK+ calls this function for each
typedef void (*GtkModuleInitFunc) (gint *argc, * opened display.
gchar ***argv); *
typedef void (*GtkModuleDisplayInitFunc) (GdkDisplay *display); * Since: 2.2
*/
typedef void (*GtkModuleDisplayInitFunc) (GdkDisplay *display);
G_END_DECLS G_END_DECLS

View File

@ -31,6 +31,7 @@
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtkmainprivate.h"
#include "gtkmessagedialog.h" #include "gtkmessagedialog.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
@ -29,6 +29,8 @@
#include <glib.h> #include <glib.h>
#include "gtksettings.h"
G_BEGIN_DECLS G_BEGIN_DECLS
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
@ -65,9 +67,21 @@ const gchar *_gtk_get_data_prefix ();
#define GTK_DEFAULT_ACCEL_MOD_MASK GDK_META_MASK #define GTK_DEFAULT_ACCEL_MOD_MASK GDK_META_MASK
#endif #endif
gboolean _gtk_fnmatch (const char *pattern, gboolean _gtk_fnmatch (const char *pattern,
const char *string, const char *string,
gboolean no_leading_period); gboolean no_leading_period);
gchar *_gtk_get_lc_ctype (void);
gchar * _gtk_find_module (const gchar *name,
const gchar *type);
gchar **_gtk_get_module_path (const gchar *type);
void _gtk_modules_init (gint *argc,
gchar ***argv,
const gchar *gtk_modules_args);
void _gtk_modules_settings_changed (GtkSettings *settings,
const gchar *modules);
G_END_DECLS G_END_DECLS

View File

@ -30,7 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkorientable.h" #include "gtkorientable.h"
#include "gtkrange.h" #include "gtkrange.h"

View File

@ -31,7 +31,7 @@
#include <string.h> #include <string.h>
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtksizerequest.h" #include "gtksizerequest.h"
#include "gtkwindowprivate.h" #include "gtkwindowprivate.h"

View File

@ -38,7 +38,7 @@
#include "gtkbindings.h" #include "gtkbindings.h"
#include "gtkspinbutton.h" #include "gtkspinbutton.h"
#include "gtkentryprivate.h" #include "gtkentryprivate.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtksettings.h" #include "gtksettings.h"
#include "gtkprivate.h" #include "gtkprivate.h"

View File

@ -52,7 +52,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtktexttag.h" #include "gtktexttag.h"
#include "gtktexttypes.h" #include "gtktexttypes.h"
#include "gtktexttagtable.h" #include "gtktexttagtable.h"

View File

@ -42,7 +42,7 @@
#include "gtkhbox.h" #include "gtkhbox.h"
#include "gtkimage.h" #include "gtkimage.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkmenu.h" #include "gtkmenu.h"
#include "gtkorientable.h" #include "gtkorientable.h"

View File

@ -32,7 +32,7 @@
#include "gtksizerequest.h" #include "gtksizerequest.h"
#include "gtkactivatable.h" #include "gtkactivatable.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkprivate.h" #include "gtkprivate.h"

View File

@ -28,7 +28,7 @@
#include "gtktreednd.h" #include "gtktreednd.h"
#include "gtktreeprivate.h" #include "gtktreeprivate.h"
#include "gtkcellrenderer.h" #include "gtkcellrenderer.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkbuildable.h" #include "gtkbuildable.h"
#include "gtkbutton.h" #include "gtkbutton.h"

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
@ -24,6 +24,16 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
/**
* SECTION:gtkfeatures
* @Short_description: Variables and functions to check the GTK+ version
* @Title: Version Information
*
* GTK+ provides version information, primarily useful in configure checks
* for builds that have a configure script. Applications will not typically
* use the features described here.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly." #error "Only <gtk/gtk.h> can be included directly."
#endif #endif
@ -31,19 +41,62 @@
#ifndef __GTK_VERSION_H__ #ifndef __GTK_VERSION_H__
#define __GTK_VERSION_H__ #define __GTK_VERSION_H__
/* compile time version /**
* GTK_MAJOR_VERSION:
*
* Like gtk_get_major_version(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/ */
#define GTK_MAJOR_VERSION (@GTK_MAJOR_VERSION@) #define GTK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
#define GTK_MINOR_VERSION (@GTK_MINOR_VERSION@)
#define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#define GTK_BINARY_AGE (@GTK_BINARY_AGE@)
#define GTK_INTERFACE_AGE (@GTK_INTERFACE_AGE@)
/* check whether a Gtk+ version equal to or greater than /**
* major.minor.micro is present. * GTK_MINOR_VERSION:
*
* Like gtk_get_minor_version(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/ */
#define GTK_CHECK_VERSION(major,minor,micro) \ #define GTK_MINOR_VERSION (@GTK_MINOR_VERSION@)
(GTK_MAJOR_VERSION > (major) || \
/**
* GTK_MICRO_VERSION:
*
* Like gtk_get_micro_version(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/
#define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@)
/**
* GTK_BINARY_AGE:
*
* Like gtk_get_binary_age(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/
#define GTK_BINARY_AGE (@GTK_BINARY_AGE@)
/**
* GTK_INTERFACE_AGE:
*
* Like gtk_get_interface_age(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/
#define GTK_INTERFACE_AGE (@GTK_INTERFACE_AGE@)
/**
* GTK_CHECK_VERSION:
* @major: major version (e.g. 1 for version 1.2.5)
* @minor: minor version (e.g. 2 for version 1.2.5)
* @micro: micro version (e.g. 5 for version 1.2.5)
*
* Returns %TRUE if the version of the GTK+ header files
* is the same as or newer than the passed-in version.
*/
#define GTK_CHECK_VERSION(major,minor,micro) \
(GTK_MAJOR_VERSION > (major) || \
(GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION > (minor)) || \ (GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION > (minor)) || \
(GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION == (minor) && \ (GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION == (minor) && \
GTK_MICRO_VERSION >= (micro))) GTK_MICRO_VERSION >= (micro)))

View File

@ -39,7 +39,7 @@
#include "gtkclipboard.h" #include "gtkclipboard.h"
#include "gtkiconfactory.h" #include "gtkiconfactory.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkmain.h" #include "gtkmainprivate.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkrc.h" #include "gtkrc.h"
#include "gtkselection.h" #include "gtkselection.h"