mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-21 14:24:19 +00:00
Merge ssh://git.gnome.org/git/gtk+
This commit is contained in:
commit
e9319c6182
24
NEWS
24
NEWS
@ -1,4 +1,26 @@
|
||||
Overview of Changes from GTK+ 2.99.1 to 2.99.2
|
||||
Overview of Changes in GTK+ 2.99.2
|
||||
==================================
|
||||
|
||||
* More widget are using GtkStyleContext directly:
|
||||
GtkToolItemGroup, GtkMenuItem, GtkImageMenuItem, GtkMenu,
|
||||
GtkTearoffMenuItem, GtkCheckMenuItem, GtkMenuShell
|
||||
|
||||
* gtk-builder-convert now accepts a --target-version option
|
||||
|
||||
* Bug fixes:
|
||||
637965 GtkTreeCellDataFunc called with a wrong column arguments
|
||||
639127 Misc Win32 GDK building problems
|
||||
639157 GtkOrientable should add/remove "horizontal" and "vert...
|
||||
639209 Allow toggling the GtkSwitch by clicking the handle
|
||||
639286 include gtk/gtktextattributes.h not installed
|
||||
639327 gtk-builder-convert needs to convert gtkcomboboxentry...
|
||||
|
||||
* Translation updates:
|
||||
Arabic
|
||||
Basque
|
||||
Hebrew
|
||||
|
||||
Overview of Changes from GTK+ 2.99.0 to 2.99.1
|
||||
==============================================
|
||||
|
||||
* More widgets are using GtkStyleContext directly:
|
||||
|
13
configure.ac
13
configure.ac
@ -10,7 +10,7 @@
|
||||
|
||||
m4_define([gtk_major_version], [2])
|
||||
m4_define([gtk_minor_version], [99])
|
||||
m4_define([gtk_micro_version], [2])
|
||||
m4_define([gtk_micro_version], [3])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@ -242,6 +242,13 @@ AC_ARG_ENABLE(rebuilds,
|
||||
[disable all source autogeneration rules])],,
|
||||
[enable_rebuilds=yes])
|
||||
|
||||
AC_ARG_ENABLE(gtk2-dependency,
|
||||
AC_HELP_STRING([--enable-gtk2-dependency],
|
||||
[Do not build gtk-update-icon-cache and other shared tools]),,
|
||||
[enable_gtk2_dependency=no])
|
||||
|
||||
AM_CONDITIONAL(BUILD_ICON_CACHE, [test "x$enable_gtk2_dependency" = xno])
|
||||
|
||||
AC_ARG_ENABLE(xkb,
|
||||
[AC_HELP_STRING([--enable-xkb],
|
||||
[support XKB extension [default=maybe]])],,
|
||||
@ -875,13 +882,15 @@ dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
|
||||
|
||||
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
|
||||
|
||||
if test $cross_compiling = yes; then
|
||||
if test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes; then
|
||||
AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
|
||||
if test x$GTK_UPDATE_ICON_CACHE = xno; then
|
||||
REBUILD_PNGS=#
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes])
|
||||
|
||||
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
|
||||
|
||||
if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-building" revision="6 Sept 2001">
|
||||
<refentry id="gtk-building">
|
||||
<refmeta>
|
||||
<refentrytitle>Compiling the GTK+ libraries</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
@ -363,6 +363,10 @@ How to compile GTK+ itself
|
||||
<group>
|
||||
<arg>--enable-introspection=[no/auto/yes]</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--enable-gtk2-dependency</arg>
|
||||
<arg>--disable-gtk2-dependency</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</para>
|
||||
|
||||
@ -559,6 +563,7 @@ How to compile GTK+ itself
|
||||
supported backends are the quartz backend for OS X.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--enable-introspection</systemitem></title>
|
||||
|
||||
@ -567,6 +572,19 @@ How to compile GTK+ itself
|
||||
The default is 'auto'.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--enable-gtk2-dependency</systemitem> or
|
||||
<systemitem>--disable-gtk2-dependency</systemitem></title>
|
||||
|
||||
<para>
|
||||
Whether to rely on an exiting gtk-update-icon-cache utility
|
||||
instead of building our own. Distributions which are shipping
|
||||
both GTK+ 2.x and GTK+ 3 may want to use this option to
|
||||
avoid file conflicts between these packages.
|
||||
The default is to build gtk-update-icon-cache.
|
||||
</para>
|
||||
</formalpara>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-compiling" revision="4 Feb 2001">
|
||||
<refentry id="gtk-compiling">
|
||||
<refmeta>
|
||||
<refentrytitle>Compiling GTK+ Applications</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<cmdsynopsis>
|
||||
<command>gtk-builder-convert</command>
|
||||
<arg choice="opt">--skip-windows</arg>
|
||||
<arg choice="opt">--target-version <replaceable>version</replaceable></arg>
|
||||
<arg choice="opt">--root <replaceable>name</replaceable></arg>
|
||||
<arg choice="req">input</arg>
|
||||
<arg choice="req">output</arg>
|
||||
@ -37,6 +38,16 @@ its output the file specified as the second argument.
|
||||
<term>-w</term>
|
||||
<listitem><para>Convert everything but GtkWindow subclasses.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--target-version</term>
|
||||
<term>-t</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Some widgets and properties are different between GTK+ versions 2.0 and
|
||||
3.0, so this option allows to set the desired GTK+ target version.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--root</term>
|
||||
<term>-r</term>
|
||||
|
@ -746,6 +746,49 @@ on_alpha_screen_changed (GtkWindow *window,
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Backend-specific code</title>
|
||||
<para>
|
||||
In GTK+ 2.x, GDK could only be compiled for one backend at a time,
|
||||
and the %GDK_WINDOWING_X11 or %GDK_WINDOWING_WIN32 macros could
|
||||
be used to find out which one you are dealing with:
|
||||
<informalexample><programlisting>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
if (timestamp != GDK_CURRENT_TIME)
|
||||
gdk_x11_window_set_user_time (gdk_window, timestamp);
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
/* ... win32 specific code ... */
|
||||
#endif
|
||||
</programlisting></informalexample>
|
||||
In GTK+ 3, GDK can be built with multiple backends, and currently
|
||||
used backend has to be determined at runtime, typically using
|
||||
type-check macros on a #GdkDisplay or #GdkWindow. You still need
|
||||
to use the #GDK_WINDOWING macros to only compile code referring
|
||||
to supported backends:
|
||||
<informalexample><programlisting>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
if (GDK_IS_X11_DISPLAY (display))
|
||||
{
|
||||
if (timestamp != GDK_CURRENT_TIME)
|
||||
gdk_x11_window_set_user_time (gdk_window, timestamp);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
if (GDK_IS_WIN32_DISPLAY (display))
|
||||
{
|
||||
/* ... win32 specific code ... */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
g_warning ("Unsupported GDK backend");
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>The GtkWidget::draw signal</title>
|
||||
<para>
|
||||
|
@ -556,7 +556,24 @@
|
||||
Typically, the provider will be a #GtkCssProvider, which parse CSS
|
||||
information from a file or from a string.
|
||||
</para>
|
||||
<example>
|
||||
<title>Using a custom GtkStyleProvider</title>
|
||||
<programlisting>
|
||||
GtkStyleContext *context;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
|
||||
".frame1 {\n"
|
||||
" border-image: url('gradient1.png') 10 10 10 10 stretch;\n"
|
||||
"}\n", -1, NULL);
|
||||
gtk_style_context_add_provider (context,
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
g_object_unref (provider);
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Notice that you can also get style information from custom resources
|
||||
by implementing the #GtkStyleProvider interface yourself. This is
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-other-software" revision="5 Sept 2001">
|
||||
<refentry id="gtk-other-software">
|
||||
<refmeta>
|
||||
<refentrytitle>Mixing GTK+ with other software</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
@ -35,8 +35,8 @@ How do I get started with GTK+?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
The GTK+ <ulink url="http://www.gtk.org">website</ulink> offers a
|
||||
<ulink url="http://www.gtk.org/tutorial">tutorial</ulink> and a
|
||||
The GTK+ <ulink url="http://www.gtk.org">website</ulink> offers a
|
||||
<ulink url="http://www.gtk.org/tutorial">tutorial</ulink> and a
|
||||
<ulink url="http://www.gtk.org/faq">FAQ</ulink>. More documentation ranging
|
||||
from whitepapers to online books can be found at the
|
||||
<ulink url="http://library.gnome.org/devel/">GNOME developer's site</ulink>.
|
||||
@ -47,7 +47,7 @@ this reference manual for details.
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Where can I get help with GTK+, submit a bug report, or make a feature
|
||||
Where can I get help with GTK+, submit a bug report, or make a feature
|
||||
request?
|
||||
</para></question>
|
||||
|
||||
@ -102,11 +102,11 @@ state (explained in its documentation).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For strings returned from functions, they will be declared "const" (using
|
||||
#G_CONST_RETURN) if they should not be freed. Non-const strings should be
|
||||
freed with g_free(). Arrays follow the same rule. (If you find an exception
|
||||
to the rules, please report a bug to <ulink
|
||||
url="http://bugzilla.gnome.org">http://bugzilla.gnome.org</ulink>.)
|
||||
For strings returned from functions, they will be declared "const" (using
|
||||
#G_CONST_RETURN) if they should not be freed. Non-const strings should be
|
||||
freed with g_free(). Arrays follow the same rule. If you find an
|
||||
undocumented exception to the rules, please report a bug to <ulink
|
||||
url="http://bugzilla.gnome.org">http://bugzilla.gnome.org</ulink>.
|
||||
</para>
|
||||
|
||||
</answer>
|
||||
@ -164,8 +164,8 @@ How do I use GTK+ with threads?
|
||||
<answer>
|
||||
|
||||
<para>
|
||||
This is covered in the <link linkend="gdk-Threads">GDK threads
|
||||
documentation</link>. See also the <link linkend="glib-Threads">GThread</link>
|
||||
This is covered in the <link linkend="gdk-Threads">GDK threads
|
||||
documentation</link>. See also the <link linkend="glib-Threads">GThread</link>
|
||||
documentation for portable threading primitives.
|
||||
</para>
|
||||
|
||||
@ -182,33 +182,37 @@ How do I internationalize a GTK+ program?
|
||||
<para>
|
||||
Most people use <ulink url="http://www.gnu.org/software/gettext/">GNU
|
||||
gettext</ulink>, already required in order to install GLib. On a UNIX
|
||||
or Linux system with gettext installed, type <literal>info gettext</literal>
|
||||
or Linux system with gettext installed, type <literal>info gettext</literal>
|
||||
to read the documentation.
|
||||
</para>
|
||||
<para>
|
||||
The short checklist on how to use gettext is: call bindtextdomain() so gettext
|
||||
can find the files containing your translations, call textdomain() to set the
|
||||
default translation domain, call bind_textdomain_codeset() to request that
|
||||
all translated strings are returned in UTF-8, then call gettext() to look up
|
||||
each string to be translated in the default domain.
|
||||
The short checklist on how to use gettext is: call bindtextdomain() so
|
||||
gettext can find the files containing your translations, call textdomain()
|
||||
to set the default translation domain, call bind_textdomain_codeset() to
|
||||
request that all translated strings are returned in UTF-8, then call
|
||||
gettext() to look up each string to be translated in the default domain.
|
||||
</para>
|
||||
<para>
|
||||
<filename>gi18n.h</filename> provides the following shorthand macros for
|
||||
convenience.
|
||||
Conventionally, people define macros as follows for convenience:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
#define _(x) gettext (x)
|
||||
#define N_(x) x
|
||||
#define _(x) gettext (x)
|
||||
#define N_(x) x
|
||||
#define C_(ctx,x) pgettext (ctx, x)
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
You use N_() (N stands for no-op) to mark a string for translation in a
|
||||
context where a function call to gettext() is not allowed, such as in an
|
||||
array initializer.
|
||||
You eventually have to call gettext() on the string to actually fetch the
|
||||
translation. _() both marks the string for translation and actually
|
||||
You use N_() (N stands for no-op) to mark a string for translation in
|
||||
a location where a function call to gettext() is not allowed, such as
|
||||
in an array initializer.
|
||||
You eventually have to call gettext() on the string to actually fetch
|
||||
the translation. _() both marks the string for translation and actually
|
||||
translates it.
|
||||
</para>
|
||||
<para>
|
||||
Nowadays, GLib provides the common shorthand macros in the header file
|
||||
<filename>gi18n.h</filename>, so you don't have to define them yourself,
|
||||
just include that header.
|
||||
The C_() macro (C stands for context) adds an additional context to
|
||||
the string that is marked for translation, which can help to disambiguate
|
||||
short strings that might need different translations in different
|
||||
parts of your program.
|
||||
</para>
|
||||
<para>
|
||||
Code using these macros ends up looking like this:
|
||||
@ -231,21 +235,21 @@ Code using these macros ends up looking like this:
|
||||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
Libraries using gettext should use dgettext() instead of gettext(), which
|
||||
allows them to specify the translation domain each time they ask for a
|
||||
translation. Libraries should also avoid calling textdomain(), since they
|
||||
will be specifying the domain instead of using the default. For dgettext()
|
||||
the _() macro can be defined as:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
#define _(x) dgettext ("MyDomain", x)
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
Libraries using gettext should use dgettext() instead of gettext(), which
|
||||
allows them to specify the translation domain each time they ask for a
|
||||
translation. Libraries should also avoid calling textdomain(), since
|
||||
they will be specifying the domain instead of using the default.
|
||||
</para>
|
||||
<para>
|
||||
Again, GLib comes with the <filename>gi18n-lib.h</filename>, saving you the
|
||||
trouble of defining the macros by hand. The macros in that header expect the
|
||||
translation domain to be specified by the %GETTEXT_PACKAGE macro.
|
||||
With the convention that the macro <literal>GETTEXT_PACKAGE</literal> is
|
||||
defined to hold your libraries translation domain,
|
||||
<filename>gi18n-lib.h</filename> can be included to provide
|
||||
the following convenience:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
#define _(x) dgettext (GETTEXT_PACKAGE, x)
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@ -259,9 +263,9 @@ How do I use non-ASCII characters in GTK+ programs ?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
GTK+ uses <ulink url="http://www.unicode.org">Unicode</ulink> (more exactly
|
||||
UTF-8) for all text. UTF-8 encodes each Unicode codepoint as a sequence of
|
||||
one to six bytes and has a number of nice properties which make it a good
|
||||
GTK+ uses <ulink url="http://www.unicode.org">Unicode</ulink> (more exactly
|
||||
UTF-8) for all text. UTF-8 encodes each Unicode codepoint as a sequence of
|
||||
one to six bytes and has a number of nice properties which make it a good
|
||||
choice for working with Unicode text in C programs:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
@ -271,30 +275,30 @@ ASCII characters are encoded by their familiar ASCII codepoints.
|
||||
ASCII characters never appear as part of any other character.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
The zero byte doesn't occur as part of a character, so that UTF-8 strings
|
||||
can be manipulated with the usual C library functions for handling
|
||||
The zero byte doesn't occur as part of a character, so that UTF-8 strings
|
||||
can be manipulated with the usual C library functions for handling
|
||||
zero-terminated strings.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
More information about Unicode and UTF-8 can be found in the
|
||||
<ulink url="http://www.cl.cam.ac.uk/~mgk25/unicode.html">UTF-8 and Unicode i
|
||||
More information about Unicode and UTF-8 can be found in the
|
||||
<ulink url="http://www.cl.cam.ac.uk/~mgk25/unicode.html">UTF-8 and Unicode
|
||||
FAQ for Unix/Linux</ulink>.
|
||||
GLib provides functions for converting strings between UTF-8 and other
|
||||
encodings, see g_locale_to_utf8() and g_convert().
|
||||
</para>
|
||||
<para>
|
||||
Text coming from external sources (e.g. files or user input), has to be
|
||||
converted to UTF-8 before being handed over to GTK+. The following example
|
||||
writes the content of a IS0-8859-1 encoded text file to
|
||||
converted to UTF-8 before being handed over to GTK+. The following example
|
||||
writes the content of a IS0-8859-1 encoded text file to
|
||||
<literal>stdout</literal>:
|
||||
<informalexample><programlisting>
|
||||
gchar *text, *utf8_text;
|
||||
gsize length;
|
||||
GError *error = NULL;
|
||||
|
||||
if (g_file_get_contents (filename, &text, &length, NULL))
|
||||
if (g_file_get_contents (filename, &text, &length, NULL))
|
||||
{
|
||||
utf8_text = g_convert (text, length, "UTF-8", "ISO-8859-1",
|
||||
utf8_text = g_convert (text, length, "UTF-8", "ISO-8859-1",
|
||||
NULL, NULL, &error);
|
||||
if (error != NULL)
|
||||
{
|
||||
@ -304,7 +308,7 @@ if (g_file_get_contents (filename, &text, &length, NULL))
|
||||
else
|
||||
g_print (utf8_text);
|
||||
}
|
||||
else
|
||||
else
|
||||
fprintf (stderr, "Unable to read file %s\n", filename);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
@ -315,36 +319,37 @@ handling non-ASCII content:
|
||||
<varlistentry><term>direct UTF-8</term>
|
||||
<listitem><para>
|
||||
If your editor and compiler are capable of handling UTF-8 encoded sources,
|
||||
it is very convenient to simply use UTF-8 for string literals, since it allows
|
||||
you to edit the strings in "wysiwyg". Note that choosing this option may
|
||||
reduce the portability of your code.
|
||||
it is very convenient to simply use UTF-8 for string literals, since it
|
||||
allows you to edit the strings in "wysiwyg". Note that choosing this option
|
||||
may reduce the portability of your code.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term>escaped UTF-8</term>
|
||||
<listitem><para>
|
||||
Even if your toolchain can't handle UTF-8 directly, you can still encode string
|
||||
literals in UTF-8 by using octal or hexadecimal escapes like
|
||||
<literal>\212</literal> or <literal>\xa8</literal> to
|
||||
encode each byte. This is portable, but modifying the escaped strings is not
|
||||
very convenient. Be careful when mixing hexadecimal escapes with ordinary text;
|
||||
Even if your toolchain can't handle UTF-8 directly, you can still encode
|
||||
string literals in UTF-8 by using octal or hexadecimal escapes like
|
||||
<literal>\212</literal> or <literal>\xa8</literal> to encode each byte.
|
||||
This is portable, but modifying the escaped strings is not very convenient.
|
||||
Be careful when mixing hexadecimal escapes with ordinary text;
|
||||
<literal>"\xa8abcd"</literal> is a string of length 1 !
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term>runtime conversion</term>
|
||||
<listitem><para>
|
||||
If the string literals can be represented in an encoding which your toolchain
|
||||
can handle (e.g. IS0-8859-1), you can write your source files in that encoding
|
||||
and use g_convert() to convert the strings to UTF-8 at runtime. Note that this
|
||||
has some runtime overhead, so you may want to move the conversion out of inner
|
||||
loops.
|
||||
If the string literals can be represented in an encoding which your
|
||||
toolchain can handle (e.g. IS0-8859-1), you can write your source files
|
||||
in that encoding and use g_convert() to convert the strings to UTF-8 at
|
||||
runtime. Note that this has some runtime overhead, so you may want to move
|
||||
the conversion out of inner loops.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
Here is an example showing the three approaches using the copyright sign
|
||||
© which has Unicode and ISO-8859-1 codepoint 169 and is represented in
|
||||
UTF-8 by the two bytes 194, 169:
|
||||
Here is an example showing the three approaches using the copyright sign
|
||||
© which has Unicode and ISO-8859-1 codepoint 169 and is represented
|
||||
in UTF-8 by the two bytes 194, 169, or <literal>"\302\251"</literal> as
|
||||
a string literal:
|
||||
<informalexample><programlisting>
|
||||
g_print ("direct UTF-8: ©");
|
||||
g_print ("escaped UTF-8: \302\251");
|
||||
@ -368,9 +373,9 @@ How do I use GTK+ with C++?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
There are two ways to approach this. The GTK+ header files use the subset
|
||||
of C that's also valid C++, so you can simply use the normal GTK+ API
|
||||
in a C++ program. Alternatively, you can use a "C++ binding"
|
||||
There are two ways to approach this. The GTK+ header files use the subset
|
||||
of C that's also valid C++, so you can simply use the normal GTK+ API
|
||||
in a C++ program. Alternatively, you can use a "C++ binding"
|
||||
such as <ulink url="http://gtkmm.sourceforge.net/">gtkmm</ulink>
|
||||
which provides a native C++ API.
|
||||
</para>
|
||||
@ -380,20 +385,20 @@ connected to signals, not methods. So you will need to use global
|
||||
functions or "static" class functions for signal connections.
|
||||
</para>
|
||||
<para>
|
||||
Another common issue when using GTK+ directly is that
|
||||
C++ will not implicitly convert an integer to an enumeration.
|
||||
Another common issue when using GTK+ directly is that
|
||||
C++ will not implicitly convert an integer to an enumeration.
|
||||
This comes up when using bitfields; in C you can write the following
|
||||
code:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
gdk_window_set_events (gdk_window,
|
||||
gdk_window_set_events (gdk_window,
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
while in C++ you must write:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
gdk_window_set_events (gdk_window,
|
||||
gdk_window_set_events (gdk_window,
|
||||
(GdkEventMask) GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
@ -427,19 +432,19 @@ How do I load an image or animation from a file?
|
||||
<answer>
|
||||
|
||||
<para>
|
||||
To load an image file straight into a display widget, use
|
||||
gtk_image_new_from_file() <footnote><para> If the file load fails,
|
||||
gtk_image_new_from_file() will display no image graphic — to detect
|
||||
a failed load yourself, use gdk_pixbuf_new_from_file() directly, then
|
||||
gtk_image_new_from_pixbuf().</para></footnote>.
|
||||
To load an image file straight into a display widget, use
|
||||
gtk_image_new_from_file() <footnote><para> If the file load fails,
|
||||
gtk_image_new_from_file() will display no image graphic — to detect
|
||||
a failed load yourself, use gdk_pixbuf_new_from_file() directly, then
|
||||
gtk_image_new_from_pixbuf().</para></footnote>.
|
||||
To load an image for another purpose, use gdk_pixbuf_new_from_file(). To i
|
||||
load an animation, use gdk_pixbuf_animation_new_from_file().
|
||||
gdk_pixbuf_animation_new_from_file() can also load non-animated images, so
|
||||
use it in combination with gdk_pixbuf_animation_is_static_image() to load a
|
||||
file of unknown type.
|
||||
gdk_pixbuf_animation_new_from_file() can also load non-animated images, so
|
||||
use it in combination with gdk_pixbuf_animation_is_static_image() to load a
|
||||
file of unknown type.
|
||||
</para>
|
||||
<para>
|
||||
To load an image or animation file asynchronously (without blocking), use
|
||||
To load an image or animation file asynchronously (without blocking), use
|
||||
#GdkPixbufLoader.
|
||||
</para>
|
||||
</answer>
|
||||
@ -453,14 +458,13 @@ How do I draw text ?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
To draw a piece of text, use a Pango layout and gdk_draw_layout(),
|
||||
using code like the following:
|
||||
To draw a piece of text, use a Pango layout and pango_cairo_show_layout().
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
layout = gtk_widget_create_pango_layout (widget, text);
|
||||
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
|
||||
pango_layout_set_font_description (layout, fontdesc);
|
||||
gdk_draw_layout (..., layout);
|
||||
pango_layout_set_font_description (layout, fontdesc);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
pango_font_description_free (fontdesc);
|
||||
g_object_unref (layout);
|
||||
</programlisting>
|
||||
@ -485,13 +489,13 @@ How do I measure the size of a piece of text ?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
To obtain the size of a piece of text, use a Pango layout and
|
||||
To obtain the size of a piece of text, use a Pango layout and
|
||||
pango_layout_get_pixel_size(), using code like the following:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
layout = gtk_widget_create_pango_layout (widget, text);
|
||||
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
|
||||
pango_layout_set_font_description (layout, fontdesc);
|
||||
pango_layout_set_font_description (layout, fontdesc);
|
||||
pango_layout_get_pixel_size (layout, &width, &height);
|
||||
pango_font_description_free (fontdesc);
|
||||
g_object_unref (layout);
|
||||
@ -510,21 +514,21 @@ section of <ulink url="http://library.gnome.org/devel/pango/stable/">Pango manua
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>
|
||||
Why are types not registered if I use their <literal>GTK_TYPE_BLAH</literal>
|
||||
Why are types not registered if I use their <literal>GTK_TYPE_BLAH</literal>
|
||||
macro ?
|
||||
</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
The <literal>GTK_TYPE_BLAH</literal> macros are defined as calls to
|
||||
The <literal>GTK_TYPE_BLAH</literal> macros are defined as calls to
|
||||
<literal>gtk_blah_get_type()</literal>, and the <literal>_get_type()</literal> i
|
||||
functions are declared as %G_GNUC_CONST which allows the compiler to optimize
|
||||
the call away if it appears that the value is not being used.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A common workaround for this problem is to store the result in a volatile
|
||||
A common workaround for this problem is to store the result in a volatile
|
||||
variable, which keeps the compiler from optimizing the call away.
|
||||
<informalexample><programlisting>
|
||||
volatile GType dummy = GTK_TYPE_BLAH;
|
||||
@ -543,28 +547,29 @@ How do I create a transparent toplevel window ?
|
||||
<answer>
|
||||
<para>
|
||||
To make a window transparent, it needs to use a visual which supports that.
|
||||
This is done by getting the RGBA colormap of the screen with
|
||||
gdk_screen_get_rgba_colormap() and setting it on the window. Note that
|
||||
gdk_screen_get_rgba_colormap() will return %NULL if transparent windows
|
||||
are not supported on the screen; also note that this may change from
|
||||
screen to screen, so it needs to be repeated whenever the window is moved
|
||||
to a different screen.
|
||||
This is done by getting the RGBA visual of the screen with
|
||||
gdk_screen_get_rgba_visual() and setting it on the window. Note that
|
||||
gdk_screen_get_rgba_visual() will return %NULL if transparent windows
|
||||
are not supported on the screen, you should fall back to
|
||||
gdk_screen_get_system_visual() in that case. Additionally, note that this
|
||||
will change from screen to screen, so it needs to be repeated whenever the
|
||||
window is moved to a different screen.
|
||||
<informalexample><programlisting>
|
||||
GdkColormap *colormap;
|
||||
GdkVisual *visual;
|
||||
|
||||
colormap = gdk_screen_get_rgba_colormap (screen);
|
||||
if (!colormap)
|
||||
colormap = gdk_screen_get_rgb_colormap (screen);
|
||||
visual = gdk_screen_get_rgba_visual (screen);
|
||||
if (visual == NULL)
|
||||
visual = gdk_screen_get_system_visual (screen);
|
||||
|
||||
gtk_widget_set_colormap (widget, colormap);
|
||||
gtk_widget_set_visual (GTK_WIDGET (window), visual);
|
||||
</programlisting></informalexample>
|
||||
One possibility to fill the alpha channel on the window is to use
|
||||
gdk_draw_rgb_32_image().
|
||||
To fill the alpha channel on the window simply use cairos
|
||||
RGBA drawing capabilities.
|
||||
</para>
|
||||
<para>
|
||||
Note that the presence of an RGBA visual is no guarantee that the
|
||||
window will actually appear transparent on screen. On X11, this
|
||||
requires a compositing manager to be running. See
|
||||
window will actually appear transparent on screen. On X11, this
|
||||
requires a compositing manager to be running. See
|
||||
gtk_widget_is_composited() for a way to find out if the alpha
|
||||
channel will be respected.
|
||||
</para>
|
||||
@ -583,7 +588,7 @@ channel will be respected.
|
||||
<answer>
|
||||
<para>
|
||||
See <link linkend="TreeWidget">tree widget overview</link> — you
|
||||
should use the #GtkTreeView widget. (A list is just a tree with no branches,
|
||||
should use the #GtkTreeView widget. (A list is just a tree with no branches,
|
||||
so the tree widget is used for lists as well).
|
||||
</para>
|
||||
</answer>
|
||||
@ -600,8 +605,8 @@ See <link linkend="TextWidget">text widget overview</link> — you
|
||||
should use the #GtkTextView widget.
|
||||
</para>
|
||||
<para>
|
||||
If you only have a small amount of text, #GtkLabel may also be appropriate
|
||||
of course. It can be made selectable with gtk_label_set_selectable(). For a
|
||||
If you only have a small amount of text, #GtkLabel may also be appropriate
|
||||
of course. It can be made selectable with gtk_label_set_selectable(). For a
|
||||
single-line text entry, see #GtkEntry.
|
||||
</para>
|
||||
</answer>
|
||||
@ -615,8 +620,8 @@ single-line text entry, see #GtkEntry.
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
#GtkImage can display images in just about any format GTK+ understands.
|
||||
You can also use #GtkDrawingArea if you need to do something more complex,
|
||||
#GtkImage can display images in just about any format GTK+ understands.
|
||||
You can also use #GtkDrawingArea if you need to do something more complex,
|
||||
such as draw text or graphics over the top of the image.
|
||||
</para>
|
||||
</answer>
|
||||
@ -648,17 +653,14 @@ How do I change the color of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
See gtk_widget_modify_fg(), gtk_widget_modify_bg(), gtk_widget_modify_base(),
|
||||
and gtk_widget_modify_text(). See <link linkend="gtk-Resource-Files">GTK+
|
||||
resource files</link> for more discussion. You can also change widget color
|
||||
by installing a resource file and parsing it with gtk_rc_add_default_file().
|
||||
The advantage of a resource file is that users can then override the
|
||||
color you've chosen.
|
||||
See gtk_widget_override_color() and gtk_widget_override_background_color().
|
||||
You can also change the appearance of a widget by installing a
|
||||
custom style provider, see gtk_style_context_add_provider().
|
||||
</para>
|
||||
|
||||
<para>To change the background color for widgets such as #GtkLabel that have
|
||||
no background, place them in a #GtkEventBox and set the background of the
|
||||
event box.
|
||||
<para>To change the background color for widgets such as #GtkLabel that
|
||||
have no background, place them in a #GtkEventBox and set the background
|
||||
of the event box.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@ -668,35 +670,38 @@ How do I change the font of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
This has several possible answers, depending on what exactly you want to
|
||||
achieve. One option is gtk_widget_modify_font(). Note that this function
|
||||
can be used to change only the font size, as in the following example:
|
||||
This has several possible answers, depending on what exactly you want to
|
||||
achieve. One option is gtk_widget_override_font().
|
||||
<informalexample><programlisting>
|
||||
PangoFontDesc *font_desc = pango_font_description_new (<!-- -->);
|
||||
pango_font_description_set_size (font_desc, 40);
|
||||
gtk_widget_modify_font (widget, font);
|
||||
gtk_widget_override_font (widget, font);
|
||||
pango_font_description_free (font_desc);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
<para>
|
||||
If you want to make the text of a label larger, you can use
|
||||
If you want to make the text of a label larger, you can use
|
||||
gtk_label_set_markup():
|
||||
<informalexample><programlisting>
|
||||
gtk_label_set_markup (label, "<big>big text</big>");
|
||||
</programlisting></informalexample>
|
||||
This is preferred for many apps because it's a relative size to the
|
||||
user's chosen font size. See g_markup_escape_text() if you are
|
||||
This is preferred for many apps because it's a relative size to the
|
||||
user's chosen font size. See g_markup_escape_text() if you are
|
||||
constructing such strings on the fly.
|
||||
</para>
|
||||
<para>
|
||||
You can also change the font of a widget by putting
|
||||
<programlisting>
|
||||
gtk-font-name = "Sans 30"
|
||||
.my-widget-class {
|
||||
font: Sans 30;
|
||||
}
|
||||
</programlisting>
|
||||
in a resource file and parsing it with gtk_rc_add_default_file().
|
||||
The advantage of a resource file is that users can then override the font you
|
||||
have chosen. See <link linkend="gtk-Resource-Files">GTK+ resource files</link>
|
||||
for more discussion.
|
||||
in a CSS file, loading it with gtk_css_provider_load_from_file(), and
|
||||
adding the provider with gtk_style_context_add_provider_for_screen().
|
||||
To associate this style information with your widget, set a style class
|
||||
on its #GtkStyleContext using gtk_style_context_add_class().
|
||||
The advantage of this approach is that users can then override the font
|
||||
you have chosen. See the #GtkStyleContext documentation for more discussion.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@ -706,8 +711,9 @@ for more discussion.
|
||||
How do I disable/ghost/desensitize a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para> In GTK+ a disabled widget is termed "insensitive." See
|
||||
gtk_widget_set_sensitive().
|
||||
<answer><para>
|
||||
In GTK+ a disabled widget is termed "insensitive."
|
||||
See gtk_widget_set_sensitive().
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@ -746,14 +752,14 @@ How do I make a text widget display its complete contents in a specific font?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
If you use gtk_text_buffer_insert_with_tags() with appropriate tags to select
|
||||
the font, the inserted text will have the desired appearance, but text typed
|
||||
in by the user before or after the tagged block will appear in the default
|
||||
style.
|
||||
If you use gtk_text_buffer_insert_with_tags() with appropriate tags to
|
||||
select the font, the inserted text will have the desired appearance, but
|
||||
text typed in by the user before or after the tagged block will appear in
|
||||
the default style.
|
||||
</para>
|
||||
<para>
|
||||
To ensure that all text has the desired appearance, use gtk_widget_modify_font()
|
||||
to change the default font for the widget.
|
||||
To ensure that all text has the desired appearance, use
|
||||
gtk_widget_override_font() to change the default font for the widget.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@ -770,17 +776,17 @@ A good way to keep a text buffer scrolled to the end is to place a
|
||||
<link linkend="GtkTextMark">mark</link> at the end of the buffer, and
|
||||
give it right gravity. The gravity has the effect that text inserted
|
||||
at the mark gets inserted <emphasis>before</emphasis>, keeping the mark
|
||||
at the end.
|
||||
at the end.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<para>
|
||||
To ensure that the end of the buffer remains visible, use
|
||||
gtk_text_view_scroll_to_mark() to scroll to the mark after
|
||||
inserting new text.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The gtk-demo application contains an example of this technique.
|
||||
The gtk-demo application contains an example of this technique.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@ -797,25 +803,10 @@ How do I associate some data with a row in the tree?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
Remember that the #GtkTreeModel columns don't necessarily have to be displayed.
|
||||
So you can put non-user-visible data in your model just like any other data,
|
||||
and retrieve it with gtk_tree_model_get(). See the
|
||||
<link linkend="TreeWidget">tree widget overview</link>.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
What's the #GtkTreeView equivalent of gtk_clist_find_row_from_data()?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
As there is no separate data column in the #GtkTreeModel, there's no
|
||||
built in function to find the iter from data. You can write a custom
|
||||
searching function to walk the tree and find the data, or use
|
||||
gtk_tree_model_foreach().
|
||||
Remember that the #GtkTreeModel columns don't necessarily have to be
|
||||
displayed. So you can put non-user-visible data in your model just
|
||||
like any other data, and retrieve it with gtk_tree_model_get().
|
||||
See the <link linkend="TreeWidget">tree widget overview</link>.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@ -827,9 +818,9 @@ How do I put an image and some text in the same column?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
You can pack more than one #GtkCellRenderer into a single #GtkTreeViewColumn
|
||||
using gtk_tree_view_column_pack_start() or gtk_tree_view_column_pack_end().
|
||||
So pack both a #GtkCellRendererPixbuf and a #GtkCellRendererText into the
|
||||
You can pack more than one #GtkCellRenderer into a single #GtkTreeViewColumn
|
||||
using gtk_tree_view_column_pack_start() or gtk_tree_view_column_pack_end().
|
||||
So pack both a #GtkCellRendererPixbuf and a #GtkCellRendererText into the
|
||||
column.
|
||||
</para>
|
||||
</answer>
|
||||
@ -837,15 +828,15 @@ column.
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
I can set data easily on my #GtkTreeStore/#GtkListStore models using
|
||||
I can set data easily on my #GtkTreeStore/#GtkListStore models using
|
||||
gtk_list_store_set() and gtk_tree_store_set(), but can't read it back?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
Both the #GtkTreeStore and the #GtkListStore implement the #GtkTreeModel
|
||||
interface. Consequentially, the can use any function this interface
|
||||
implements. The easiest way to read a set of data back is to use
|
||||
interface. Consequentially, you can use any function this interface
|
||||
implements. The easiest way to read a set of data back is to use
|
||||
gtk_tree_model_get().
|
||||
</para>
|
||||
</answer>
|
||||
@ -857,14 +848,14 @@ How do I change the way that numbers are formatted by #GtkTreeView?
|
||||
</para></question>
|
||||
<answer><para>
|
||||
Use gtk_tree_view_insert_column_with_data_func()
|
||||
or gtk_tree_view_column_set_cell_data_func() and do the conversion from i
|
||||
number to string yourself (with, say, g_strdup_printf()).
|
||||
or gtk_tree_view_column_set_cell_data_func() and do the conversion
|
||||
from number to string yourself (with, say, g_strdup_printf()).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following example demonstrates this:
|
||||
<informalexample><programlisting>
|
||||
enum
|
||||
enum
|
||||
{
|
||||
DOUBLE_COLUMN,
|
||||
N_COLUMNS
|
||||
@ -873,11 +864,11 @@ enum
|
||||
GtkListStore *mycolumns;
|
||||
GtkTreeView *treeview;
|
||||
|
||||
void
|
||||
void
|
||||
my_cell_double_to_text (GtkTreeViewColumn *tree_column,
|
||||
GtkCellRenderer *cell,
|
||||
GtkCellRenderer *cell,
|
||||
GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererText *cell_text = (GtkCellRendererText *)cell;
|
||||
@ -892,7 +883,7 @@ my_cell_double_to_text (GtkTreeViewColumn *tree_column,
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
set_up_new_columns (GtkTreeView *myview)
|
||||
{
|
||||
GtkCellRendererText *renderer;
|
||||
@ -908,7 +899,7 @@ set_up_new_columns (GtkTreeView *myview)
|
||||
|
||||
/* Create a new column that has a title ("Example column"),
|
||||
* uses the above created renderer that will render the double
|
||||
* value into text from the associated model's rows.
|
||||
* value into text from the associated model's rows.
|
||||
*/
|
||||
column = gtk_tree_view_column_new (<!-- -->);
|
||||
gtk_tree_view_column_set_title (column, "Example column");
|
||||
@ -922,10 +913,10 @@ set_up_new_columns (GtkTreeView *myview)
|
||||
*/
|
||||
/* Set up a custom function that will be called when the column content
|
||||
* is rendered. We use the func_data pointer as an index into our
|
||||
* model. This is convenient when using multi column lists.
|
||||
* model. This is convenient when using multi column lists.
|
||||
*/
|
||||
gtk_tree_view_column_set_cell_data_func (column, renderer,
|
||||
my_cell_double_to_text,
|
||||
my_cell_double_to_text,
|
||||
(gpointer)DOUBLE_COLUMN, NULL);
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
@ -953,42 +944,15 @@ How do I use cairo to draw in GTK+ applications ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
Use gdk_cairo_create() to obtain a cairo context for drawing
|
||||
on a GDK window or pixmap. See <link linkend="gdk-Cairo-Interaction">Cairo
|
||||
Interaction</link> for some more useful functions.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
I have created a cairo context with gdk_cairo_create(), but when I
|
||||
later use it, my drawing does not show up. Why is that ?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
All drawing in GTK+ is normally done in an expose handler, and GTK+
|
||||
creates a temporary pixmap for double-buffering the drawing. If you
|
||||
create a cairo context outside the expose handler, it is backed
|
||||
by the GDK window itself, not the double-buffering pixmap. Consequently,
|
||||
any drawing you do with that cairo context gets overwritten at the
|
||||
end of the expose handler, when the double-buffering pixmap is copied
|
||||
back.
|
||||
The #GtkWidget::draw signal gets a ready-to-use cairo context
|
||||
as parameter that you should use.
|
||||
</para>
|
||||
<para>
|
||||
Possible solutions to this problem are:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Turn off double-buffering, with gtk_widget_set_double_buffered().
|
||||
This is not ideal, since it can cause some flickering.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create the cairo context inside the expose handler. If you do this,
|
||||
gdk_cairo_create() arranges for it to be backed by the double-buffering
|
||||
pixmap. This is the preferred solution, and is used throughout GTK+
|
||||
itself.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
All drawing in GTK+ is normally done in a draw handler, and GTK+
|
||||
creates a temporary pixmap for double-buffering the drawing.
|
||||
It is possible to turn off double-buffering, with
|
||||
gtk_widget_set_double_buffered(), but this is not ideal,
|
||||
since it can cause some flickering.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@ -996,7 +960,7 @@ itself.
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Can I improve the performance of my application by using the
|
||||
Glitz backend of cairo ?
|
||||
Glitz or GL backend of cairo ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
@ -1016,7 +980,7 @@ Can I use cairo to draw on a #GdkPixbuf ?
|
||||
|
||||
<answer><para>
|
||||
No, at least not yet. The cairo image surface does not support the
|
||||
pixel format used by GdkPixbuf.
|
||||
pixel format used by GdkPixbuf.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-resources" revision="5 Sept 2001">
|
||||
<refentry id="gtk-resources">
|
||||
<refmeta>
|
||||
<refentrytitle>Mailing lists and bug reports</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="TextWidget" revision="18 Oct 2000">
|
||||
<refentry id="TextWidget">
|
||||
<refmeta>
|
||||
<refentrytitle>Text Widget Overview</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
7
docs/reference/gtk/tmpl/.gitignore
vendored
7
docs/reference/gtk/tmpl/.gitignore
vendored
@ -22,6 +22,7 @@ gtkdrawingarea.sgml
|
||||
gtkeditable.sgml
|
||||
gtkentry.sgml
|
||||
gtkentrybuffer.sgml
|
||||
gtkenum.sgml
|
||||
gtkeventbox.sgml
|
||||
gtkexpander.sgml
|
||||
gtkfeatures.sgml
|
||||
@ -33,6 +34,8 @@ gtkitemfactory.sgml
|
||||
gtklayout.sgml
|
||||
gtklinkbutton.sgml
|
||||
gtkmain.sgml
|
||||
gtkmenubar.sgml
|
||||
gtkmenushell.sgml
|
||||
gtkmessagedialog.sgml
|
||||
gtknotebook.sgml
|
||||
gtkobject.sgml
|
||||
@ -42,6 +45,7 @@ gtkpagesetupunixdialog.sgml
|
||||
gtkpaned.sgml
|
||||
gtkpapersize.sgml
|
||||
gtkprinter.sgml
|
||||
gtkprintjob.sgml
|
||||
gtkprogressbar.sgml
|
||||
gtkradioaction.sgml
|
||||
gtkradiobutton.sgml
|
||||
@ -56,6 +60,7 @@ gtkscale.sgml
|
||||
gtkscalebutton.sgml
|
||||
gtkscrollbar.sgml
|
||||
gtkscrolledwindow.sgml
|
||||
gtkselection.sgml
|
||||
gtkseparator.sgml
|
||||
gtkseparatormenuitem.sgml
|
||||
gtkseparatortoolitem.sgml
|
||||
@ -64,6 +69,7 @@ gtkstatusbar.sgml
|
||||
gtkstyle.sgml
|
||||
gtktesting.sgml
|
||||
gtktextiter.sgml
|
||||
gtktexttag.sgml
|
||||
gtktexttagtable.sgml
|
||||
gtktextview.sgml
|
||||
gtktoggleaction.sgml
|
||||
@ -71,6 +77,7 @@ gtktoolbar.sgml
|
||||
gtktoolitem.sgml
|
||||
gtktooltip.sgml
|
||||
gtktreednd.sgml
|
||||
gtktreemodel.sgml
|
||||
gtktreemodelfilter.sgml
|
||||
gtktreeselection.sgml
|
||||
gtktreesortable.sgml
|
||||
|
@ -1,458 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Standard Enumerations
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Public enumerated types used throughout GTK+
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkAccelFlags ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_ACCEL_VISIBLE:
|
||||
@GTK_ACCEL_LOCKED:
|
||||
@GTK_ACCEL_MASK:
|
||||
|
||||
<!-- ##### ENUM GtkArrowPlacement ##### -->
|
||||
<para>
|
||||
Used to specify the placement of scroll arrows in scrolling menus.
|
||||
</para>
|
||||
|
||||
@GTK_ARROWS_BOTH: Place one arrow on each end of the menu.
|
||||
@GTK_ARROWS_START: Place both arrows at the top of the menu.
|
||||
@GTK_ARROWS_END: Place both arrows at the bottom of the menu.
|
||||
|
||||
<!-- ##### ENUM GtkArrowType ##### -->
|
||||
<para>
|
||||
Used to indicate the direction in which a #GtkArrow should point.
|
||||
</para>
|
||||
|
||||
@GTK_ARROW_UP: Represents an upward pointing arrow.
|
||||
@GTK_ARROW_DOWN: Represents a downward pointing arrow.
|
||||
@GTK_ARROW_LEFT: Represents a left pointing arrow.
|
||||
@GTK_ARROW_RIGHT: Represents a right pointing arrow.
|
||||
@GTK_ARROW_NONE: No arrow. Since 2.10.
|
||||
|
||||
<!-- ##### ENUM GtkAttachOptions ##### -->
|
||||
<para>
|
||||
Denotes the expansion properties that a widget will have when it (or its
|
||||
parent) is resized.
|
||||
</para>
|
||||
|
||||
@GTK_EXPAND: the widget should expand to take up any extra space in its
|
||||
container that has been allocated.
|
||||
@GTK_SHRINK: the widget should shrink as and when possible.
|
||||
@GTK_FILL: the widget should fill the space allocated to it.
|
||||
|
||||
<!-- ##### ENUM GtkButtonBoxStyle ##### -->
|
||||
<para>
|
||||
Used to dictate the style that a #GtkButtonBox uses to layout the buttons it
|
||||
contains. (See also: #GtkVButtonBox and #GtkHButtonBox).
|
||||
</para>
|
||||
|
||||
@GTK_BUTTONBOX_SPREAD: Buttons are evenly spread across the box.
|
||||
@GTK_BUTTONBOX_EDGE: Buttons are placed at the edges of the box.
|
||||
@GTK_BUTTONBOX_START: Buttons are grouped towards the start of the box,
|
||||
(on the left for a HBox, or the top for a VBox).
|
||||
@GTK_BUTTONBOX_END: Buttons are grouped towards the end of the box,
|
||||
(on the right for a HBox, or the bottom for a VBox).
|
||||
@GTK_BUTTONBOX_CENTER: Buttons are centered in the box. Since 2.12
|
||||
|
||||
<!-- ##### ENUM GtkCornerType ##### -->
|
||||
<para>
|
||||
Specifies which corner a child widget should be placed in when packed into
|
||||
a #GtkScrolledWindow. This is effectively the opposite of where the scroll
|
||||
bars are placed.
|
||||
</para>
|
||||
|
||||
@GTK_CORNER_TOP_LEFT: Place the scrollbars on the right and bottom of the
|
||||
widget (default behaviour).
|
||||
@GTK_CORNER_BOTTOM_LEFT: Place the scrollbars on the top and right of the
|
||||
widget.
|
||||
@GTK_CORNER_TOP_RIGHT: Place the scrollbars on the left and bottom of the
|
||||
widget.
|
||||
@GTK_CORNER_BOTTOM_RIGHT: Place the scrollbars on the top and left of the
|
||||
widget.
|
||||
|
||||
<!-- ##### ENUM GtkDeleteType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_DELETE_CHARS:
|
||||
@GTK_DELETE_WORD_ENDS:
|
||||
@GTK_DELETE_WORDS:
|
||||
@GTK_DELETE_DISPLAY_LINES:
|
||||
@GTK_DELETE_DISPLAY_LINE_ENDS:
|
||||
@GTK_DELETE_PARAGRAPH_ENDS:
|
||||
@GTK_DELETE_PARAGRAPHS:
|
||||
@GTK_DELETE_WHITESPACE:
|
||||
|
||||
<!-- ##### ENUM GtkDirectionType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_DIR_TAB_FORWARD:
|
||||
@GTK_DIR_TAB_BACKWARD:
|
||||
@GTK_DIR_UP:
|
||||
@GTK_DIR_DOWN:
|
||||
@GTK_DIR_LEFT:
|
||||
@GTK_DIR_RIGHT:
|
||||
|
||||
<!-- ##### ENUM GtkExpanderStyle ##### -->
|
||||
<para>
|
||||
Used to specify the style of the expanders drawn by a #GtkTreeView.
|
||||
</para>
|
||||
|
||||
@GTK_EXPANDER_COLLAPSED: The style used for a collapsed subtree.
|
||||
@GTK_EXPANDER_SEMI_COLLAPSED: Intermediate style used during animation.
|
||||
@GTK_EXPANDER_SEMI_EXPANDED: Intermediate style used during animation.
|
||||
@GTK_EXPANDER_EXPANDED: The style used for an expanded subtree.
|
||||
|
||||
<!-- ##### ENUM GtkIMPreeditStyle ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_IM_PREEDIT_NOTHING:
|
||||
@GTK_IM_PREEDIT_CALLBACK:
|
||||
@GTK_IM_PREEDIT_NONE:
|
||||
|
||||
<!-- ##### ENUM GtkIMStatusStyle ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_IM_STATUS_NOTHING:
|
||||
@GTK_IM_STATUS_CALLBACK:
|
||||
@GTK_IM_STATUS_NONE:
|
||||
|
||||
<!-- ##### ENUM GtkJustification ##### -->
|
||||
<para>
|
||||
Used for justifying the text inside a #GtkLabel widget. (See also
|
||||
#GtkAlignment).
|
||||
</para>
|
||||
|
||||
@GTK_JUSTIFY_LEFT: The text is placed at the left edge of the label.
|
||||
@GTK_JUSTIFY_RIGHT: The text is placed at the right edge of the label.
|
||||
@GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
|
||||
@GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
|
||||
|
||||
<!-- ##### ENUM GtkMovementStep ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_MOVEMENT_LOGICAL_POSITIONS:
|
||||
@GTK_MOVEMENT_VISUAL_POSITIONS:
|
||||
@GTK_MOVEMENT_WORDS:
|
||||
@GTK_MOVEMENT_DISPLAY_LINES:
|
||||
@GTK_MOVEMENT_DISPLAY_LINE_ENDS:
|
||||
@GTK_MOVEMENT_PARAGRAPHS:
|
||||
@GTK_MOVEMENT_PARAGRAPH_ENDS:
|
||||
@GTK_MOVEMENT_PAGES:
|
||||
@GTK_MOVEMENT_BUFFER_ENDS:
|
||||
@GTK_MOVEMENT_HORIZONTAL_PAGES:
|
||||
|
||||
<!-- ##### ENUM GtkOrientation ##### -->
|
||||
<para>
|
||||
Represents the orientation of widgets which can be switched between horizontal
|
||||
and vertical orientation on the fly, like #GtkToolbar.
|
||||
</para>
|
||||
|
||||
@GTK_ORIENTATION_HORIZONTAL: The widget is in horizontal orientation.
|
||||
@GTK_ORIENTATION_VERTICAL: The widget is in vertical orientation.
|
||||
|
||||
<!-- ##### ENUM GtkPackType ##### -->
|
||||
<para>
|
||||
Represents the packing location #GtkBox children. (See: #GtkVBox,
|
||||
#GtkHBox, and #GtkButtonBox).
|
||||
</para>
|
||||
|
||||
@GTK_PACK_START: The child is packed into the start of the box
|
||||
@GTK_PACK_END: The child is packed into the end of the box
|
||||
|
||||
<!-- ##### ENUM GtkPathPriorityType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_PATH_PRIO_LOWEST:
|
||||
@GTK_PATH_PRIO_GTK:
|
||||
@GTK_PATH_PRIO_APPLICATION:
|
||||
@GTK_PATH_PRIO_THEME:
|
||||
@GTK_PATH_PRIO_RC:
|
||||
@GTK_PATH_PRIO_HIGHEST:
|
||||
|
||||
<!-- ##### ENUM GtkPathType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_PATH_WIDGET:
|
||||
@GTK_PATH_WIDGET_CLASS:
|
||||
@GTK_PATH_CLASS:
|
||||
|
||||
<!-- ##### ENUM GtkPolicyType ##### -->
|
||||
<para>
|
||||
Determines when a scroll bar will be visible.
|
||||
</para>
|
||||
|
||||
@GTK_POLICY_ALWAYS: The scrollbar is always visible.
|
||||
@GTK_POLICY_AUTOMATIC: The scrollbar will appear and disappear as necessary. For example,
|
||||
when all of a #GtkCList can not be seen.
|
||||
@GTK_POLICY_NEVER: The scrollbar will never appear.
|
||||
|
||||
<!-- ##### ENUM GtkPositionType ##### -->
|
||||
<para>
|
||||
Describes which edge of a widget a certain feature is positioned at, e.g. the
|
||||
tabs of a #GtkNotebook, the handle of a #GtkHandleBox or the label of a
|
||||
#GtkScale.
|
||||
</para>
|
||||
|
||||
@GTK_POS_LEFT: The feature is at the left edge.
|
||||
@GTK_POS_RIGHT: The feature is at the right edge.
|
||||
@GTK_POS_TOP: The feature is at the top edge.
|
||||
@GTK_POS_BOTTOM: The feature is at the bottom edge.
|
||||
|
||||
<!-- ##### ENUM GtkReliefStyle ##### -->
|
||||
<para>
|
||||
Indicated the relief to be drawn around a #GtkButton.
|
||||
</para>
|
||||
|
||||
@GTK_RELIEF_NORMAL: Draw a normal relief.
|
||||
@GTK_RELIEF_HALF: A half relief.
|
||||
@GTK_RELIEF_NONE: No relief.
|
||||
|
||||
<!-- ##### ENUM GtkResizeMode ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_RESIZE_PARENT:
|
||||
@GTK_RESIZE_QUEUE:
|
||||
@GTK_RESIZE_IMMEDIATE: Deprecated.
|
||||
|
||||
<!-- ##### ENUM GtkScrollStep ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_SCROLL_STEPS:
|
||||
@GTK_SCROLL_PAGES:
|
||||
@GTK_SCROLL_ENDS:
|
||||
@GTK_SCROLL_HORIZONTAL_STEPS:
|
||||
@GTK_SCROLL_HORIZONTAL_PAGES:
|
||||
@GTK_SCROLL_HORIZONTAL_ENDS:
|
||||
|
||||
<!-- ##### ENUM GtkScrollType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_SCROLL_NONE:
|
||||
@GTK_SCROLL_JUMP:
|
||||
@GTK_SCROLL_STEP_BACKWARD:
|
||||
@GTK_SCROLL_STEP_FORWARD:
|
||||
@GTK_SCROLL_PAGE_BACKWARD:
|
||||
@GTK_SCROLL_PAGE_FORWARD:
|
||||
@GTK_SCROLL_STEP_UP:
|
||||
@GTK_SCROLL_STEP_DOWN:
|
||||
@GTK_SCROLL_PAGE_UP:
|
||||
@GTK_SCROLL_PAGE_DOWN:
|
||||
@GTK_SCROLL_STEP_LEFT:
|
||||
@GTK_SCROLL_STEP_RIGHT:
|
||||
@GTK_SCROLL_PAGE_LEFT:
|
||||
@GTK_SCROLL_PAGE_RIGHT:
|
||||
@GTK_SCROLL_START:
|
||||
@GTK_SCROLL_END:
|
||||
|
||||
<!-- ##### ENUM GtkSelectionMode ##### -->
|
||||
<para>
|
||||
Used to control what selections users are allowed to make.
|
||||
</para>
|
||||
|
||||
@GTK_SELECTION_NONE: No selection is possible.
|
||||
@GTK_SELECTION_SINGLE: Zero or one element may be selected.
|
||||
@GTK_SELECTION_BROWSE: Exactly one element is selected. In some circumstances,
|
||||
such as initially or during a search operation, it's possible for no element
|
||||
to be selected with %GTK_SELECTION_BROWSE. What is really enforced is that
|
||||
the user can't deselect a currently selected element except by selecting
|
||||
another element.
|
||||
@GTK_SELECTION_MULTIPLE: Any number of elements may be selected.
|
||||
Clicks toggle the state of an item. Any number of elements may be selected.
|
||||
The Ctrl key may be used to enlarge the selection, and Shift key to select
|
||||
between the focus and the child pointed to. Some widgets may also allow
|
||||
Click-drag to select a range of elements.
|
||||
|
||||
<!-- ##### ENUM GtkShadowType ##### -->
|
||||
<para>
|
||||
Used to change the appearance of an outline typically provided by a #GtkFrame.
|
||||
</para>
|
||||
|
||||
@GTK_SHADOW_NONE: No outline.
|
||||
@GTK_SHADOW_IN: The outline is bevelled inwards.
|
||||
@GTK_SHADOW_OUT: The outline is bevelled outwards like a button.
|
||||
@GTK_SHADOW_ETCHED_IN: The outline has a sunken 3d appearance.
|
||||
@GTK_SHADOW_ETCHED_OUT: The outline has a raised 3d appearance
|
||||
|
||||
<!-- ##### ENUM GtkStateType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_STATE_NORMAL:
|
||||
@GTK_STATE_ACTIVE:
|
||||
@GTK_STATE_PRELIGHT:
|
||||
@GTK_STATE_SELECTED:
|
||||
@GTK_STATE_INSENSITIVE:
|
||||
@GTK_STATE_INCONSISTENT:
|
||||
@GTK_STATE_FOCUSED:
|
||||
|
||||
<!-- ##### ENUM GtkStateFlags ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_STATE_FLAG_ACTIVE:
|
||||
@GTK_STATE_FLAG_PRELIGHT:
|
||||
@GTK_STATE_FLAG_SELECTED:
|
||||
@GTK_STATE_FLAG_INSENSITIVE:
|
||||
@GTK_STATE_FLAG_INCONSISTENT:
|
||||
@GTK_STATE_FLAG_FOCUSED:
|
||||
|
||||
<!-- ##### ENUM GtkToolbarStyle ##### -->
|
||||
<para>
|
||||
Used to customize the appearance of a #GtkToolbar. Note that
|
||||
setting the toolbar style overrides the user's preferences
|
||||
for the default toolbar style. Note that if the button has only
|
||||
a label set and GTK_TOOLBAR_ICONS is used, the label will be
|
||||
visible, and vice versa.
|
||||
</para>
|
||||
|
||||
@GTK_TOOLBAR_ICONS: Buttons display only icons in the toolbar.
|
||||
@GTK_TOOLBAR_TEXT: Buttons display only text labels in the toolbar.
|
||||
@GTK_TOOLBAR_BOTH: Buttons display text and icons in the toolbar.
|
||||
@GTK_TOOLBAR_BOTH_HORIZ: Buttons display icons and text alongside each
|
||||
other, rather than vertically stacked
|
||||
|
||||
<!-- ##### ENUM GtkUpdateType ##### -->
|
||||
<para>
|
||||
Used by #GtkRange to control the policy for notifying value changes.
|
||||
</para>
|
||||
|
||||
@GTK_UPDATE_CONTINUOUS: Notify updates whenever the value changed
|
||||
@GTK_UPDATE_DISCONTINUOUS: Notify updates when the mouse button has been released
|
||||
@GTK_UPDATE_DELAYED: Space out updates with a small timeout
|
||||
|
||||
<!-- ##### ENUM GtkWindowPosition ##### -->
|
||||
<para>
|
||||
Window placement can be influenced using this enumeration. Note that
|
||||
using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea.
|
||||
It won't necessarily work well with all window managers or on all windowing systems.
|
||||
</para>
|
||||
|
||||
@GTK_WIN_POS_NONE: No influence is made on placement.
|
||||
@GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
|
||||
@GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
|
||||
@GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc.
|
||||
@GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient
|
||||
parent (see gtk_window_set_transient_for()).
|
||||
|
||||
<!-- ##### ENUM GtkWindowType ##### -->
|
||||
<para>
|
||||
A #GtkWindow can be one of these types. Most things you'd consider a
|
||||
"window" should have type #GTK_WINDOW_TOPLEVEL; windows with this type
|
||||
are managed by the window manager and have a frame by default (call
|
||||
gtk_window_set_decorated() to toggle the frame). Windows with type
|
||||
#GTK_WINDOW_POPUP are ignored by the window manager; window manager
|
||||
keybindings won't work on them, the window manager won't decorate the
|
||||
window with a frame, many GTK+ features that rely on the window
|
||||
manager will not work (e.g. resize grips and
|
||||
maximization/minimization). #GTK_WINDOW_POPUP is used to implement
|
||||
widgets such as #GtkMenu or tooltips that you normally don't think of
|
||||
as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL.
|
||||
In particular, do not use #GTK_WINDOW_POPUP just to turn off
|
||||
the window borders; use gtk_window_set_decorated() for that.
|
||||
</para>
|
||||
|
||||
@GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
|
||||
@GTK_WINDOW_POPUP: A special window such as a tooltip.
|
||||
|
||||
<!-- ##### ENUM GtkSortType ##### -->
|
||||
<para>
|
||||
Determines the direction of a sort.
|
||||
</para>
|
||||
|
||||
@GTK_SORT_ASCENDING: Sorting is in ascending order.
|
||||
@GTK_SORT_DESCENDING: Sorting is in descending order.
|
||||
|
||||
<!-- ##### ENUM GtkDragResult ##### -->
|
||||
<para>
|
||||
Gives an indication why a drag operation failed.
|
||||
The value can by obtained by connecting to the
|
||||
#GtkWidget::drag-failed signal.
|
||||
</para>
|
||||
|
||||
@GTK_DRAG_RESULT_SUCCESS: The drag operation was successful
|
||||
@GTK_DRAG_RESULT_NO_TARGET: No suitable drag target
|
||||
@GTK_DRAG_RESULT_USER_CANCELLED: The user cancelled the drag operation
|
||||
@GTK_DRAG_RESULT_TIMEOUT_EXPIRED: The drag operation timed out
|
||||
@GTK_DRAG_RESULT_GRAB_BROKEN: The pointer or keyboard grab used
|
||||
for the drag operation was broken
|
||||
@GTK_DRAG_RESULT_ERROR: The drag operation failed due to some
|
||||
unspecified error
|
||||
|
||||
<!-- ##### ENUM GtkJunctionSides ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_JUNCTION_NONE:
|
||||
@GTK_JUNCTION_CORNER_TOPLEFT:
|
||||
@GTK_JUNCTION_CORNER_TOPRIGHT:
|
||||
@GTK_JUNCTION_CORNER_BOTTOMLEFT:
|
||||
@GTK_JUNCTION_CORNER_BOTTOMRIGHT:
|
||||
@GTK_JUNCTION_TOP:
|
||||
@GTK_JUNCTION_BOTTOM:
|
||||
@GTK_JUNCTION_LEFT:
|
||||
@GTK_JUNCTION_RIGHT:
|
||||
|
||||
<!-- ##### ENUM GtkBorderStyle ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_BORDER_STYLE_NONE:
|
||||
@GTK_BORDER_STYLE_SOLID:
|
||||
@GTK_BORDER_STYLE_INSET:
|
||||
@GTK_BORDER_STYLE_OUTSET:
|
||||
|
||||
<!-- ##### ENUM GtkRegionFlags ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_REGION_EVEN:
|
||||
@GTK_REGION_ODD:
|
||||
@GTK_REGION_FIRST:
|
||||
@GTK_REGION_LAST:
|
||||
@GTK_REGION_SORTED:
|
||||
|
@ -1,104 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkMenuBar
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A subclass widget for GtkMenuShell which holds GtkMenuItem widgets
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkMenuBar is a subclass of #GtkMenuShell which contains one to many #GtkMenuItem. The result is a standard menu bar which can hold many menu items. #GtkMenuBar allows for a shadow type to be set for aesthetic purposes. The shadow types are defined in the #gtk_menu_bar_set_shadow_type function.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkMenuShell, #GtkMenu, #GtkMenuItem
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkMenuBar ##### -->
|
||||
<para>
|
||||
The #GtkMenuBar struct contains the following fields. (These fields should be considered read-only. They should never be set by an application.)
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GtkMenuBar:child-pack-direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkMenuBar:pack-direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkMenuBar:internal-padding ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkMenuBar:shadow-type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_bar_new ##### -->
|
||||
<para>
|
||||
Creates the new #GtkMenuBar
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns: the #GtkMenuBar
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkPackDirection ##### -->
|
||||
<para>
|
||||
Determines how widgets should be packed insided menubars and
|
||||
menuitems contained in menubars.
|
||||
</para>
|
||||
|
||||
@GTK_PACK_DIRECTION_LTR: Widgets are packed left-to-right.
|
||||
@GTK_PACK_DIRECTION_RTL: Widgets are packed right-to-left.
|
||||
@GTK_PACK_DIRECTION_TTB: Widgets are packed top-to-bottom.
|
||||
@GTK_PACK_DIRECTION_BTT: Widgets are packed bottom-to-top.
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_bar_set_pack_direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menubar:
|
||||
@pack_dir:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_bar_get_pack_direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menubar:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_bar_set_child_pack_direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menubar:
|
||||
@child_pack_dir:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_bar_get_child_pack_direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menubar:
|
||||
@Returns:
|
||||
|
||||
|
@ -1,224 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkMenuShell
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A base class for menu objects
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkMenuShell is the abstract base class used to derive the
|
||||
#GtkMenu and #GtkMenuBar subclasses.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A #GtkMenuShell is a container of #GtkMenuItem objects arranged in a
|
||||
list which can be navigated, selected, and activated by the user to perform
|
||||
application functions. A #GtkMenuItem can have a submenu associated with it,
|
||||
allowing for nested hierarchical menus.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkMenuShell ##### -->
|
||||
<para>
|
||||
The #GtkMenuShell-struct struct contains the following fields.
|
||||
(These fields should be considered read-only. They should never be set by
|
||||
an application.)
|
||||
|
||||
<informaltable pgwide="1" frame="none" role="struct">
|
||||
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
|
||||
<tbody>
|
||||
|
||||
<row>
|
||||
<entry>#GList *children;</entry>
|
||||
<entry>The list of #GtkMenuItem objects contained by this #GtkMenuShell.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody></tgroup></informaltable>
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::activate-current ##### -->
|
||||
<para>
|
||||
An action signal that activates the current menu item within the menu
|
||||
shell.
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
@force_hide: if TRUE, hide the menu after activating the menu item.
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::cancel ##### -->
|
||||
<para>
|
||||
An action signal which cancels the selection within the menu shell.
|
||||
Causes the GtkMenuShell::selection-done signal to be emitted.
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::cycle-focus ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::deactivate ##### -->
|
||||
<para>
|
||||
This signal is emitted when a menu shell is deactivated.
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::move-current ##### -->
|
||||
<para>
|
||||
An action signal which moves the current menu item in the direction
|
||||
specified by @direction.
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
@direction: the direction to move.
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::move-selected ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuShell::selection-done ##### -->
|
||||
<para>
|
||||
This signal is emitted when a selection has been completed within a menu
|
||||
shell.
|
||||
</para>
|
||||
|
||||
@menushell: the object which received the signal.
|
||||
|
||||
<!-- ##### ARG GtkMenuShell:take-focus ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_append ##### -->
|
||||
<para>
|
||||
Adds a new #GtkMenuItem to the end of the menu shell's item list.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
@child: The #GtkMenuItem to add.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_prepend ##### -->
|
||||
<para>
|
||||
Adds a new #GtkMenuItem to the beginning of the menu shell's item list.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
@child: The #GtkMenuItem to add.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_insert ##### -->
|
||||
<para>
|
||||
Adds a new #GtkMenuItem to the menu shell's item list at the position
|
||||
indicated by @position.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
@child: The #GtkMenuItem to add.
|
||||
@position: The position in the item list where @child is added.
|
||||
Positions are numbered from 0 to n-1.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_deactivate ##### -->
|
||||
<para>
|
||||
Deactivates the menu shell. Typically this results in the menu shell
|
||||
being erased from the screen.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_select_item ##### -->
|
||||
<para>
|
||||
Selects the menu item from the menu shell.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
@menu_item: The #GtkMenuItem to select.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_select_first ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menu_shell:
|
||||
@search_sensitive:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_deselect ##### -->
|
||||
<para>
|
||||
Deselects the currently selected item from the menu shell, if any.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_activate_item ##### -->
|
||||
<para>
|
||||
Activates the menu item within the menu shell.
|
||||
</para>
|
||||
|
||||
@menu_shell: a #GtkMenuShell.
|
||||
@menu_item: The #GtkMenuItem to activate.
|
||||
@force_deactivate: If TRUE, force the deactivation of the menu shell
|
||||
after the menu item is activated.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_cancel ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menu_shell:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_set_take_focus ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menu_shell:
|
||||
@take_focus:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_shell_get_take_focus ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@menu_shell:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkMenuDirectionType ##### -->
|
||||
<para>
|
||||
An enumeration representing directional movements within a menu.
|
||||
</para>
|
||||
|
||||
@GTK_MENU_DIR_PARENT: To the parent menu shell.
|
||||
@GTK_MENU_DIR_CHILD: To the submenu, if any, associated with the item.
|
||||
@GTK_MENU_DIR_NEXT: To the next menu item.
|
||||
@GTK_MENU_DIR_PREV: To the previous menu item.
|
||||
|
@ -1,186 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkPrintJob
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Represents a print job
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkPrintJob object represents a job that is sent to a
|
||||
printer. You only need to deal directly with print jobs if
|
||||
you use the non-portable #GtkPrintUnixDialog API.
|
||||
</para>
|
||||
<para>
|
||||
Use gtk_print_job_get_surface() to obtain the cairo surface
|
||||
onto which the pages must be drawn. Use gtk_print_job_send()
|
||||
to send the finished job to the printer. If you don't use cairo
|
||||
#GtkPrintJob also supports printing of manually generated postscript,
|
||||
via gtk_print_job_set_source_file().
|
||||
<!-- FIXME more details needed here -->
|
||||
</para>
|
||||
<!-- FIXME examples ? -->
|
||||
|
||||
<para>
|
||||
Printing support was added in GTK+ 2.10.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkPrintJob ##### -->
|
||||
<para>
|
||||
The GtkPrintJob struct contains only private members
|
||||
and should not be directly accessed.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkPrintJob::status-changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@printjob: the object which received the signal.
|
||||
|
||||
<!-- ##### ARG GtkPrintJob:page-setup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintJob:printer ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintJob:settings ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintJob:title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintJob:track-print-status ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkPrintJobCompleteFunc ##### -->
|
||||
<para>
|
||||
The type of callback that is passed to gtk_print_job_send().
|
||||
It is called when the print job has been completely sent.
|
||||
</para>
|
||||
|
||||
@print_job: the #GtkPrintJob
|
||||
@user_data: user data that has been passed to gtk_print_job_send()
|
||||
@error: a #GError that contains error information if the sending
|
||||
of the print job failed, otherwise %NULL
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@title:
|
||||
@printer:
|
||||
@settings:
|
||||
@page_setup:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_get_settings ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_get_printer ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_get_title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_get_status ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_set_source_file ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@filename:
|
||||
@error:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_get_surface ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@error:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_send ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@callback:
|
||||
@user_data:
|
||||
@dnotify:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_set_track_print_status ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@track_status:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_job_get_track_print_status ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@job:
|
||||
@Returns:
|
||||
|
||||
|
@ -1,542 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Selections
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Functions for handling inter-process communication via selections
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
|
||||
<para>
|
||||
The selection mechanism provides the basis for different types
|
||||
of communication between processes. In particular, drag and drop and
|
||||
#GtkClipboard work via selections. You will very seldom or
|
||||
never need to use most of the functions in this section directly;
|
||||
#GtkClipboard provides a nicer interface to the same functionality.
|
||||
</para>
|
||||
<para>
|
||||
Some of the datatypes defined this section are used in
|
||||
the #GtkClipboard and drag-and-drop API's as well. The
|
||||
#GtkTargetEntry structure and #GtkTargetList objects represent
|
||||
lists of data types that are supported when sending or
|
||||
receiving data. The #GtkSelectionData object is used to
|
||||
store a chunk of data along with the data type and other
|
||||
associated information.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkWidget</term>
|
||||
<listitem><para>Much of the operation of selections happens via
|
||||
signals for #GtkWidget. In particular, if you are
|
||||
using the functions in this section, you may need
|
||||
to pay attention to ::selection_get,
|
||||
::selection_received, and :selection_clear_event
|
||||
signals.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTargetEntry ##### -->
|
||||
<para>
|
||||
A #GtkTargetEntry structure represents a single type of
|
||||
data than can be supplied for by a widget for a selection
|
||||
or for supplied or received during drag-and-drop. It
|
||||
contains a string representing the drag type, a flags
|
||||
field (used only for drag and drop - see #GtkTargetFlags),
|
||||
and an application assigned integer ID. The integer
|
||||
ID will later be passed as a signal parameter for signals
|
||||
like "selection_get". It allows the application to identify
|
||||
the target type without extensive string compares.
|
||||
</para>
|
||||
|
||||
@target:
|
||||
@flags:
|
||||
@info:
|
||||
|
||||
<!-- ##### STRUCT GtkTargetList ##### -->
|
||||
<para>
|
||||
A #GtkTargetList structure is a reference counted list
|
||||
of #GtkTargetPair. It is used to represent the same
|
||||
information as a table of #GtkTargetEntry, but in
|
||||
an efficient form. This structure should be treated as
|
||||
opaque.
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@ref_count:
|
||||
|
||||
<!-- ##### STRUCT GtkTargetPair ##### -->
|
||||
<para>
|
||||
Internally used structure in the drag-and-drop and
|
||||
selection handling code.
|
||||
</para>
|
||||
|
||||
@target:
|
||||
@flags:
|
||||
@info:
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_entry_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@target:
|
||||
@flags:
|
||||
@info:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_entry_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_entry_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_new ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@targets:
|
||||
@ntargets:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_ref ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_unref ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@list:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_add ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@target:
|
||||
@flags:
|
||||
@info:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_add_table ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@targets:
|
||||
@ntargets:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_add_text_targets ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@info:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_add_image_targets ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@info:
|
||||
@writable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_add_uri_targets ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@info:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_add_rich_text_targets ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@info:
|
||||
@deserializable:
|
||||
@buffer:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_remove ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@target:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_list_find ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@target:
|
||||
@info:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_table_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@targets:
|
||||
@n_targets:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_target_table_new_from_list ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@n_targets:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_owner_set ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@selection:
|
||||
@time_:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_owner_set_for_display ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@display:
|
||||
@widget:
|
||||
@selection:
|
||||
@time_:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_add_target ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@selection:
|
||||
@target:
|
||||
@info:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_add_targets ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@selection:
|
||||
@targets:
|
||||
@ntargets:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_clear_targets ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_convert ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@selection:
|
||||
@target:
|
||||
@time_:
|
||||
@Returns: x
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_set ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@type:
|
||||
@format:
|
||||
@data:
|
||||
@length:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_set_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@str:
|
||||
@len:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_set_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_set_uris ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@uris:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_uris ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_targets ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@targets:
|
||||
@n_atoms:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_targets_include_image ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@writable:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_targets_include_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_targets_include_uri ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_targets_include_rich_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_data ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_data_type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_display ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_format ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_get_target ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_targets_include_image ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@targets:
|
||||
@n_targets:
|
||||
@writable:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_targets_include_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@targets:
|
||||
@n_targets:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_targets_include_uri ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@targets:
|
||||
@n_targets:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_targets_include_rich_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@targets:
|
||||
@n_targets:
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_remove_all ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_copy ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_selection_data_free ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@data:
|
||||
|
||||
|
@ -1,498 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTextTag
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A tag that can be applied to text in a GtkTextBuffer
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
You may wish to begin by reading the <link linkend="TextWidget">text widget
|
||||
conceptual overview</link> which gives an overview of all the objects and data
|
||||
types related to the text widget and how they work together.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Tags should be in the #GtkTextTagTable for a given #GtkTextBuffer
|
||||
before using them with that buffer.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
gtk_text_buffer_create_tag() is the best way to create tags.
|
||||
See <application>gtk-demo</application> for numerous examples.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The "invisible" property was not implemented for GTK+ 2.0.
|
||||
It is working (with minor issues) since 2.8.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTextTag ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkTextTag::event ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@texttag: the object which received the signal.
|
||||
@arg1:
|
||||
@event:
|
||||
@arg2:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### ARG GtkTextTag:accumulative-margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:background ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:background-full-height ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:background-full-height-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:background-gdk ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:background-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:direction ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:editable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:editable-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:family ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:family-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:font ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:font-desc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:foreground ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:foreground-gdk ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:foreground-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:indent ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:indent-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:invisible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:invisible-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:justification ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:justification-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:language ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:language-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:left-margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:left-margin-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:paragraph-background ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:paragraph-background-gdk ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:paragraph-background-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:pixels-above-lines ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:pixels-above-lines-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:pixels-below-lines ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:pixels-below-lines-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:pixels-inside-wrap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:pixels-inside-wrap-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:right-margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:right-margin-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:rise ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:rise-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:scale ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:scale-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:size-points ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:size-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:stretch ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:stretch-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:strikethrough ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:strikethrough-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:style-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:tabs ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:tabs-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:underline ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:underline-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:variant ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:variant-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:weight ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:weight-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:wrap-mode ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTextTag:wrap-mode-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ENUM GtkWrapMode ##### -->
|
||||
<para>
|
||||
Describes a type of line wrapping.
|
||||
</para>
|
||||
|
||||
@GTK_WRAP_NONE: do not wrap lines; just make the text area wider
|
||||
@GTK_WRAP_CHAR: wrap text, breaking lines anywhere the cursor can
|
||||
appear (between characters, usually - if you want to
|
||||
be technical, between graphemes, see
|
||||
pango_get_log_attrs())
|
||||
@GTK_WRAP_WORD: wrap text, breaking lines in between words
|
||||
@GTK_WRAP_WORD_CHAR: wrap text, breaking lines in between words, or if
|
||||
that is not enough, also between graphemes.
|
||||
|
||||
<!-- ##### STRUCT GtkTextAttributes ##### -->
|
||||
<para>
|
||||
Using #GtkTextAttributes directly should rarely be necessary. It's
|
||||
primarily useful with gtk_text_iter_get_attributes(). As with most
|
||||
GTK+ structs, the fields in this struct should only be read, never
|
||||
modified directly.
|
||||
</para>
|
||||
|
||||
@appearance: pointer to sub-struct containing certain attributes
|
||||
@justification:
|
||||
@direction:
|
||||
@font:
|
||||
@font_scale:
|
||||
@left_margin:
|
||||
@indent:
|
||||
@right_margin:
|
||||
@pixels_above_lines:
|
||||
@pixels_below_lines:
|
||||
@pixels_inside_wrap:
|
||||
@tabs:
|
||||
@wrap_mode:
|
||||
@language:
|
||||
@invisible:
|
||||
@bg_full_height:
|
||||
@editable:
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_tag_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_tag_get_priority ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tag:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_tag_set_priority ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tag:
|
||||
@priority:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_tag_event ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tag:
|
||||
@event_object:
|
||||
@event:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTextAppearance ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bg_color:
|
||||
@fg_color:
|
||||
@rise:
|
||||
@underline:
|
||||
@strikethrough:
|
||||
@draw_bg:
|
||||
@inside_selection:
|
||||
@is_text:
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_attributes_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_attributes_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_attributes_copy_values ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@dest:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_attributes_unref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@values:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_attributes_ref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@values:
|
||||
@Returns:
|
||||
|
||||
|
@ -1,864 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTreeModel
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
The tree interface used by GtkTreeView
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkTreeModel interface defines a generic tree interface for use by
|
||||
the #GtkTreeView widget. It is an abstract interface, and is designed
|
||||
to be usable with any appropriate data structure. The programmer just
|
||||
has to implement this interface on their own data type for it to be
|
||||
viewable by a #GtkTreeView widget.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The model is represented as a hierarchical tree of strongly-typed,
|
||||
columned data. In other words, the model can be seen as a tree where
|
||||
every node has different values depending on which column is being
|
||||
queried. The type of data found in a column is determined by using the
|
||||
GType system (ie. #G_TYPE_INT, #GTK_TYPE_BUTTON, #G_TYPE_POINTER, etc.).
|
||||
The types are homogeneous per column across all nodes. It is important
|
||||
to note that this interface only provides a way of examining a model and
|
||||
observing changes. The implementation of each individual model decides
|
||||
how and if changes are made.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In order to make life simpler for programmers who do not need to write
|
||||
their own specialized model, two generic models are provided — the
|
||||
#GtkTreeStore and the #GtkListStore. To use these, the developer simply
|
||||
pushes data into these models as necessary. These models provide the
|
||||
data structure as well as all appropriate tree interfaces. As a result,
|
||||
implementing drag and drop, sorting, and storing data is trivial. For
|
||||
the vast majority of trees and lists, these two models are sufficient.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Models are accessed on a node/column level of granularity. One can
|
||||
query for the value of a model at a certain node and a certain column
|
||||
on that node. There are two structures used to reference a particular
|
||||
node in a model. They are the #GtkTreePath and the #GtkTreeIter
|
||||
<footnote>
|
||||
<para>
|
||||
Here, <abbrev>iter</abbrev> is short for <quote>iterator</quote>
|
||||
</para>
|
||||
</footnote>
|
||||
Most of the interface consists of operations on a #GtkTreeIter.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A path is essentially a potential node. It is a location on a model
|
||||
that may or may not actually correspond to a node on a specific model.
|
||||
The #GtkTreePath struct can be converted into either an array of
|
||||
unsigned integers or a string. The string form is a list of numbers
|
||||
separated by a colon. Each number refers to the offset at that level.
|
||||
Thus, the path <quote>0</quote> refers to the root node and the path
|
||||
<quote>2:4</quote> refers to the fifth child of the third node.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By contrast, a #GtkTreeIter is a reference to a specific node on a
|
||||
specific model. It is a generic struct with an integer and three
|
||||
generic pointers. These are filled in by the model in a model-specific
|
||||
way. One can convert a path to an iterator by calling
|
||||
gtk_tree_model_get_iter(). These iterators are the primary way of
|
||||
accessing a model and are similar to the iterators used by
|
||||
#GtkTextBuffer. They are generally statically allocated on the stack and
|
||||
only used for a short time. The model interface defines a set of
|
||||
operations using them for navigating the model.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is expected that models fill in the iterator with private data. For
|
||||
example, the #GtkListStore model, which is internally a simple linked
|
||||
list, stores a list node in one of the pointers. The #GtkTreeModelSort
|
||||
stores an array and an offset in two of the pointers. Additionally,
|
||||
there is an integer field. This field is generally filled with a unique
|
||||
stamp per model. This stamp is for catching errors resulting from using
|
||||
invalid iterators with a model.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The lifecycle of an iterator can be a little confusing at first.
|
||||
Iterators are expected to always be valid for as long as the model is
|
||||
unchanged (and doesn't emit a signal). The model is considered to own
|
||||
all outstanding iterators and nothing needs to be done to free them from
|
||||
the user's point of view. Additionally, some models guarantee that an
|
||||
iterator is valid for as long as the node it refers to is valid (most
|
||||
notably the #GtkTreeStore and #GtkListStore). Although generally
|
||||
uninteresting, as one always has to allow for the case where iterators
|
||||
do not persist beyond a signal, some very important performance
|
||||
enhancements were made in the sort model. As a result, the
|
||||
#GTK_TREE_MODEL_ITERS_PERSIST flag was added to indicate this behavior.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To help show some common operation of a model, some examples are
|
||||
provided. The first example shows three ways of getting the iter at the
|
||||
location <quote>3:2:5</quote>. While the first method shown is easier,
|
||||
the second is much more common, as you often get paths from callbacks.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Acquiring a <structname>GtkTreeIter</structname></title>
|
||||
<programlisting>
|
||||
/* Three ways of getting the iter pointing to the location
|
||||
*/
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter parent_iter;
|
||||
|
||||
/* get the iterator from a string */
|
||||
gtk_tree_model_get_iter_from_string (model, &iter, "3:2:5");
|
||||
|
||||
/* get the iterator from a path */
|
||||
path = gtk_tree_path_new_from_string ("3:2:5");
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
|
||||
/* walk the tree to find the iterator */
|
||||
gtk_tree_model_iter_nth_child (model, &iter, NULL, 3);
|
||||
parent_iter = iter;
|
||||
gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 2);
|
||||
parent_iter = iter;
|
||||
gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 5);
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This second example shows a quick way of iterating through a list and
|
||||
getting a string and an integer from each row. The
|
||||
<function>populate_model</function> function used below is not shown, as
|
||||
it is specific to the #GtkListStore. For information on how to write
|
||||
such a function, see the #GtkListStore documentation.
|
||||
<example>
|
||||
<title>Reading data from a <structname>GtkTreeModel</structname></title>
|
||||
<programlisting>
|
||||
enum
|
||||
{
|
||||
STRING_COLUMN,
|
||||
INT_COLUMN,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
{
|
||||
GtkTreeModel *list_store;
|
||||
GtkTreeIter iter;
|
||||
gboolean valid;
|
||||
gint row_count = 0;
|
||||
|
||||
/* make a new list_store */
|
||||
list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
||||
|
||||
/* Fill the list store with data */
|
||||
populate_model (list_store);
|
||||
|
||||
/* Get the first iter in the list */
|
||||
valid = gtk_tree_model_get_iter_first (list_store, &iter);
|
||||
|
||||
while (valid)
|
||||
{
|
||||
/* Walk through the list, reading each row */
|
||||
gchar *str_data;
|
||||
gint int_data;
|
||||
|
||||
/* Make sure you terminate calls to gtk_tree_model_get(<!-- -->)
|
||||
* with a '-1' value
|
||||
*/
|
||||
gtk_tree_model_get (list_store, &iter,
|
||||
STRING_COLUMN, &str_data,
|
||||
INT_COLUMN, &int_data,
|
||||
-1);
|
||||
|
||||
/* Do something with the data */
|
||||
g_print ("Row %d: (%s,%d)\n", row_count, str_data, int_data);
|
||||
g_free (str_data);
|
||||
|
||||
row_count ++;
|
||||
valid = gtk_tree_model_iter_next (list_store, &iter);
|
||||
}
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkTreeView, #GtkTreeStore, #GtkListStore, <link linkend="gtk-GtkTreeView-drag-and-drop">GtkTreeDnd</link>, #GtkTreeSortable
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeModel ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeModel::row-changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treemodel: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeModel::row-deleted ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treemodel: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeModel::row-has-child-toggled ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treemodel: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeModel::row-inserted ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treemodel: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeModel::rows-reordered ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treemodel: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
@arg3:
|
||||
|
||||
<!-- ##### STRUCT GtkTreeIter ##### -->
|
||||
<para>
|
||||
The <structname>GtkTreeIter</structname> is the primary structure for
|
||||
accessing a structure. Models are expected to put a unique integer in
|
||||
the <structfield>stamp</structfield> member, and put model-specific
|
||||
data in the three <structfield>user_data</structfield> members.
|
||||
</para>
|
||||
|
||||
@stamp: A unique stamp to catch invalid iterators
|
||||
@user_data: Model specific data
|
||||
@user_data2: Model specific data
|
||||
@user_data3: Model specific data
|
||||
|
||||
<!-- ##### STRUCT GtkTreePath ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeRowReference ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeModelIface ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@g_iface:
|
||||
@row_changed:
|
||||
@row_inserted:
|
||||
@row_has_child_toggled:
|
||||
@row_deleted:
|
||||
@rows_reordered:
|
||||
@get_flags:
|
||||
@get_n_columns:
|
||||
@get_column_type:
|
||||
@get_iter:
|
||||
@get_path:
|
||||
@get_value:
|
||||
@iter_next:
|
||||
@iter_children:
|
||||
@iter_has_child:
|
||||
@iter_n_children:
|
||||
@iter_nth_child:
|
||||
@iter_parent:
|
||||
@ref_node:
|
||||
@unref_node:
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeModelForeachFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@model: The #GtkTreeModel currently being iterated
|
||||
@path: The current #GtkTreePath
|
||||
@iter: The current #GtkTreeIter
|
||||
@data: The user data passed to gtk_tree_model_foreach()
|
||||
@Returns: %TRUE to stop iterating, %FALSE to continue.
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkTreeModelFlags ##### -->
|
||||
<para>
|
||||
These flags indicate various properties of a #GtkTreeModel. They are
|
||||
returned by gtk_tree_model_get_flags(), and must be static for the
|
||||
lifetime of the object. A more complete description of
|
||||
#GTK_TREE_MODEL_ITERS_PERSIST can be found in the overview of this
|
||||
section.
|
||||
</para>
|
||||
|
||||
@GTK_TREE_MODEL_ITERS_PERSIST: Iterators survive all signals emitted by the tree.
|
||||
@GTK_TREE_MODEL_LIST_ONLY: The model is a list only, and never has children
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_new_from_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_new_from_indices ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@first_index:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_to_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_new_first ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_append_index ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@index_:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_prepend_index ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@index_:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_get_depth ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_get_indices ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_get_indices_with_depth ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@depth:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_compare ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@a:
|
||||
@b:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_next ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_prev ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_up ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_down ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_is_ancestor ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@descendant:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_path_is_descendant ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@path:
|
||||
@ancestor:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@model:
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_new_proxy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@proxy:
|
||||
@model:
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_get_model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@reference:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_get_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@reference:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_valid ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@reference:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@reference:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@reference:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_inserted ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@proxy:
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_deleted ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@proxy:
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_row_reference_reordered ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@proxy:
|
||||
@path:
|
||||
@iter:
|
||||
@new_order:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_iter_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_iter_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_flags ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_n_columns ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_column_type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@index_:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_iter_from_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@path_string:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_iter_first ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_value ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@column:
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_iter_next ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_iter_children ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@parent:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_iter_has_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_iter_n_children ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_iter_nth_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@parent:
|
||||
@n:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_iter_parent ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_string_from_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_ref_node ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_unref_node ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@Varargs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_get_valist ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@iter:
|
||||
@var_args:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_foreach ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@model:
|
||||
@func:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_row_changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@path:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_row_inserted ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@path:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_row_has_child_toggled ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@path:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_row_deleted ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_rows_reordered ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_model:
|
||||
@path:
|
||||
@iter:
|
||||
@new_order:
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="TreeWidget" revision="20 Mar 2002">
|
||||
<refentry id="TreeWidget">
|
||||
<refmeta>
|
||||
<refentrytitle>Tree and List Widget Overview</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-windows" revision="4 Feb 2001">
|
||||
<refentry id="gtk-windows">
|
||||
<refmeta>
|
||||
<refentrytitle>Using GTK+ on Windows</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-x11" revision="17 Jan 2002">
|
||||
<refentry id="gtk-x11">
|
||||
<refmeta>
|
||||
<refentrytitle>Using GTK+ on the X Window System</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
|
@ -3,7 +3,8 @@ include $(top_srcdir)/Makefile.decl
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
INTROSPECTION_GIRS =
|
||||
INTROSPECTION_SCANNER_ARGS = \
|
||||
--add-include-path=../gdk
|
||||
--add-include-path=../gdk \
|
||||
--warn-all
|
||||
INTROSPECTION_COMPILER_ARGS = \
|
||||
--includedir=$(srcdir) \
|
||||
--includedir=.
|
||||
@ -184,11 +185,13 @@ introspection_files = \
|
||||
gdkenumtypes.h
|
||||
|
||||
Gdk-3.0.gir: libgdk-3.0.la Makefile
|
||||
Gdk_3_0_gir_SCANNERFLAGS = --warn-all --c-include="gdk/gdk.h"
|
||||
Gdk_3_0_gir_SCANNERFLAGS = \
|
||||
--c-include="gdk/gdk.h"
|
||||
Gdk_3_0_gir_INCLUDES = Gio-2.0 GdkPixbuf-2.0 Pango-1.0 cairo-1.0
|
||||
Gdk_3_0_gir_LIBS = libgdk-3.0.la
|
||||
Gdk_3_0_gir_FILES = $(introspection_files)
|
||||
Gdk_3_0_gir_CFLAGS = $(INCLUDES)
|
||||
Gdk_3_0_gir_EXPORT_PACKAGES = gdk-3.0
|
||||
INTROSPECTION_GIRS += Gdk-3.0.gir
|
||||
|
||||
if USE_X11
|
||||
@ -233,11 +236,15 @@ x11_introspection_files = \
|
||||
x11/gdkx11window.h
|
||||
|
||||
GdkX11-3.0.gir: libgdk-3.0.la Gdk-3.0.gir Makefile
|
||||
GdkX11_3_0_gir_SCANNERFLAGS = --warn-all --strip-prefix=Gdk --c-include="gdk/gdkx.h"
|
||||
GdkX11_3_0_gir_SCANNERFLAGS = \
|
||||
--strip-prefix=Gdk \
|
||||
--c-include="gdk/gdkx.h" \
|
||||
--include-uninstalled=$(top_builddir)/gdk/Gdk-3.0.gir
|
||||
GdkX11_3_0_gir_INCLUDES = Gio-2.0 Gdk-3.0 GdkPixbuf-2.0 Pango-1.0 xlib-2.0
|
||||
GdkX11_3_0_gir_LIBS = libgdk-3.0.la
|
||||
GdkX11_3_0_gir_FILES = $(x11_introspection_files)
|
||||
GdkX11_3_0_gir_CFLAGS = $(INCLUDES) -L$(top_builddir)/gdk
|
||||
GdkX11_3_0_gir_EXPORT_PACKAGES = gdk-x11-3.0
|
||||
INTROSPECTION_GIRS += GdkX11-3.0.gir
|
||||
|
||||
endif # USE_X11
|
||||
|
@ -779,7 +779,7 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
impl_class->set_functions = NULL;
|
||||
impl_class->begin_resize_drag = NULL;
|
||||
impl_class->begin_move_drag = NULL;
|
||||
impl_class->enable_synchronized_configure = NULL;
|
||||
impl_class->enable_synchronized_configure = gdk_offscreen_window_do_nothing;
|
||||
impl_class->configure_finished = NULL;
|
||||
impl_class->set_opacity = NULL;
|
||||
impl_class->set_composited = NULL;
|
||||
|
@ -3,7 +3,8 @@ include $(top_srcdir)/Makefile.decl
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
INTROSPECTION_GIRS =
|
||||
INTROSPECTION_SCANNER_ARGS = \
|
||||
--add-include-path=../gdk
|
||||
--add-include-path=../gdk \
|
||||
--warn-all
|
||||
INTROSPECTION_COMPILER_ARGS = \
|
||||
--includedir=$(srcdir) \
|
||||
--includedir=. \
|
||||
@ -968,7 +969,9 @@ introspection_files = \
|
||||
gtktypebuiltins.c
|
||||
|
||||
Gtk-3.0.gir: $(INTROSPECTION_SCANNER) libgtk-3.0.la $(top_builddir)/gdk/Gdk-3.0.gir Makefile
|
||||
Gtk_3_0_gir_SCANNERFLAGS = --warn-all --add-include-path=$(top_builddir)/gdk
|
||||
Gtk_3_0_gir_SCANNERFLAGS = \
|
||||
--add-include-path=$(top_builddir)/gdk \
|
||||
--include-uninstalled=$(top_builddir)/gdk/Gdk-3.0.gir
|
||||
if USE_X11
|
||||
Gtk_3_0_gir_SCANNERFLAGS += --add-include-path=$(top_builddir)/gdk/x11
|
||||
endif
|
||||
@ -981,6 +984,7 @@ Gtk_3_0_gir_CFLAGS = \
|
||||
-DGTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
|
||||
Gtk_3_0_gir_LIBS = libgtk-3.0.la
|
||||
Gtk_3_0_gir_FILES = $(introspection_files)
|
||||
Gtk_3_0_gir_EXPORT_PACKAGES = gtk+-3.0
|
||||
INTROSPECTION_GIRS += Gtk-3.0.gir
|
||||
|
||||
girdir = $(datadir)/gir-1.0
|
||||
@ -996,8 +1000,11 @@ endif
|
||||
# Installed tools
|
||||
#
|
||||
bin_PROGRAMS = \
|
||||
gtk-query-immodules-3.0 \
|
||||
gtk-update-icon-cache
|
||||
gtk-query-immodules-3.0
|
||||
|
||||
if BUILD_ICON_CACHE
|
||||
bin_PROGRAMS += gtk-update-icon-cache
|
||||
endif
|
||||
|
||||
bin_SCRIPTS = gtk-builder-convert
|
||||
|
||||
@ -1038,8 +1045,10 @@ gtk_query_immodules_3_0_DEPENDENCIES = $(DEPS)
|
||||
gtk_query_immodules_3_0_LDADD = $(LDADDS)
|
||||
gtk_query_immodules_3_0_SOURCES = queryimmodules.c
|
||||
|
||||
if BUILD_ICON_CACHE
|
||||
gtk_update_icon_cache_LDADD = $(GDK_PIXBUF_LIBS)
|
||||
gtk_update_icon_cache_SOURCES = updateiconcache.c
|
||||
endif
|
||||
|
||||
.PHONY: files test test-debug
|
||||
|
||||
@ -1332,11 +1341,10 @@ stamp-icons: $(STOCK_ICONS)
|
||||
) done \
|
||||
&& touch stamp-icons
|
||||
|
||||
if CROSS_COMPILING
|
||||
if USE_EXTERNAL_ICON_CACHE
|
||||
gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
|
||||
else
|
||||
gtk_update_icon_cache_program = \
|
||||
./gtk-update-icon-cache
|
||||
gtk_update_icon_cache_program = ./gtk-update-icon-cache
|
||||
endif
|
||||
|
||||
gtkbuiltincache.h: @REBUILD@ stamp-icons
|
||||
|
@ -146,8 +146,9 @@ def copy_properties(node, props, prop_dict):
|
||||
|
||||
class GtkBuilderConverter(object):
|
||||
|
||||
def __init__(self, skip_windows, root):
|
||||
def __init__(self, skip_windows, target_version, root):
|
||||
self.skip_windows = skip_windows
|
||||
self.target_version = target_version
|
||||
self.root = root
|
||||
self.root_objects = []
|
||||
self.objects = {}
|
||||
@ -295,6 +296,25 @@ class GtkBuilderConverter(object):
|
||||
self._convert_menu(node, popup=True)
|
||||
elif klass in WINDOWS and self.skip_windows:
|
||||
self._remove_window(node)
|
||||
|
||||
if self.target_version == "3.0":
|
||||
if klass == "GtkComboBoxEntry":
|
||||
node.setAttribute("class","GtkComboBox")
|
||||
prop = self._dom.createElement("property")
|
||||
prop.setAttribute("name", "has-entry")
|
||||
prop.appendChild(self._dom.createTextNode("True"))
|
||||
node.appendChild(prop)
|
||||
elif klass == "GtkDialog":
|
||||
for child in node.childNodes:
|
||||
if child.nodeType != Node.ELEMENT_NODE:
|
||||
continue
|
||||
if child.tagName != 'property':
|
||||
continue
|
||||
if (child.getAttribute("name") not in ("has-separator", "has_separator")):
|
||||
continue;
|
||||
node.removeChild(child)
|
||||
break
|
||||
|
||||
self._default_widget_converter(node)
|
||||
|
||||
def _default_widget_converter(self, node):
|
||||
@ -732,7 +752,10 @@ def usage():
|
||||
def main(args):
|
||||
try:
|
||||
opts, args = getopt.getopt(args[1:], "hwr:",
|
||||
["help", "skip-windows", "root="])
|
||||
["help",
|
||||
"skip-windows",
|
||||
"target-version=",
|
||||
"root="])
|
||||
except getopt.GetoptError:
|
||||
usage()
|
||||
return 2
|
||||
@ -746,6 +769,7 @@ def main(args):
|
||||
skip_windows = False
|
||||
split = False
|
||||
root = None
|
||||
target_version = "3.0"
|
||||
for o, a in opts:
|
||||
if o in ("-h", "--help"):
|
||||
usage()
|
||||
@ -754,8 +778,11 @@ def main(args):
|
||||
root = a
|
||||
elif o in ("-w", "--skip-windows"):
|
||||
skip_windows = True
|
||||
elif o in ("-t", "--target-version"):
|
||||
target_version = a
|
||||
|
||||
conv = GtkBuilderConverter(skip_windows=skip_windows,
|
||||
target_version=target_version,
|
||||
root=root)
|
||||
conv.parse_file(input_filename)
|
||||
|
||||
|
@ -3660,6 +3660,7 @@ _gtk_cell_area_set_cell_data_func_with_proxy (GtkCellArea *area,
|
||||
else
|
||||
{
|
||||
info = cell_info_new ((GtkCellLayoutDataFunc)func, func_data, destroy);
|
||||
info->proxy = proxy;
|
||||
|
||||
g_hash_table_insert (priv->cell_info, cell, info);
|
||||
}
|
||||
|
@ -1064,6 +1064,7 @@ gtk_cell_area_box_set_property (GObject *object,
|
||||
|
||||
/* Notify that size needs to be requested again */
|
||||
reset_contexts (box);
|
||||
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
gtk_cell_area_box_set_spacing (box, g_value_get_int (value));
|
||||
|
@ -93,6 +93,8 @@
|
||||
#include "gtkbuilderprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define warn_no_cell_area(func) \
|
||||
g_critical ("%s: Called but no GtkCellArea is available yet", func)
|
||||
|
||||
typedef GtkCellLayoutIface GtkCellLayoutInterface;
|
||||
G_DEFINE_INTERFACE (GtkCellLayout, gtk_cell_layout, G_TYPE_OBJECT);
|
||||
@ -134,7 +136,6 @@ gtk_cell_layout_default_init (GtkCellLayoutIface *iface)
|
||||
iface->get_cells = gtk_cell_layout_default_get_cells;
|
||||
}
|
||||
|
||||
|
||||
/* Default implementation is to fall back on an underlying cell area */
|
||||
static void
|
||||
gtk_cell_layout_default_pack_start (GtkCellLayout *cell_layout,
|
||||
@ -150,7 +151,10 @@ gtk_cell_layout_default_pack_start (GtkCellLayout *cell_layout,
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (area), cell, expand);
|
||||
if (area)
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (area), cell, expand);
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->pack_start()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +172,10 @@ gtk_cell_layout_default_pack_end (GtkCellLayout *cell_layout,
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (area), cell, expand);
|
||||
if (area)
|
||||
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (area), cell, expand);
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->pack_end()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +191,10 @@ gtk_cell_layout_default_clear (GtkCellLayout *cell_layout)
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (area));
|
||||
if (area)
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (area));
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->clear()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +213,10 @@ gtk_cell_layout_default_add_attribute (GtkCellLayout *cell_layout,
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (area), cell, attribute, column);
|
||||
if (area)
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (area), cell, attribute, column);
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->add_attribute()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,9 +236,12 @@ gtk_cell_layout_default_set_cell_data_func (GtkCellLayout *cell_layout,
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
_gtk_cell_area_set_cell_data_func_with_proxy (area, cell,
|
||||
(GFunc)func, func_data, destroy,
|
||||
cell_layout);
|
||||
if (area)
|
||||
_gtk_cell_area_set_cell_data_func_with_proxy (area, cell,
|
||||
(GFunc)func, func_data, destroy,
|
||||
cell_layout);
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->set_cell_data_func()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +258,10 @@ gtk_cell_layout_default_clear_attributes (GtkCellLayout *cell_layout,
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (area), cell);
|
||||
if (area)
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (area), cell);
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->clear_attributes()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +279,10 @@ gtk_cell_layout_default_reorder (GtkCellLayout *cell_layout,
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (area), cell, position);
|
||||
if (area)
|
||||
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (area), cell, position);
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->reorder()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +298,10 @@ gtk_cell_layout_default_get_cells (GtkCellLayout *cell_layout)
|
||||
{
|
||||
area = iface->get_area (cell_layout);
|
||||
|
||||
return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area));
|
||||
if (area)
|
||||
return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area));
|
||||
else
|
||||
warn_no_cell_area ("GtkCellLayoutIface->get_cells()");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1658,8 +1658,8 @@ gtk_cell_renderer_get_aligned_area (GtkCellRenderer *cell,
|
||||
klass = GTK_CELL_RENDERER_GET_CLASS (cell);
|
||||
klass->get_aligned_area (cell, widget, flags, cell_area, aligned_area);
|
||||
|
||||
g_assert (aligned_area->x >= cell_area->x && aligned_area->x < cell_area->x + cell_area->width);
|
||||
g_assert (aligned_area->y >= cell_area->y && aligned_area->y < cell_area->y + cell_area->height);
|
||||
g_assert (aligned_area->x >= cell_area->x && aligned_area->x <= cell_area->x + cell_area->width);
|
||||
g_assert (aligned_area->y >= cell_area->y && aligned_area->y <= cell_area->y + cell_area->height);
|
||||
g_assert ((aligned_area->x - cell_area->x) + aligned_area->width <= cell_area->width);
|
||||
g_assert ((aligned_area->y - cell_area->y) + aligned_area->height <= cell_area->height);
|
||||
}
|
||||
|
@ -167,14 +167,14 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
|
||||
* Since: 2.10
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_KEYCODE,
|
||||
g_param_spec_uint ("keycode",
|
||||
P_("Accelerator keycode"),
|
||||
P_("The hardware keycode of the accelerator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
PROP_KEYCODE,
|
||||
g_param_spec_uint ("keycode",
|
||||
P_("Accelerator keycode"),
|
||||
P_("The hardware keycode of the accelerator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkCellRendererAccel:accel-mode:
|
||||
@ -189,11 +189,11 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_ACCEL_MODE,
|
||||
g_param_spec_enum ("accel-mode",
|
||||
P_("Accelerator Mode"),
|
||||
P_("The type of accelerators"),
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL_MODE,
|
||||
GTK_CELL_RENDERER_ACCEL_MODE_GTK,
|
||||
GTK_PARAM_READWRITE));
|
||||
P_("Accelerator Mode"),
|
||||
P_("The type of accelerators"),
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL_MODE,
|
||||
GTK_CELL_RENDERER_ACCEL_MODE_GTK,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkCellRendererAccel::accel-edited:
|
||||
@ -208,16 +208,16 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
|
||||
* Since: 2.10
|
||||
*/
|
||||
signals[ACCEL_EDITED] = g_signal_new (I_("accel-edited"),
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_edited),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__STRING_UINT_FLAGS_UINT,
|
||||
G_TYPE_NONE, 4,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_UINT,
|
||||
GDK_TYPE_MODIFIER_TYPE,
|
||||
G_TYPE_UINT);
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_edited),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__STRING_UINT_FLAGS_UINT,
|
||||
G_TYPE_NONE, 4,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_UINT,
|
||||
GDK_TYPE_MODIFIER_TYPE,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* GtkCellRendererAccel::accel-cleared:
|
||||
@ -229,13 +229,13 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
|
||||
* Since: 2.10
|
||||
*/
|
||||
signals[ACCEL_CLEARED] = g_signal_new (I_("accel-cleared"),
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_cleared),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_cleared),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
g_type_class_add_private (cell_accel_class, sizeof (GtkCellRendererAccelPrivate));
|
||||
}
|
||||
@ -258,9 +258,9 @@ gtk_cell_renderer_accel_new (void)
|
||||
|
||||
static gchar *
|
||||
convert_keysym_state_to_string (GtkCellRendererAccel *accel,
|
||||
guint keysym,
|
||||
guint keysym,
|
||||
GdkModifierType mask,
|
||||
guint keycode)
|
||||
guint keycode)
|
||||
{
|
||||
GtkCellRendererAccelPrivate *priv = accel->priv;
|
||||
|
||||
@ -283,24 +283,24 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel,
|
||||
return gtk_accelerator_get_label (keysym, mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *name;
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
name = gtk_accelerator_get_label (keysym, mask);
|
||||
if (name == NULL)
|
||||
name = gtk_accelerator_name (keysym, mask);
|
||||
name = gtk_accelerator_get_label (keysym, mask);
|
||||
if (name == NULL)
|
||||
name = gtk_accelerator_name (keysym, mask);
|
||||
|
||||
if (keysym == 0)
|
||||
{
|
||||
gchar *tmp;
|
||||
if (keysym == 0)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
tmp = name;
|
||||
name = g_strdup_printf ("%s0x%02x", tmp, keycode);
|
||||
g_free (tmp);
|
||||
}
|
||||
tmp = name;
|
||||
name = g_strdup_printf ("%s0x%02x", tmp, keycode);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,36 +349,36 @@ gtk_cell_renderer_accel_set_property (GObject *object,
|
||||
{
|
||||
case PROP_ACCEL_KEY:
|
||||
{
|
||||
guint accel_key = g_value_get_uint (value);
|
||||
guint accel_key = g_value_get_uint (value);
|
||||
|
||||
if (priv->accel_key != accel_key)
|
||||
{
|
||||
priv->accel_key = accel_key;
|
||||
changed = TRUE;
|
||||
}
|
||||
if (priv->accel_key != accel_key)
|
||||
{
|
||||
priv->accel_key = accel_key;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ACCEL_MODS:
|
||||
{
|
||||
guint accel_mods = g_value_get_flags (value);
|
||||
guint accel_mods = g_value_get_flags (value);
|
||||
|
||||
if (priv->accel_mods != accel_mods)
|
||||
{
|
||||
priv->accel_mods = accel_mods;
|
||||
changed = TRUE;
|
||||
}
|
||||
if (priv->accel_mods != accel_mods)
|
||||
{
|
||||
priv->accel_mods = accel_mods;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_KEYCODE:
|
||||
{
|
||||
guint keycode = g_value_get_uint (value);
|
||||
guint keycode = g_value_get_uint (value);
|
||||
|
||||
if (priv->keycode != keycode)
|
||||
{
|
||||
priv->keycode = keycode;
|
||||
changed = TRUE;
|
||||
}
|
||||
if (priv->keycode != keycode)
|
||||
{
|
||||
priv->keycode = keycode;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -451,10 +451,10 @@ grab_key_callback (GtkWidget *widget,
|
||||
cleared = FALSE;
|
||||
|
||||
gdk_keymap_translate_keyboard_state (gdk_keymap_get_for_display (display),
|
||||
event->hardware_keycode,
|
||||
event->hardware_keycode,
|
||||
event->state,
|
||||
event->group,
|
||||
NULL, NULL, NULL, &consumed_modifiers);
|
||||
NULL, NULL, NULL, &consumed_modifiers);
|
||||
|
||||
accel_key = gdk_keyval_to_lower (event->keyval);
|
||||
if (accel_key == GDK_KEY_ISO_Left_Tab)
|
||||
@ -475,26 +475,26 @@ grab_key_callback (GtkWidget *widget,
|
||||
if (accel_mods == 0)
|
||||
{
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_KEY_Escape:
|
||||
goto out; /* cancel */
|
||||
case GDK_KEY_BackSpace:
|
||||
/* clear the accelerator on Backspace */
|
||||
cleared = TRUE;
|
||||
goto out;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
{
|
||||
case GDK_KEY_Escape:
|
||||
goto out; /* cancel */
|
||||
case GDK_KEY_BackSpace:
|
||||
/* clear the accelerator on Backspace */
|
||||
cleared = TRUE;
|
||||
goto out;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
{
|
||||
if (!gtk_accelerator_valid (accel_key, accel_mods))
|
||||
{
|
||||
gtk_widget_error_bell (widget);
|
||||
{
|
||||
gtk_widget_error_bell (widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
edited = TRUE;
|
||||
@ -515,7 +515,7 @@ grab_key_callback (GtkWidget *widget,
|
||||
|
||||
if (edited)
|
||||
g_signal_emit (accel, signals[ACCEL_EDITED], 0, path,
|
||||
accel_key, accel_mods, event->hardware_keycode);
|
||||
accel_key, accel_mods, event->hardware_keycode);
|
||||
else if (cleared)
|
||||
g_signal_emit (accel, signals[ACCEL_CLEARED], 0, path);
|
||||
|
||||
@ -544,7 +544,7 @@ ungrab_stuff (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
_gtk_cell_editable_event_box_start_editing (GtkCellEditable *cell_editable,
|
||||
GdkEvent *event)
|
||||
GdkEvent *event)
|
||||
{
|
||||
/* do nothing, because we are pointless */
|
||||
}
|
||||
@ -555,17 +555,73 @@ _gtk_cell_editable_event_box_cell_editable_init (GtkCellEditableIface *iface)
|
||||
iface->start_editing = _gtk_cell_editable_event_box_start_editing;
|
||||
}
|
||||
|
||||
typedef GtkEventBox GtkCellEditableEventBox;
|
||||
typedef GtkEventBoxClass GtkCellEditableEventBoxClass;
|
||||
typedef struct _GtkCellEditableEventBox GtkCellEditableEventBox;
|
||||
typedef GtkEventBoxClass GtkCellEditableEventBoxClass;
|
||||
|
||||
struct _GtkCellEditableEventBox
|
||||
{
|
||||
GtkEventBox box;
|
||||
gboolean editing_canceled;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkCellEditableEventBox, _gtk_cell_editable_event_box, GTK_TYPE_EVENT_BOX, { \
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE, _gtk_cell_editable_event_box_cell_editable_init) \
|
||||
})
|
||||
|
||||
enum {
|
||||
PROP_ZERO,
|
||||
PROP_EDITING_CANCELED
|
||||
};
|
||||
|
||||
static void
|
||||
gtk_cell_editable_event_box_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)object;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_EDITING_CANCELED:
|
||||
box->editing_canceled = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_editable_event_box_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)object;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_EDITING_CANCELED:
|
||||
g_value_set_boolean (value, box->editing_canceled);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_cell_editable_event_box_class_init (GtkCellEditableEventBoxClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||
|
||||
gobject_class->set_property = gtk_cell_editable_event_box_set_property;
|
||||
gobject_class->get_property = gtk_cell_editable_event_box_get_property;
|
||||
|
||||
g_object_class_override_property (gobject_class,
|
||||
PROP_EDITING_CANCELED,
|
||||
"editing-canceled");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -430,6 +430,8 @@ gtk_cell_view_set_property (GObject *object,
|
||||
view->priv->orientation = g_value_get_enum (value);
|
||||
if (view->priv->context)
|
||||
gtk_cell_area_context_reset (view->priv->context);
|
||||
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (object));
|
||||
break;
|
||||
case PROP_BACKGROUND:
|
||||
{
|
||||
|
@ -455,8 +455,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
{
|
||||
GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
|
||||
GtkWidget *widget;
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type;
|
||||
gint x, y;
|
||||
|
||||
widget = GTK_WIDGET (check_menu_item);
|
||||
@ -464,15 +462,20 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
guint border_width;
|
||||
guint offset;
|
||||
guint toggle_size;
|
||||
guint toggle_spacing;
|
||||
guint horizontal_padding;
|
||||
guint indicator_size;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
@ -483,14 +486,14 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
|
||||
toggle_size = GTK_MENU_ITEM (check_menu_item)->priv->toggle_size;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
offset = border_width + style->xthickness + 2;
|
||||
offset = border_width + padding.left + 2;
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
x = offset + horizontal_padding +
|
||||
(toggle_size - toggle_spacing - indicator_size) / 2;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
x = allocation.width -
|
||||
offset - horizontal_padding - toggle_size + toggle_spacing +
|
||||
@ -501,37 +504,37 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
|
||||
if (priv->active ||
|
||||
priv->always_show_toggle ||
|
||||
(gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT))
|
||||
(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_PRELIGHT))
|
||||
{
|
||||
GdkWindow *window;
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
state_type = gtk_widget_get_state (widget);
|
||||
gtk_style_context_save (context);
|
||||
|
||||
if (priv->inconsistent)
|
||||
shadow_type = GTK_SHADOW_ETCHED_IN;
|
||||
state |= GTK_STATE_FLAG_INCONSISTENT;
|
||||
else if (priv->active)
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
else
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
state |= GTK_STATE_FLAG_ACTIVE;
|
||||
|
||||
if (!gtk_widget_is_sensitive (widget))
|
||||
state_type = GTK_STATE_INSENSITIVE;
|
||||
state |= GTK_STATE_FLAG_INSENSITIVE;
|
||||
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
if (priv->draw_as_radio)
|
||||
{
|
||||
gtk_paint_option (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget, "option",
|
||||
x, y, indicator_size, indicator_size);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RADIO);
|
||||
gtk_render_option (context, cr, x, y,
|
||||
indicator_size, indicator_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_paint_check (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget, "check",
|
||||
x, y, indicator_size, indicator_size);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
|
||||
gtk_render_check (context, cr, x, y,
|
||||
indicator_size, indicator_size);
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1766,7 +1766,7 @@ gtk_container_adjust_size_request (GtkWidget *widget,
|
||||
|
||||
container = GTK_CONTAINER (widget);
|
||||
|
||||
if (GTK_CONTAINER_GET_CLASS (widget)->handle_border_width)
|
||||
if (GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
|
||||
{
|
||||
int border_width;
|
||||
|
||||
@ -1796,7 +1796,7 @@ gtk_container_adjust_size_allocation (GtkWidget *widget,
|
||||
|
||||
container = GTK_CONTAINER (widget);
|
||||
|
||||
if (!GTK_CONTAINER_GET_CLASS (widget)->handle_border_width)
|
||||
if (!GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
|
||||
{
|
||||
parent_class->adjust_size_allocation (widget, orientation,
|
||||
minimum_size, natural_size, allocated_pos,
|
||||
@ -1859,7 +1859,7 @@ gtk_container_class_handle_border_width (GtkContainerClass *klass)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CONTAINER_CLASS (klass));
|
||||
|
||||
klass->handle_border_width = TRUE;
|
||||
klass->_handle_border_width = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,8 +62,6 @@ struct _GtkContainerClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
unsigned int handle_border_width : 1;
|
||||
|
||||
void (*add) (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
void (*remove) (GtkContainer *container,
|
||||
@ -91,6 +89,11 @@ struct _GtkContainerClass
|
||||
GtkWidgetPath * (*get_path_for_child) (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
|
||||
|
||||
/*< private >*/
|
||||
|
||||
unsigned int _handle_border_width : 1;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
|
@ -3727,14 +3727,16 @@ gtk_css_provider_get_default (void)
|
||||
" background-color: shade (@bg_color, 1.05);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".check, .radio,\n"
|
||||
".check, .radio {\n"
|
||||
" border-style: solid;\n"
|
||||
" border-width: 1;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".check:active, .radio:active,\n"
|
||||
".check:hover, .radio:hover {\n"
|
||||
" background-color: @base_color;\n"
|
||||
" border-color: @fg_color;\n"
|
||||
" color: @text_color;\n"
|
||||
" border-style: solid;\n"
|
||||
" border-width: 1;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".check:selected, .radio:selected {\n"
|
||||
@ -3744,11 +3746,8 @@ gtk_css_provider_get_default (void)
|
||||
"\n"
|
||||
".menu.check, .menu.radio {\n"
|
||||
" color: @fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".menu:hover {\n"
|
||||
" background-color: @selected_bg_color;\n"
|
||||
" border-style: none;\n"
|
||||
" border-width: 0;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".popup {\n"
|
||||
@ -3783,18 +3782,13 @@ gtk_css_provider_get_default (void)
|
||||
"}\n"
|
||||
"\n"
|
||||
".menu:hover,\n"
|
||||
".menubar:hover {\n"
|
||||
".menubar:hover,\n"
|
||||
".menu.check:hover,\n"
|
||||
".menu.radio:hover {\n"
|
||||
" background-color: @selected_bg_color;\n"
|
||||
" color: @selected_fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".menu .check,\n"
|
||||
".menu .radio,\n"
|
||||
".menu .check:active,\n"
|
||||
".menu .radio:active {\n"
|
||||
" border-style: none;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"GtkSpinButton.button {\n"
|
||||
" border-width: 1;\n"
|
||||
"}\n"
|
||||
@ -3886,6 +3880,16 @@ gtk_css_provider_get_default (void)
|
||||
" background-color: lighter (@bg_color);\n"
|
||||
" color: @fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".menu {\n"
|
||||
" border-width: 1;\n"
|
||||
" padding: 0;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".menu * {\n"
|
||||
" border-width: 0;\n"
|
||||
" padding: 2;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
|
291
gtk/gtkenums.h
291
gtk/gtkenums.h
@ -33,6 +33,14 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkenum
|
||||
* @Short_description: Public enumerated types used throughout GTK+
|
||||
* @Title: Standard Enumerations
|
||||
*/
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
@ -64,7 +72,15 @@ typedef enum
|
||||
GTK_ALIGN_CENTER
|
||||
} GtkAlign;
|
||||
|
||||
/* Arrow placement */
|
||||
|
||||
/**
|
||||
* GtkArrowPlacement:
|
||||
* @GTK_ARROWS_BOTH: Place one arrow on each end of the menu.
|
||||
* @GTK_ARROWS_START: Place both arrows at the top of the menu.
|
||||
* @GTK_ARROWS_END: Place both arrows at the bottom of the menu.
|
||||
*
|
||||
* Used to specify the placement of scroll arrows in scrolling menus.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_ARROWS_BOTH,
|
||||
@ -72,7 +88,16 @@ typedef enum
|
||||
GTK_ARROWS_END
|
||||
} GtkArrowPlacement;
|
||||
|
||||
/* Arrow types */
|
||||
/**
|
||||
* GtkArrowType
|
||||
* @GTK_ARROW_UP: Represents an upward pointing arrow.
|
||||
* @GTK_ARROW_DOWN: Represents a downward pointing arrow.
|
||||
* @GTK_ARROW_LEFT: Represents a left pointing arrow.
|
||||
* @GTK_ARROW_RIGHT: Represents a right pointing arrow.
|
||||
* @GTK_ARROW_NONE: No arrow. Since 2.10.
|
||||
*
|
||||
* Used to indicate the direction in which a #GtkArrow should point.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_ARROW_UP,
|
||||
@ -82,7 +107,16 @@ typedef enum
|
||||
GTK_ARROW_NONE
|
||||
} GtkArrowType;
|
||||
|
||||
/* Attach options (for tables) */
|
||||
/**
|
||||
* GtkAttachOptions:
|
||||
* @GTK_EXPAND: the widget should expand to take up any extra space in its
|
||||
* container that has been allocated.
|
||||
* @GTK_SHRINK: the widget should shrink as and when possible.
|
||||
* @GTK_FILL: the widget should fill the space allocated to it.
|
||||
*
|
||||
* Denotes the expansion properties that a widget will have when it (or its
|
||||
* parent) is resized.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_EXPAND = 1 << 0,
|
||||
@ -90,7 +124,20 @@ typedef enum
|
||||
GTK_FILL = 1 << 2
|
||||
} GtkAttachOptions;
|
||||
|
||||
/* Button box styles */
|
||||
/**
|
||||
* GtkButtonBoxStyle:
|
||||
* @GTK_BUTTONBOX_DEFAULT_STYLE: Default packing.
|
||||
* @GTK_BUTTONBOX_SPREAD: Buttons are evenly spread across the box.
|
||||
* @GTK_BUTTONBOX_EDGE: Buttons are placed at the edges of the box.
|
||||
* @GTK_BUTTONBOX_START: Buttons are grouped towards the start of the box,
|
||||
* (on the left for a HBox, or the top for a VBox).
|
||||
* @GTK_BUTTONBOX_END: Buttons are grouped towards the end of the box,
|
||||
* (on the right for a HBox, or the bottom for a VBox).
|
||||
* @GTK_BUTTONBOX_CENTER: Buttons are centered in the box. Since 2.12.
|
||||
*
|
||||
* Used to dictate the style that a #GtkButtonBox uses to layout the buttons it
|
||||
* contains. (See also: #GtkVButtonBox and #GtkHButtonBox).
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_BUTTONBOX_SPREAD = 1,
|
||||
@ -100,6 +147,7 @@ typedef enum
|
||||
GTK_BUTTONBOX_CENTER
|
||||
} GtkButtonBoxStyle;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_DELETE_CHARS,
|
||||
@ -125,7 +173,15 @@ typedef enum
|
||||
GTK_DIR_RIGHT
|
||||
} GtkDirectionType;
|
||||
|
||||
/* Expander styles */
|
||||
/**
|
||||
* GtkExpanderStyle:
|
||||
* @GTK_EXPANDER_COLLAPSED: The style used for a collapsed subtree.
|
||||
* @GTK_EXPANDER_SEMI_COLLAPSED: Intermediate style used during animation.
|
||||
* @GTK_EXPANDER_SEMI_EXPANDED: Intermediate style used during animation.
|
||||
* @GTK_EXPANDER_EXPANDED: The style used for an expanded subtree.
|
||||
*
|
||||
* Used to specify the style of the expanders drawn by a #GtkTreeView.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_EXPANDER_COLLAPSED,
|
||||
@ -171,7 +227,16 @@ typedef enum
|
||||
GTK_TEXT_DIR_RTL
|
||||
} GtkTextDirection;
|
||||
|
||||
/* justification for label and maybe other widgets (text?) */
|
||||
/**
|
||||
* GtkJustification:
|
||||
* @GTK_JUSTIFY_LEFT: The text is placed at the left edge of the label.
|
||||
* @GTK_JUSTIFY_RIGHT: The text is placed at the right edge of the label.
|
||||
* @GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
|
||||
* @GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
|
||||
*
|
||||
* Used for justifying the text inside a #GtkLabel widget. (See also
|
||||
* #GtkAlignment).
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_JUSTIFY_LEFT,
|
||||
@ -180,7 +245,15 @@ typedef enum
|
||||
GTK_JUSTIFY_FILL
|
||||
} GtkJustification;
|
||||
|
||||
/* Menu keyboard movement types */
|
||||
/**
|
||||
* GtkMenuDirectionType:
|
||||
* @GTK_MENU_DIR_PARENT: To the parent menu shell
|
||||
* @GTK_MENU_DIR_CHILD: To the submenu, if any, associated with the item
|
||||
* @GTK_MENU_DIR_NEXT: To the next menu item
|
||||
* @GTK_MENU_DIR_PREV: To the previous menu item
|
||||
*
|
||||
* An enumeration representing directional movements within a menu.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_MENU_DIR_PARENT,
|
||||
@ -245,14 +318,35 @@ typedef enum
|
||||
GTK_SCROLL_HORIZONTAL_ENDS
|
||||
} GtkScrollStep;
|
||||
|
||||
/* Orientation for toolbars, etc. */
|
||||
/**
|
||||
* GtkOrientation:
|
||||
* @GTK_ORIENTATION_HORIZONTAL: The widget is in horizontal orientation.
|
||||
* @GTK_ORIENTATION_VERTICAL: The widget is in vertical orientation.
|
||||
*
|
||||
* Represents the orientation of widgets which can be switched between horizontal
|
||||
* and vertical orientation on the fly, like #GtkToolbar.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
GTK_ORIENTATION_VERTICAL
|
||||
} GtkOrientation;
|
||||
|
||||
/* Placement type for scrolled window */
|
||||
/**
|
||||
* GtkCornerType:
|
||||
* @GTK_CORNER_TOP_LEFT: Place the scrollbars on the right and bottom of the
|
||||
* widget (default behaviour).
|
||||
* @GTK_CORNER_BOTTOM_LEFT: Place the scrollbars on the top and right of the
|
||||
* widget.
|
||||
* @GTK_CORNER_TOP_RIGHT: Place the scrollbars on the left and bottom of the
|
||||
* widget.
|
||||
* @GTK_CORNER_BOTTOM_RIGHT: Place the scrollbars on the top and left of the
|
||||
* widget.
|
||||
*
|
||||
* Specifies which corner a child widget should be placed in when packed into
|
||||
* a #GtkScrolledWindow. This is effectively the opposite of where the scroll
|
||||
* bars are placed.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_CORNER_TOP_LEFT,
|
||||
@ -261,7 +355,14 @@ typedef enum
|
||||
GTK_CORNER_BOTTOM_RIGHT
|
||||
} GtkCornerType;
|
||||
|
||||
/* Packing types (for boxes) */
|
||||
/**
|
||||
* GtkPackType:
|
||||
* @GTK_PACK_START: The child is packed into the start of the box
|
||||
* @GTK_PACK_END: The child is packed into the end of the box
|
||||
*
|
||||
* Represents the packing location #GtkBox children. (See: #GtkVBox,
|
||||
* #GtkHBox, and #GtkButtonBox).
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_PACK_START,
|
||||
@ -288,7 +389,15 @@ typedef enum
|
||||
GTK_PATH_CLASS
|
||||
} GtkPathType;
|
||||
|
||||
/* Scrollbar policy types (for scrolled windows) */
|
||||
/**
|
||||
* GtkPolicyType:
|
||||
* @GTK_POLICY_ALWAYS: The scrollbar is always visible.
|
||||
* @GTK_POLICY_AUTOMATIC: The scrollbar will appear and disappear as necessary. For example,
|
||||
* when all of a #GtkCList can not be seen.
|
||||
* @GTK_POLICY_NEVER: The scrollbar will never appear.
|
||||
*
|
||||
* Determines when a scroll bar will be visible.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_POLICY_ALWAYS,
|
||||
@ -296,6 +405,17 @@ typedef enum
|
||||
GTK_POLICY_NEVER
|
||||
} GtkPolicyType;
|
||||
|
||||
/**
|
||||
* GtkPositionType:
|
||||
* @GTK_POS_LEFT: The feature is at the left edge.
|
||||
* @GTK_POS_RIGHT: The feature is at the right edge.
|
||||
* @GTK_POS_TOP: The feature is at the top edge.
|
||||
* @GTK_POS_BOTTOM: The feature is at the bottom edge.
|
||||
*
|
||||
* Describes which edge of a widget a certain feature is positioned at, e.g. the
|
||||
* tabs of a #GtkNotebook, the handle of a #GtkHandleBox or the label of a
|
||||
* #GtkScale.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_POS_LEFT,
|
||||
@ -304,7 +424,14 @@ typedef enum
|
||||
GTK_POS_BOTTOM
|
||||
} GtkPositionType;
|
||||
|
||||
/* Style for buttons */
|
||||
/**
|
||||
* GtkReliefStyle:
|
||||
* @GTK_RELIEF_NORMAL: Draw a normal relief.
|
||||
* @GTK_RELIEF_HALF: A half relief.
|
||||
* @GTK_RELIEF_NONE: No relief.
|
||||
*
|
||||
* Indicated the relief to be drawn around a #GtkButton.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_RELIEF_NORMAL,
|
||||
@ -312,12 +439,17 @@ typedef enum
|
||||
GTK_RELIEF_NONE
|
||||
} GtkReliefStyle;
|
||||
|
||||
/* Resize type */
|
||||
/**
|
||||
* GtkResizeMode:
|
||||
* @GTK_RESIZE_PARENT: Pass resize request to the parent
|
||||
* @GTK_RESIZE_QUEUE: Queue resizes on this widget
|
||||
* @GTK_RESIZE_IMMEDIATE: Resize immediately. Deprecated.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_RESIZE_PARENT, /* Pass resize request to the parent */
|
||||
GTK_RESIZE_QUEUE, /* Queue resizes on this widget */
|
||||
GTK_RESIZE_IMMEDIATE /* Perform the resizes now */
|
||||
GTK_RESIZE_PARENT,
|
||||
GTK_RESIZE_QUEUE,
|
||||
GTK_RESIZE_IMMEDIATE
|
||||
} GtkResizeMode;
|
||||
|
||||
/* scrolling types */
|
||||
@ -341,16 +473,42 @@ typedef enum
|
||||
GTK_SCROLL_END
|
||||
} GtkScrollType;
|
||||
|
||||
/* list selection modes */
|
||||
/**
|
||||
* GtkSelectionMode:
|
||||
* @GTK_SELECTION_NONE: No selection is possible.
|
||||
* @GTK_SELECTION_SINGLE: Zero or one element may be selected.
|
||||
* @GTK_SELECTION_BROWSE: Exactly one element is selected. In some circumstances,
|
||||
* such as initially or during a search operation, it's possible for no element
|
||||
* to be selected with %GTK_SELECTION_BROWSE. What is really enforced is that
|
||||
* the user can't deselect a currently selected element except by selecting
|
||||
* another element.
|
||||
* @GTK_SELECTION_MULTIPLE: Any number of elements may be selected.
|
||||
* Clicks toggle the state of an item. Any number of elements may be selected.
|
||||
* The Ctrl key may be used to enlarge the selection, and Shift key to select
|
||||
* between the focus and the child pointed to. Some widgets may also allow
|
||||
* Click-drag to select a range of elements.
|
||||
* @GTK_SELECTION_EXTENDED: Deprecated, behaves identical to %GTK_SELECTION_MULTIPLE.
|
||||
*
|
||||
* Used to control what selections users are allowed to make.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_SELECTION_NONE, /* Nothing can be selected */
|
||||
GTK_SELECTION_NONE,
|
||||
GTK_SELECTION_SINGLE,
|
||||
GTK_SELECTION_BROWSE,
|
||||
GTK_SELECTION_MULTIPLE
|
||||
} GtkSelectionMode;
|
||||
|
||||
/* Shadow types */
|
||||
/**
|
||||
* GtkShadowType:
|
||||
* @GTK_SHADOW_NONE: No outline.
|
||||
* @GTK_SHADOW_IN: The outline is bevelled inwards.
|
||||
* @GTK_SHADOW_OUT: The outline is bevelled outwards like a button.
|
||||
* @GTK_SHADOW_ETCHED_IN: The outline has a sunken 3d appearance.
|
||||
* @GTK_SHADOW_ETCHED_OUT: The outline has a raised 3d appearance.
|
||||
*
|
||||
* Used to change the appearance of an outline typically provided by a #GtkFrame.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_SHADOW_NONE,
|
||||
@ -392,7 +550,20 @@ typedef enum
|
||||
GTK_STATE_FOCUSED
|
||||
} GtkStateType;
|
||||
|
||||
/* Style for toolbars */
|
||||
/**
|
||||
* GtkToolbarStyle:
|
||||
* @GTK_TOOLBAR_ICONS: Buttons display only icons in the toolbar.
|
||||
* @GTK_TOOLBAR_TEXT: Buttons display only text labels in the toolbar.
|
||||
* @GTK_TOOLBAR_BOTH: Buttons display text and icons in the toolbar.
|
||||
* @GTK_TOOLBAR_BOTH_HORIZ: Buttons display icons and text alongside each
|
||||
* other, rather than vertically stacked
|
||||
*
|
||||
* Used to customize the appearance of a #GtkToolbar. Note that
|
||||
* setting the toolbar style overrides the user's preferences
|
||||
* for the default toolbar style. Note that if the button has only
|
||||
* a label set and GTK_TOOLBAR_ICONS is used, the label will be
|
||||
* visible, and vice versa.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_TOOLBAR_ICONS,
|
||||
@ -401,7 +572,19 @@ typedef enum
|
||||
GTK_TOOLBAR_BOTH_HORIZ
|
||||
} GtkToolbarStyle;
|
||||
|
||||
/* Window position types */
|
||||
/**
|
||||
* GtkWindowPosition:
|
||||
* @GTK_WIN_POS_NONE: No influence is made on placement.
|
||||
* @GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
|
||||
* @GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
|
||||
* @GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc.
|
||||
* @GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient
|
||||
* parent (see gtk_window_set_transient_for()).
|
||||
*
|
||||
* Window placement can be influenced using this enumeration. Note that
|
||||
* using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea.
|
||||
* It won't necessarily work well with all window managers or on all windowing systems.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_WIN_POS_NONE,
|
||||
@ -411,14 +594,43 @@ typedef enum
|
||||
GTK_WIN_POS_CENTER_ON_PARENT
|
||||
} GtkWindowPosition;
|
||||
|
||||
/* Window types */
|
||||
/**
|
||||
* GtkWindowType:
|
||||
* @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
|
||||
* @GTK_WINDOW_POPUP: A special window such as a tooltip.
|
||||
*
|
||||
* A #GtkWindow can be one of these types. Most things you'd consider a
|
||||
* "window" should have type #GTK_WINDOW_TOPLEVEL; windows with this type
|
||||
* are managed by the window manager and have a frame by default (call
|
||||
* gtk_window_set_decorated() to toggle the frame). Windows with type
|
||||
* #GTK_WINDOW_POPUP are ignored by the window manager; window manager
|
||||
* keybindings won't work on them, the window manager won't decorate the
|
||||
* window with a frame, many GTK+ features that rely on the window
|
||||
* manager will not work (e.g. resize grips and
|
||||
* maximization/minimization). #GTK_WINDOW_POPUP is used to implement
|
||||
* widgets such as #GtkMenu or tooltips that you normally don't think of
|
||||
* as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL.
|
||||
* In particular, do not use #GTK_WINDOW_POPUP just to turn off
|
||||
* the window borders; use gtk_window_set_decorated() for that.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_WINDOW_TOPLEVEL,
|
||||
GTK_WINDOW_POPUP
|
||||
} GtkWindowType;
|
||||
|
||||
/* Text wrap */
|
||||
/**
|
||||
* GtkWrapMode:
|
||||
* @GTK_WRAP_NONE: do not wrap lines; just make the text area wider
|
||||
* @GTK_WRAP_CHAR: wrap text, breaking lines anywhere the cursor can
|
||||
* appear (between characters, usually - if you want to be technical,
|
||||
* between graphemes, see pango_get_log_attrs())
|
||||
* @GTK_WRAP_WORD: wrap text, breaking lines in between words
|
||||
* @GTK_WRAP_WORD_CHAR: wrap text, breaking lines in between words, or if
|
||||
* that is not enough, also between graphemes
|
||||
*
|
||||
* Describes a type of line wrapping.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_WRAP_NONE,
|
||||
@ -427,7 +639,13 @@ typedef enum
|
||||
GTK_WRAP_WORD_CHAR
|
||||
} GtkWrapMode;
|
||||
|
||||
/* How to sort */
|
||||
/**
|
||||
* GtkSortType:
|
||||
* @GTK_SORT_ASCENDING: Sorting is in ascending order.
|
||||
* @GTK_SORT_DESCENDING: Sorting is in descending order.
|
||||
*
|
||||
* Determines the direction of a sort.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_SORT_ASCENDING,
|
||||
@ -449,6 +667,16 @@ typedef enum
|
||||
GTK_IM_STATUS_NONE
|
||||
} GtkIMStatusStyle;
|
||||
|
||||
/**
|
||||
* GtkPackDirection:
|
||||
* @GTK_PACK_DIRECTION_LTR: Widgets are packed left-to-right
|
||||
* @GTK_PACK_DIRECTION_RTL: Widgets are packed right-to-left
|
||||
* @GTK_PACK_DIRECTION_TTB: Widgets are packed top-to-bottom
|
||||
* @GTK_PACK_DIRECTION_BTT: Widgets are packed bottom-to-top
|
||||
*
|
||||
* Determines how widgets should be packed insided menubars
|
||||
* and menuitems contained in menubars.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_PACK_DIRECTION_LTR,
|
||||
@ -533,6 +761,21 @@ typedef enum
|
||||
GTK_TREE_VIEW_GRID_LINES_BOTH
|
||||
} GtkTreeViewGridLines;
|
||||
|
||||
/**
|
||||
* GtkDragResult:
|
||||
* @GTK_DRAG_RESULT_SUCCESS: The drag operation was successful.
|
||||
* @GTK_DRAG_RESULT_NO_TARGET: No suitable drag target.
|
||||
* @GTK_DRAG_RESULT_USER_CANCELLED: The user cancelled the drag operation.
|
||||
* @GTK_DRAG_RESULT_TIMEOUT_EXPIRED: The drag operation timed out.
|
||||
* @GTK_DRAG_RESULT_GRAB_BROKEN: The pointer or keyboard grab used
|
||||
* for the drag operation was broken.
|
||||
* @GTK_DRAG_RESULT_ERROR: The drag operation failed due to some
|
||||
* unspecified error.
|
||||
*
|
||||
* Gives an indication why a drag operation failed.
|
||||
* The value can by obtained by connecting to the
|
||||
* #GtkWidget::drag-failed signal.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_DRAG_RESULT_SUCCESS,
|
||||
|
@ -595,9 +595,13 @@ gtk_event_box_draw (GtkWidget *widget,
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget));
|
||||
gtk_render_background (context, cr, 0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_event_box_parent_class)->draw (widget, cr);
|
||||
|
@ -191,6 +191,7 @@ gtk_grid_set_orientation (GtkGrid *grid,
|
||||
if (priv->orientation != orientation)
|
||||
{
|
||||
priv->orientation = orientation;
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (grid));
|
||||
|
||||
g_object_notify (G_OBJECT (grid), "orientation");
|
||||
}
|
||||
|
@ -3254,6 +3254,9 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
||||
* Loads an icon, modifying it to match the system colors for the foreground,
|
||||
* success, warning and error colors provided. If the icon is not a symbolic
|
||||
* one, the function will return the result from gtk_icon_info_load_icon().
|
||||
* This function uses the regular foreground color and the symbolic colors
|
||||
* with the names "success_color", "warning_color" and "error_color" from
|
||||
* the context.
|
||||
*
|
||||
* This allows loading symbolic icons that will match the system theme.
|
||||
*
|
||||
|
@ -554,6 +554,9 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||
if (priv->image && gtk_widget_get_visible (priv->image))
|
||||
{
|
||||
gint x, y, offset;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
GtkRequisition child_requisition;
|
||||
GtkAllocation child_allocation;
|
||||
guint horizontal_padding, toggle_spacing;
|
||||
@ -573,18 +576,20 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||
|
||||
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
offset = gtk_container_get_border_width (GTK_CONTAINER (image_menu_item));
|
||||
|
||||
if (pack_dir == GTK_PACK_DIRECTION_LTR ||
|
||||
pack_dir == GTK_PACK_DIRECTION_RTL)
|
||||
{
|
||||
offset = gtk_container_get_border_width (GTK_CONTAINER (image_menu_item)) +
|
||||
gtk_widget_get_style (widget)->xthickness;
|
||||
|
||||
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) ==
|
||||
(pack_dir == GTK_PACK_DIRECTION_LTR))
|
||||
x = offset + horizontal_padding +
|
||||
x = offset + horizontal_padding + padding.left +
|
||||
(toggle_size - toggle_spacing - child_requisition.width) / 2;
|
||||
else
|
||||
x = widget_allocation.width - offset - horizontal_padding -
|
||||
x = widget_allocation.width - offset - horizontal_padding - padding.right -
|
||||
toggle_size + toggle_spacing +
|
||||
(toggle_size - toggle_spacing - child_requisition.width) / 2;
|
||||
|
||||
@ -592,15 +597,12 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = gtk_container_get_border_width (GTK_CONTAINER (image_menu_item)) +
|
||||
gtk_widget_get_style (widget)->ythickness;
|
||||
|
||||
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) ==
|
||||
(pack_dir == GTK_PACK_DIRECTION_TTB))
|
||||
y = offset + horizontal_padding +
|
||||
y = offset + horizontal_padding + padding.top +
|
||||
(toggle_size - toggle_spacing - child_requisition.height) / 2;
|
||||
else
|
||||
y = widget_allocation.height - offset - horizontal_padding -
|
||||
y = widget_allocation.height - offset - horizontal_padding - padding.bottom -
|
||||
toggle_size + toggle_spacing +
|
||||
(toggle_size - toggle_spacing - child_requisition.height) / 2;
|
||||
|
||||
|
@ -122,7 +122,7 @@
|
||||
#include "gtkmodules.h"
|
||||
#include "gtkrc.h"
|
||||
#include "gtkrecentmanager.h"
|
||||
#include "gtkselection.h"
|
||||
#include "gtkselectionprivate.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
|
@ -2334,17 +2334,18 @@ get_menu_border (GtkWidget *widget,
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder *border_width;
|
||||
GtkBorder padding, border_width;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
gtk_style_context_get (context, state,
|
||||
"border-width", &border_width,
|
||||
NULL);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border_width);
|
||||
|
||||
*border = *border_width;
|
||||
gtk_border_free (border_width);
|
||||
border->left = border_width.left + padding.left;
|
||||
border->right = border_width.right + padding.right;
|
||||
border->top = border_width.top + padding.top;
|
||||
border->bottom = border_width.bottom + padding.bottom;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2535,6 +2536,9 @@ calculate_line_heights (GtkMenu *menu,
|
||||
guint **ret_min_heights,
|
||||
guint **ret_nat_heights)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
GtkMenuPrivate *priv;
|
||||
GtkMenuShell *menu_shell;
|
||||
GtkWidget *child, *widget;
|
||||
@ -2561,8 +2565,12 @@ calculate_line_heights (GtkMenu *menu,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
avail_width -= (border_width + horizontal_padding + gtk_widget_get_style (widget)->xthickness) * 2;
|
||||
avail_width -= (border_width + horizontal_padding) * 2 + padding.left + padding.right;
|
||||
|
||||
for (children = menu_shell->priv->children; children; children = children->next)
|
||||
{
|
||||
@ -3127,6 +3135,9 @@ gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding, border;
|
||||
GtkMenu *menu = GTK_MENU (widget);
|
||||
GtkMenuPrivate *priv = menu->priv;
|
||||
guint *min_heights, *nat_heights;
|
||||
@ -3137,7 +3148,13 @@ gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
||||
gtk_widget_style_get (widget, "vertical-padding", &vertical_padding, NULL);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
|
||||
min_height = nat_height = (border_width + vertical_padding + gtk_widget_get_style (widget)->ythickness) * 2;
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
min_height = nat_height = (border_width + vertical_padding) * 2 +
|
||||
padding.left + padding.right + border.left + border.right;
|
||||
|
||||
n_heights =
|
||||
calculate_line_heights (menu, for_size, &min_heights, &nat_heights);
|
||||
@ -3810,6 +3827,9 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
guint vertical_padding;
|
||||
gint win_x, win_y;
|
||||
gint scroll_arrow_height;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
width = gdk_window_get_width (window);
|
||||
@ -3821,8 +3841,11 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
"arrow-placement", &arrow_placement,
|
||||
NULL);
|
||||
|
||||
border = gtk_container_get_border_width (GTK_CONTAINER (menu)) +
|
||||
gtk_widget_get_style (widget)->ythickness + vertical_padding;
|
||||
border = gtk_container_get_border_width (GTK_CONTAINER (menu)) + vertical_padding;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
gdk_window_get_position (window, &win_x, &win_y);
|
||||
|
||||
@ -3834,15 +3857,15 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
upper->x = win_x;
|
||||
upper->y = win_y;
|
||||
upper->width = width;
|
||||
upper->height = scroll_arrow_height + border;
|
||||
upper->height = scroll_arrow_height + border + padding.top;
|
||||
}
|
||||
|
||||
if (lower)
|
||||
{
|
||||
lower->x = win_x;
|
||||
lower->y = win_y + height - border - scroll_arrow_height;
|
||||
lower->y = win_y + height - border - padding.bottom - scroll_arrow_height;
|
||||
lower->width = width;
|
||||
lower->height = scroll_arrow_height + border;
|
||||
lower->height = scroll_arrow_height + border + padding.bottom;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3852,7 +3875,7 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
upper->x = win_x;
|
||||
upper->y = win_y;
|
||||
upper->width = width / 2;
|
||||
upper->height = scroll_arrow_height + border;
|
||||
upper->height = scroll_arrow_height + border + padding.top;
|
||||
}
|
||||
|
||||
if (lower)
|
||||
@ -3860,7 +3883,7 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
lower->x = win_x + width / 2;
|
||||
lower->y = win_y;
|
||||
lower->width = width / 2;
|
||||
lower->height = scroll_arrow_height + border;
|
||||
lower->height = scroll_arrow_height + border + padding.bottom;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3870,7 +3893,7 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
upper->x = win_x;
|
||||
upper->y = win_y + height - border - scroll_arrow_height;
|
||||
upper->width = width / 2;
|
||||
upper->height = scroll_arrow_height + border;
|
||||
upper->height = scroll_arrow_height + border + padding.top;
|
||||
}
|
||||
|
||||
if (lower)
|
||||
@ -3878,7 +3901,7 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
lower->x = win_x + width / 2;
|
||||
lower->y = win_y + height - border - scroll_arrow_height;
|
||||
lower->width = width / 2;
|
||||
lower->height = scroll_arrow_height + border;
|
||||
lower->height = scroll_arrow_height + border + padding.bottom;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -4977,6 +5000,9 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
|
||||
{
|
||||
guint vertical_padding;
|
||||
gboolean double_arrows;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
|
||||
y = priv->scroll_offset;
|
||||
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
||||
@ -4988,8 +5014,12 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
|
||||
|
||||
double_arrows = get_double_arrows (menu);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
height -= 2 * gtk_container_get_border_width (GTK_CONTAINER (menu)) +
|
||||
2 * gtk_widget_get_style (widget)->ythickness +
|
||||
padding.top + padding.bottom +
|
||||
2 * vertical_padding;
|
||||
if (child_offset < y)
|
||||
{
|
||||
@ -5366,12 +5396,20 @@ get_visible_size (GtkMenu *menu)
|
||||
GtkAllocation allocation;
|
||||
GtkWidget *widget = GTK_WIDGET (menu);
|
||||
GtkContainer *container = GTK_CONTAINER (menu);
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
gint menu_height;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
menu_height = (allocation.height
|
||||
- 2 * (gtk_container_get_border_width (container)
|
||||
+ gtk_widget_get_style (widget)->ythickness));
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
menu_height = (allocation.height -
|
||||
(2 * gtk_container_get_border_width (container)) -
|
||||
padding.top - padding.bottom);
|
||||
|
||||
if (!priv->tearoff_active)
|
||||
{
|
||||
@ -5437,12 +5475,21 @@ get_menu_height (GtkMenu *menu)
|
||||
GtkMenuPrivate *priv = menu->priv;
|
||||
GtkAllocation allocation;
|
||||
GtkWidget *widget = GTK_WIDGET (menu);
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding, border;
|
||||
gint height;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
height = allocation.height;
|
||||
height -= (gtk_container_get_border_width (GTK_CONTAINER (widget)) + gtk_widget_get_style (widget)->ythickness) * 2;
|
||||
height -= (gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2) +
|
||||
padding.top + padding.bottom + border.top + border.bottom;
|
||||
|
||||
if (!priv->tearoff_active)
|
||||
{
|
||||
|
@ -24,6 +24,17 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkmenubar
|
||||
* @Title: GtkMenuBar
|
||||
* @Short_description: A subclass of GtkMenuShell which holds GtkMenuItem widgets
|
||||
* @See_also: #GtkMenuShell, #GtkMenu, #GtkMenuItem
|
||||
*
|
||||
* The #GtkMenuBar is a subclass of #GtkMenuShell which contains one or
|
||||
* more #GtkMenuItems. The result is a standard menu bar which can hold
|
||||
* many menu items.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkmenubar.h"
|
||||
@ -224,6 +235,13 @@ gtk_menu_bar_init (GtkMenuBar *menu_bar)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUBAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_bar_new:
|
||||
*
|
||||
* Creates a new #GtkMenuBar
|
||||
*
|
||||
* Returns: the new menu bar, as a #GtkWidget
|
||||
*/
|
||||
GtkWidget*
|
||||
gtk_menu_bar_new (void)
|
||||
{
|
||||
|
@ -594,6 +594,8 @@ get_arrow_size (GtkWidget *widget,
|
||||
GtkWidget *child,
|
||||
gint *size)
|
||||
{
|
||||
GtkStyleContext *style_context;
|
||||
GtkStateFlags state;
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
gfloat arrow_scaling;
|
||||
@ -605,8 +607,11 @@ get_arrow_size (GtkWidget *widget,
|
||||
NULL);
|
||||
|
||||
context = gtk_widget_get_pango_context (child);
|
||||
style_context = gtk_widget_get_style_context (child);
|
||||
state = gtk_widget_get_state_flags (child);
|
||||
|
||||
metrics = pango_context_get_metrics (context,
|
||||
gtk_widget_get_style (child)->font_desc,
|
||||
gtk_style_context_get_font (style_context, state),
|
||||
pango_context_get_language (context));
|
||||
|
||||
*size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
||||
@ -640,14 +645,19 @@ gtk_menu_item_accel_width_foreach (GtkWidget *widget,
|
||||
static gint
|
||||
get_minimum_width (GtkWidget *widget)
|
||||
{
|
||||
GtkStyleContext *style_context;
|
||||
GtkStateFlags state;
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
gint width;
|
||||
gint width_chars;
|
||||
|
||||
context = gtk_widget_get_pango_context (widget);
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
metrics = pango_context_get_metrics (context,
|
||||
gtk_widget_get_style (widget)->font_desc,
|
||||
gtk_style_context_get_font (style_context, state),
|
||||
pango_context_get_language (context));
|
||||
|
||||
width = pango_font_metrics_get_approximate_char_width (metrics);
|
||||
@ -675,6 +685,9 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
||||
GtkPackDirection pack_dir;
|
||||
GtkPackDirection child_pack_dir;
|
||||
gint min_width, nat_width;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding, border;
|
||||
|
||||
min_width = nat_width = 0;
|
||||
|
||||
@ -697,7 +710,14 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
||||
}
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
min_width = (border_width + gtk_widget_get_style (widget)->xthickness) * 2;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
min_width = (border_width * 2) + padding.left + padding.right +
|
||||
border.left + border.right;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
|
||||
@ -763,7 +783,9 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
|
||||
GtkMenuItemPrivate *priv = menu_item->priv;
|
||||
GtkBin *bin;
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding, border;
|
||||
GtkWidget *child;
|
||||
GtkWidget *parent;
|
||||
guint accel_width;
|
||||
@ -775,7 +797,10 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
|
||||
min_height = nat_height = 0;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
@ -796,7 +821,7 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
}
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
min_height = (border_width + style->ythickness) * 2;
|
||||
min_height = (border_width * 2) + padding.top + padding.bottom + border.top + border.bottom;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT))
|
||||
@ -837,9 +862,9 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
NULL);
|
||||
|
||||
if (wide_separators)
|
||||
min_height += separator_height + style->ythickness;
|
||||
min_height += separator_height + padding.top + border.top;
|
||||
else
|
||||
min_height += style->ythickness * 2;
|
||||
min_height += padding.top + padding.bottom + border.top + border.bottom;
|
||||
|
||||
nat_height = min_height;
|
||||
}
|
||||
@ -866,7 +891,9 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
||||
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
|
||||
GtkMenuItemPrivate *priv = menu_item->priv;
|
||||
GtkBin *bin;
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding, border;
|
||||
GtkWidget *child;
|
||||
GtkWidget *parent;
|
||||
guint horizontal_padding;
|
||||
@ -878,7 +905,10 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
||||
|
||||
min_height = nat_height = 0;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
@ -899,10 +929,10 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
||||
}
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
min_height = (border_width + style->ythickness) * 2;
|
||||
min_height = (border_width * 2) + padding.top + padding.bottom + border.top + border.bottom;
|
||||
|
||||
avail_size = for_size;
|
||||
avail_size -= (border_width + style->xthickness) * 2;
|
||||
avail_size -= (border_width * 2) + padding.left + padding.right + border.left + border.right;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT))
|
||||
@ -960,9 +990,9 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
||||
NULL);
|
||||
|
||||
if (wide_separators)
|
||||
min_height += separator_height + style->ythickness;
|
||||
min_height += separator_height + padding.top + border.top;
|
||||
else
|
||||
min_height += style->ythickness * 2;
|
||||
min_height += padding.top + padding.bottom + border.top + border.bottom;
|
||||
|
||||
nat_height = min_height;
|
||||
}
|
||||
@ -1353,28 +1383,42 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding, border;
|
||||
guint horizontal_padding;
|
||||
guint border_width;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
child_allocation.x = border_width + style->xthickness;
|
||||
child_allocation.y = border_width + style->ythickness;
|
||||
child_allocation.x = border_width + padding.left + border.left;
|
||||
child_allocation.y = border_width + padding.top + border.top;
|
||||
|
||||
child_allocation.width = allocation->width - (border_width * 2) -
|
||||
padding.left - padding.right - border.left - border.right;
|
||||
child_allocation.height = allocation->height - (border_width * 2) -
|
||||
padding.top - padding.bottom - border.top - border.bottom;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
|
||||
child_allocation.x += horizontal_padding;
|
||||
{
|
||||
child_allocation.x += horizontal_padding;
|
||||
child_allocation.width -= 2 * horizontal_padding;
|
||||
}
|
||||
else if ((pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT))
|
||||
child_allocation.y += horizontal_padding;
|
||||
|
||||
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
|
||||
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
|
||||
{
|
||||
child_allocation.y += horizontal_padding;
|
||||
child_allocation.height -= 2 * horizontal_padding;
|
||||
}
|
||||
|
||||
if (child_pack_dir == GTK_PACK_DIRECTION_LTR ||
|
||||
child_pack_dir == GTK_PACK_DIRECTION_RTL)
|
||||
@ -1460,8 +1504,6 @@ gtk_menu_item_realize (GtkWidget *widget)
|
||||
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (priv->event_window, widget);
|
||||
|
||||
gtk_widget_style_attach (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1523,16 +1565,16 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
{
|
||||
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
|
||||
GtkMenuItemPrivate *priv = menu_item->priv;
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type, selected_shadow_type;
|
||||
GtkStyle *style;
|
||||
GtkStateFlags state;
|
||||
GtkStyleContext *context;
|
||||
GtkBorder padding;
|
||||
GtkWidget *child, *parent;
|
||||
GdkWindow *window;
|
||||
gint x, y, w, h, width, height;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
state_type = gtk_widget_get_state (widget);
|
||||
style = gtk_widget_get_style (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
window = gtk_widget_get_window (widget);
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
@ -1544,18 +1586,16 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (menu_item));
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
|
||||
if (child && state_type == GTK_STATE_PRELIGHT)
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
if (child && (state & GTK_STATE_FLAG_PRELIGHT))
|
||||
{
|
||||
gtk_widget_style_get (widget,
|
||||
"selected-shadow-type", &selected_shadow_type,
|
||||
NULL);
|
||||
gtk_paint_box (style,
|
||||
cr,
|
||||
GTK_STATE_PRELIGHT,
|
||||
selected_shadow_type,
|
||||
widget, "menuitem",
|
||||
x, y, w, h);
|
||||
gtk_render_background (context, cr, x, y, w, h);
|
||||
gtk_render_frame (context, cr, x, y, w, h);
|
||||
}
|
||||
|
||||
if (priv->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
@ -1564,7 +1604,7 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
gint arrow_size;
|
||||
guint horizontal_padding;
|
||||
GtkTextDirection direction;
|
||||
GtkArrowType arrow_type;
|
||||
gdouble angle;
|
||||
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
|
||||
@ -1574,29 +1614,20 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
|
||||
get_arrow_size (widget, child, &arrow_size);
|
||||
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
if (state_type == GTK_STATE_PRELIGHT)
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
|
||||
if (direction == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
arrow_x = x + w - horizontal_padding - arrow_size;
|
||||
arrow_type = GTK_ARROW_RIGHT;
|
||||
angle = G_PI / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow_x = x + horizontal_padding;
|
||||
arrow_type = GTK_ARROW_LEFT;
|
||||
angle = (3 * G_PI) / 2;
|
||||
}
|
||||
|
||||
arrow_y = y + (h - arrow_size) / 2;
|
||||
|
||||
gtk_paint_arrow (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget, "menuitem",
|
||||
arrow_type, TRUE,
|
||||
arrow_x, arrow_y,
|
||||
arrow_size, arrow_size);
|
||||
gtk_render_arrow (context, cr, angle, arrow_x, arrow_y, arrow_size);
|
||||
}
|
||||
else if (!child)
|
||||
{
|
||||
@ -1609,25 +1640,24 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
"separator-height", &separator_height,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
if (wide_separators)
|
||||
gtk_paint_box (style, cr,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
|
||||
widget, "hseparator",
|
||||
horizontal_padding + style->xthickness,
|
||||
(height - separator_height - style->ythickness) / 2,
|
||||
width - 2 * (horizontal_padding + style->xthickness),
|
||||
separator_height);
|
||||
gtk_render_frame (context, cr,
|
||||
horizontal_padding + padding.left,
|
||||
(height - separator_height - padding.top) / 2,
|
||||
width - (2 * horizontal_padding) - padding.left - padding.right,
|
||||
separator_height);
|
||||
else
|
||||
gtk_paint_hline (style, cr,
|
||||
GTK_STATE_NORMAL, widget, "menuitem",
|
||||
horizontal_padding + style->xthickness,
|
||||
width - horizontal_padding - style->xthickness - 1,
|
||||
(height - style->ythickness) / 2);
|
||||
gtk_render_line (context, cr,
|
||||
horizontal_padding + padding.left,
|
||||
(height - padding.top) / 2,
|
||||
width - horizontal_padding - padding.right - 1,
|
||||
(height - padding.top) / 2);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->draw (widget, cr);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1960,7 +1990,10 @@ get_offsets (GtkMenu *menu,
|
||||
{
|
||||
gint vertical_padding;
|
||||
gint horizontal_padding;
|
||||
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"horizontal-offset", horizontal_offset,
|
||||
"vertical-offset", vertical_offset,
|
||||
@ -1968,7 +2001,11 @@ get_offsets (GtkMenu *menu,
|
||||
"vertical-padding", &vertical_padding,
|
||||
NULL);
|
||||
|
||||
*vertical_offset -= gtk_widget_get_style (GTK_WIDGET (menu))->ythickness;
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (menu));
|
||||
state = gtk_widget_get_state_flags (GTK_WIDGET (menu));
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
*vertical_offset -= padding.top;
|
||||
*vertical_offset -= vertical_padding;
|
||||
*horizontal_offset += horizontal_padding;
|
||||
}
|
||||
@ -1995,8 +2032,10 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
gint monitor_num;
|
||||
gint horizontal_offset;
|
||||
gint vertical_offset;
|
||||
gint parent_xthickness;
|
||||
gint available_left, available_right;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder parent_padding;
|
||||
|
||||
g_return_if_fail (menu != NULL);
|
||||
g_return_if_fail (x != NULL);
|
||||
@ -2078,7 +2117,9 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
else
|
||||
parent_menu_item = NULL;
|
||||
|
||||
parent_xthickness = gtk_widget_get_style (parent)->xthickness;
|
||||
context = gtk_widget_get_style_context (parent);
|
||||
state = gtk_widget_get_state_flags (parent);
|
||||
gtk_style_context_get_padding (context, state, &parent_padding);
|
||||
|
||||
if (parent_menu_item && !GTK_MENU (parent)->priv->torn_off)
|
||||
{
|
||||
@ -2095,24 +2136,24 @@ gtk_menu_item_position_menu (GtkMenu *menu,
|
||||
switch (priv->submenu_direction)
|
||||
{
|
||||
case GTK_DIRECTION_LEFT:
|
||||
if (tx - twidth - parent_xthickness - horizontal_offset >= monitor.x ||
|
||||
if (tx - twidth - parent_padding.left - horizontal_offset >= monitor.x ||
|
||||
available_left >= available_right)
|
||||
tx -= twidth + parent_xthickness + horizontal_offset;
|
||||
tx -= twidth + parent_padding.left + horizontal_offset;
|
||||
else
|
||||
{
|
||||
priv->submenu_direction = GTK_DIRECTION_RIGHT;
|
||||
tx += allocation.width + parent_xthickness + horizontal_offset;
|
||||
tx += allocation.width + parent_padding.right + horizontal_offset;
|
||||
}
|
||||
break;
|
||||
|
||||
case GTK_DIRECTION_RIGHT:
|
||||
if (tx + allocation.width + parent_xthickness + horizontal_offset + twidth <= monitor.x + monitor.width ||
|
||||
if (tx + allocation.width + parent_padding.right + horizontal_offset + twidth <= monitor.x + monitor.width ||
|
||||
available_right >= available_left)
|
||||
tx += allocation.width + parent_xthickness + horizontal_offset;
|
||||
tx += allocation.width + parent_padding.right + horizontal_offset;
|
||||
else
|
||||
{
|
||||
priv->submenu_direction = GTK_DIRECTION_LEFT;
|
||||
tx -= twidth + parent_xthickness + horizontal_offset;
|
||||
tx -= twidth + parent_padding.left + horizontal_offset;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -24,6 +24,19 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkmenushell
|
||||
* @Title: GtkMenuShell
|
||||
* @Short_description: A base class for menu objects
|
||||
*
|
||||
* A #GtkMenuShell is the abstract base class used to derive the
|
||||
* #GtkMenu and #GtkMenuBar subclasses.
|
||||
*
|
||||
* A #GtkMenuShell is a container of #GtkMenuItem objects arranged
|
||||
* in a list which can be navigated, selected, and activated by the
|
||||
* user to perform application functions. A #GtkMenuItem can have a
|
||||
* submenu associated with it, allowing for nested hierarchical menus.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkbindings.h"
|
||||
@ -231,6 +244,12 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
klass->insert = gtk_menu_shell_real_insert;
|
||||
klass->move_selected = gtk_menu_shell_real_move_selected;
|
||||
|
||||
/**
|
||||
* GtkMenuShell::deactivate:
|
||||
* @menushell: the object which received the signal
|
||||
*
|
||||
* This signal is emitted when a menu shell is deactivated.
|
||||
*/
|
||||
menu_shell_signals[DEACTIVATE] =
|
||||
g_signal_new (I_("deactivate"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@ -240,6 +259,13 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkMenuShell::selection-done:
|
||||
* @menushell: the object which received the signal
|
||||
*
|
||||
* This signal is emitted when a selection has been
|
||||
* completed within a menu shell.
|
||||
*/
|
||||
menu_shell_signals[SELECTION_DONE] =
|
||||
g_signal_new (I_("selection-done"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@ -249,6 +275,14 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkMenuShell::move-current:
|
||||
* @menushell: the object which received the signal
|
||||
* @direction: the direction to move
|
||||
*
|
||||
* An keybinding signal which moves the current menu item
|
||||
* in the direction specified by @direction.
|
||||
*/
|
||||
menu_shell_signals[MOVE_CURRENT] =
|
||||
g_signal_new (I_("move-current"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@ -259,6 +293,14 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_MENU_DIRECTION_TYPE);
|
||||
|
||||
/**
|
||||
* GtkMenuShell::activate-current:
|
||||
* @menushell: the object which received the signal
|
||||
* @force_hide: if %TRUE, hide the menu after activating the menu item
|
||||
*
|
||||
* An action signal that activates the current menu item within
|
||||
* the menu shell.
|
||||
*/
|
||||
menu_shell_signals[ACTIVATE_CURRENT] =
|
||||
g_signal_new (I_("activate-current"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@ -269,6 +311,13 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_BOOLEAN);
|
||||
|
||||
/**
|
||||
* GtkMenuShell::cancel:
|
||||
* @menushell: the object which received the signal
|
||||
*
|
||||
* An action signal which cancels the selection within the menu shell.
|
||||
* Causes the #GtkMenuShell::selection-done signal to be emitted.
|
||||
*/
|
||||
menu_shell_signals[CANCEL] =
|
||||
g_signal_new (I_("cancel"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@ -278,6 +327,14 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkMenuShell::cycle-focus:
|
||||
* @menushell: the object which received the signal
|
||||
* @direction: the direction to cycle in
|
||||
*
|
||||
* A keybinding signal which moves the focus in the
|
||||
* given @direction.
|
||||
*/
|
||||
menu_shell_signals[CYCLE_FOCUS] =
|
||||
g_signal_new_class_handler (I_("cycle-focus"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@ -447,6 +504,14 @@ gtk_menu_shell_dispose (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_menu_shell_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_append:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
* @child: The #GtkMenuItem to add
|
||||
*
|
||||
* Adds a new #GtkMenuItem to the end of the menu shell's
|
||||
* item list.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_append (GtkMenuShell *menu_shell,
|
||||
GtkWidget *child)
|
||||
@ -454,6 +519,14 @@ gtk_menu_shell_append (GtkMenuShell *menu_shell,
|
||||
gtk_menu_shell_insert (menu_shell, child, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_prepend:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
* @child: The #GtkMenuItem to add
|
||||
*
|
||||
* Adds a new #GtkMenuItem to the beginning of the menu shell's
|
||||
* item list.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
|
||||
GtkWidget *child)
|
||||
@ -461,6 +534,16 @@ gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
|
||||
gtk_menu_shell_insert (menu_shell, child, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_insert:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
* @child: The #GtkMenuItem to add
|
||||
* @position: The position in the item list where @child
|
||||
* is added. Positions are numbered from 0 to n-1
|
||||
*
|
||||
* Adds a new #GtkMenuItem to the menu shell's item list
|
||||
* at the position indicated by @position.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_insert (GtkMenuShell *menu_shell,
|
||||
GtkWidget *child,
|
||||
@ -489,6 +572,15 @@ gtk_menu_shell_real_insert (GtkMenuShell *menu_shell,
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (menu_shell));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_deactivate:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
*
|
||||
* Deactivates the menu shell.
|
||||
*
|
||||
* Typically this results in the menu shell being erased
|
||||
* from the screen.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_deactivate (GtkMenuShell *menu_shell)
|
||||
{
|
||||
@ -504,6 +596,7 @@ gtk_menu_shell_realize (GtkWidget *widget)
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
GtkStyleContext *context;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
@ -531,8 +624,8 @@ gtk_menu_shell_realize (GtkWidget *widget)
|
||||
gtk_widget_set_window (widget, window);
|
||||
gdk_window_set_user_data (window, widget);
|
||||
|
||||
gtk_widget_style_attach (widget);
|
||||
gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_NORMAL);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_set_background (context, window);
|
||||
}
|
||||
|
||||
void
|
||||
@ -945,7 +1038,7 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
|
||||
|
||||
if (event->detail != GDK_NOTIFY_INFERIOR)
|
||||
{
|
||||
if (gtk_widget_get_state (menu_item) != GTK_STATE_PRELIGHT)
|
||||
if ((gtk_widget_get_state_flags (menu_item) & GTK_STATE_FLAG_PRELIGHT) == 0)
|
||||
gtk_menu_shell_select_item (menu_shell, menu_item);
|
||||
|
||||
/* If any mouse button is down, and there is a submenu
|
||||
@ -1015,7 +1108,7 @@ gtk_menu_shell_leave_notify (GtkWidget *widget,
|
||||
(menu_item->priv->submenu == NULL))
|
||||
{
|
||||
if ((event->detail != GDK_NOTIFY_INFERIOR) &&
|
||||
(gtk_widget_get_state (GTK_WIDGET (menu_item)) != GTK_STATE_NORMAL))
|
||||
(gtk_widget_get_state_flags (GTK_WIDGET (menu_item)) & GTK_STATE_FLAG_PRELIGHT) != 0)
|
||||
{
|
||||
gtk_menu_shell_deselect (menu_shell);
|
||||
}
|
||||
@ -1172,6 +1265,13 @@ gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
|
||||
|
||||
/* Handlers for action signals */
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_select_item:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
* @menu_item: The #GtkMenuItem to select
|
||||
*
|
||||
* Selects the menu item from the menu shell.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
|
||||
GtkWidget *menu_item)
|
||||
@ -1231,6 +1331,13 @@ gtk_menu_shell_real_select_item (GtkMenuShell *menu_shell,
|
||||
gtk_widget_activate (priv->active_menu_item);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_deselect:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
*
|
||||
* Deselects the currently selected item from the menu shell,
|
||||
* if any.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_deselect (GtkMenuShell *menu_shell)
|
||||
{
|
||||
@ -1246,6 +1353,15 @@ gtk_menu_shell_deselect (GtkMenuShell *menu_shell)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_shell_activate_item:
|
||||
* @menu_shell: a #GtkMenuShell
|
||||
* @menu_item: the #GtkMenuItem to activate
|
||||
* @force_deactivate: if %TRUE, force the deactivation of the
|
||||
* menu shell after the menu item is activated
|
||||
*
|
||||
* Activates the menu item within the menu shell.
|
||||
*/
|
||||
void
|
||||
gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
|
||||
GtkWidget *menu_item,
|
||||
|
@ -80,8 +80,6 @@ void
|
||||
gtk_orientable_set_orientation (GtkOrientable *orientable,
|
||||
GtkOrientation orientation)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
|
||||
|
||||
g_object_set (orientable,
|
||||
@ -89,20 +87,7 @@ gtk_orientable_set_orientation (GtkOrientable *orientable,
|
||||
NULL);
|
||||
|
||||
if (GTK_IS_WIDGET (orientable))
|
||||
{
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
||||
}
|
||||
}
|
||||
_gtk_orientable_set_style_classes (orientable);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,3 +114,27 @@ gtk_orientable_get_orientation (GtkOrientable *orientable)
|
||||
|
||||
return orientation;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_orientable_set_style_classes (GtkOrientable *orientable)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkOrientation orientation;
|
||||
|
||||
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
|
||||
g_return_if_fail (GTK_IS_WIDGET (orientable));
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
|
||||
orientation = gtk_orientable_get_orientation (orientable);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ void gtk_orientable_set_orientation (GtkOrientable *orientable,
|
||||
GtkOrientation orientation);
|
||||
GtkOrientation gtk_orientable_get_orientation (GtkOrientable *orientable);
|
||||
|
||||
/* Private */
|
||||
void _gtk_orientable_set_style_classes (GtkOrientable *orientable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ORIENTABLE_H__ */
|
||||
|
@ -63,7 +63,7 @@ struct _GtkPaperSize
|
||||
gchar *name;
|
||||
gchar *display_name;
|
||||
gchar *ppd_name;
|
||||
|
||||
|
||||
gdouble width, height; /* Stored in mm */
|
||||
gboolean is_custom;
|
||||
};
|
||||
@ -80,7 +80,7 @@ lookup_paper_info (const gchar *name)
|
||||
int mid;
|
||||
int cmp;
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
mid = (lower + upper) / 2;
|
||||
cmp = strcmp (name, paper_names + standard_names_offsets[mid].name);
|
||||
@ -89,7 +89,7 @@ lookup_paper_info (const gchar *name)
|
||||
else if (cmp > 0)
|
||||
lower = mid + 1;
|
||||
else
|
||||
return &standard_names_offsets[mid];
|
||||
return &standard_names_offsets[mid];
|
||||
}
|
||||
while (lower <= upper);
|
||||
|
||||
@ -98,15 +98,15 @@ lookup_paper_info (const gchar *name)
|
||||
|
||||
static gboolean
|
||||
parse_media_size (const gchar *size,
|
||||
gdouble *width_mm,
|
||||
gdouble *height_mm)
|
||||
gdouble *width_mm,
|
||||
gdouble *height_mm)
|
||||
{
|
||||
const char *p;
|
||||
char *e;
|
||||
double short_dim, long_dim;
|
||||
|
||||
p = size;
|
||||
|
||||
|
||||
short_dim = g_ascii_strtod (p, &e);
|
||||
|
||||
if (p == e || *e != 'x')
|
||||
@ -133,19 +133,19 @@ parse_media_size (const gchar *size,
|
||||
*width_mm = short_dim;
|
||||
if (height_mm)
|
||||
*height_mm = long_dim;
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_full_media_size_name (const gchar *full_name,
|
||||
gchar **name,
|
||||
gdouble *width_mm,
|
||||
gdouble *height_mm)
|
||||
gchar **name,
|
||||
gdouble *width_mm,
|
||||
gdouble *height_mm)
|
||||
{
|
||||
const char *p;
|
||||
const char *end_of_name;
|
||||
|
||||
|
||||
/* From the spec:
|
||||
media-size-self-describing-name =
|
||||
( class-in "_" size-name "_" short-dim "x" long-dim "in" ) |
|
||||
@ -170,7 +170,7 @@ parse_full_media_size_name (const gchar *full_name,
|
||||
return FALSE;
|
||||
|
||||
p++; /* Skip _ */
|
||||
|
||||
|
||||
p = strchr (p, '_');
|
||||
if (p == NULL)
|
||||
return FALSE;
|
||||
@ -184,20 +184,20 @@ parse_full_media_size_name (const gchar *full_name,
|
||||
|
||||
if (name)
|
||||
*name = g_strndup (full_name, end_of_name - full_name);
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkPaperSize *
|
||||
gtk_paper_size_new_from_info (const PaperInfo *info)
|
||||
{
|
||||
GtkPaperSize *size;
|
||||
|
||||
|
||||
size = g_slice_new0 (GtkPaperSize);
|
||||
size->info = info;
|
||||
size->width = info->width;
|
||||
size->height = info->height;
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ gtk_paper_size_new_from_info (const PaperInfo *info)
|
||||
*
|
||||
* If @name is %NULL, the default paper size is returned,
|
||||
* see gtk_paper_size_get_default().
|
||||
*
|
||||
*
|
||||
* Return value: a new #GtkPaperSize, use gtk_paper_size_free()
|
||||
* to free it
|
||||
*
|
||||
@ -227,35 +227,44 @@ gtk_paper_size_new (const gchar *name)
|
||||
|
||||
if (name == NULL)
|
||||
name = gtk_paper_size_get_default ();
|
||||
|
||||
|
||||
if (parse_full_media_size_name (name, &short_name, &width, &height))
|
||||
{
|
||||
size = g_slice_new0 (GtkPaperSize);
|
||||
info = lookup_paper_info (short_name);
|
||||
if (info != NULL && info->width == width && info->height == height)
|
||||
{
|
||||
size = gtk_paper_size_new_from_info (info);
|
||||
g_free (short_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
size = g_slice_new0 (GtkPaperSize);
|
||||
|
||||
size->width = width;
|
||||
size->height = height;
|
||||
size->name = short_name;
|
||||
size->display_name = g_strdup (short_name);
|
||||
if (strncmp (short_name, "custom", 6) == 0)
|
||||
size->is_custom = TRUE;
|
||||
size->width = width;
|
||||
size->height = height;
|
||||
size->name = short_name;
|
||||
size->display_name = g_strdup (short_name);
|
||||
if (strncmp (short_name, "custom", 6) == 0)
|
||||
size->is_custom = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info = lookup_paper_info (name);
|
||||
if (info != NULL)
|
||||
size = gtk_paper_size_new_from_info (info);
|
||||
size = gtk_paper_size_new_from_info (info);
|
||||
else
|
||||
{
|
||||
g_warning ("Unknown paper size %s\n", name);
|
||||
size = g_slice_new0 (GtkPaperSize);
|
||||
size->name = g_strdup (name);
|
||||
size->display_name = g_strdup (name);
|
||||
/* Default to A4 size */
|
||||
size->width = 210;
|
||||
size->height = 297;
|
||||
}
|
||||
{
|
||||
g_warning ("Unknown paper size %s\n", name);
|
||||
size = g_slice_new0 (GtkPaperSize);
|
||||
size->name = g_strdup (name);
|
||||
size->display_name = g_strdup (name);
|
||||
/* Default to A4 size */
|
||||
size->width = 210;
|
||||
size->height = 297;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -265,12 +274,12 @@ gtk_paper_size_new (const gchar *name)
|
||||
* @ppd_display_name: the corresponding human-readable name
|
||||
* @width: the paper width, in points
|
||||
* @height: the paper height in points
|
||||
*
|
||||
* Creates a new #GtkPaperSize object by using
|
||||
* PPD information.
|
||||
*
|
||||
* If @ppd_name is not a recognized PPD paper name,
|
||||
* @ppd_display_name, @width and @height are used to
|
||||
*
|
||||
* Creates a new #GtkPaperSize object by using
|
||||
* PPD information.
|
||||
*
|
||||
* If @ppd_name is not a recognized PPD paper name,
|
||||
* @ppd_display_name, @width and @height are used to
|
||||
* construct a custom #GtkPaperSize object.
|
||||
*
|
||||
* Return value: a new #GtkPaperSize, use gtk_paper_size_free()
|
||||
@ -280,9 +289,9 @@ gtk_paper_size_new (const gchar *name)
|
||||
*/
|
||||
GtkPaperSize *
|
||||
gtk_paper_size_new_from_ppd (const gchar *ppd_name,
|
||||
const gchar *ppd_display_name,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
const gchar *ppd_display_name,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
{
|
||||
char *name;
|
||||
const char *lookup_ppd_name;
|
||||
@ -291,32 +300,32 @@ gtk_paper_size_new_from_ppd (const gchar *ppd_name,
|
||||
int i;
|
||||
|
||||
lookup_ppd_name = ppd_name;
|
||||
|
||||
|
||||
freeme = NULL;
|
||||
/* Strip out Traverse suffix in matching. */
|
||||
if (g_str_has_suffix (ppd_name, ".Transverse"))
|
||||
{
|
||||
lookup_ppd_name = freeme =
|
||||
g_strndup (ppd_name, strlen (ppd_name) - strlen (".Transverse"));
|
||||
g_strndup (ppd_name, strlen (ppd_name) - strlen (".Transverse"));
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(standard_names_offsets); i++)
|
||||
{
|
||||
if (standard_names_offsets[i].ppd_name != -1 &&
|
||||
strcmp (paper_names + standard_names_offsets[i].ppd_name, lookup_ppd_name) == 0)
|
||||
{
|
||||
size = gtk_paper_size_new_from_info (&standard_names_offsets[i]);
|
||||
goto out;
|
||||
}
|
||||
strcmp (paper_names + standard_names_offsets[i].ppd_name, lookup_ppd_name) == 0)
|
||||
{
|
||||
size = gtk_paper_size_new_from_info (&standard_names_offsets[i]);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(extra_ppd_names_offsets); i++)
|
||||
{
|
||||
if (strcmp (paper_names + extra_ppd_names_offsets[i].ppd_name, lookup_ppd_name) == 0)
|
||||
{
|
||||
size = gtk_paper_size_new (paper_names + extra_ppd_names_offsets[i].standard_name);
|
||||
goto out;
|
||||
}
|
||||
{
|
||||
size = gtk_paper_size_new (paper_names + extra_ppd_names_offsets[i].standard_name);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
name = g_strconcat ("ppd_", ppd_name, NULL);
|
||||
@ -329,57 +338,57 @@ gtk_paper_size_new_from_ppd (const gchar *ppd_name,
|
||||
size->info->ppd_name == -1 ||
|
||||
strcmp (paper_names + size->info->ppd_name, ppd_name) != 0)
|
||||
size->ppd_name = g_strdup (ppd_name);
|
||||
|
||||
|
||||
g_free (freeme);
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_paper_size_new_custom:
|
||||
* @name: the paper name
|
||||
* @name: the paper name
|
||||
* @display_name: the human-readable name
|
||||
* @width: the paper width, in units of @unit
|
||||
* @height: the paper height, in units of @unit
|
||||
* @unit: the unit for @width and @height
|
||||
*
|
||||
*
|
||||
* Creates a new #GtkPaperSize object with the
|
||||
* given parameters.
|
||||
*
|
||||
*
|
||||
* Return value: a new #GtkPaperSize object, use gtk_paper_size_free()
|
||||
* to free it
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
GtkPaperSize *
|
||||
gtk_paper_size_new_custom (const gchar *name,
|
||||
const gchar *display_name,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_new_custom (const gchar *name,
|
||||
const gchar *display_name,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkUnit unit)
|
||||
{
|
||||
GtkPaperSize *size;
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (unit != GTK_UNIT_PIXEL, NULL);
|
||||
|
||||
size = g_slice_new0 (GtkPaperSize);
|
||||
|
||||
|
||||
size->name = g_strdup (name);
|
||||
size->display_name = g_strdup (display_name);
|
||||
size->is_custom = TRUE;
|
||||
|
||||
|
||||
size->width = _gtk_print_convert_to_mm (width, unit);
|
||||
size->height = _gtk_print_convert_to_mm (height, unit);
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_paper_size_copy:
|
||||
* @other: a #GtkPaperSize
|
||||
*
|
||||
*
|
||||
* Copies an existing #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: a copy of @other
|
||||
*
|
||||
* Since: 2.10
|
||||
@ -398,7 +407,7 @@ gtk_paper_size_copy (GtkPaperSize *other)
|
||||
size->display_name = g_strdup (other->display_name);
|
||||
if (other->ppd_name)
|
||||
size->ppd_name = g_strdup (other->ppd_name);
|
||||
|
||||
|
||||
size->width = other->width;
|
||||
size->height = other->height;
|
||||
size->is_custom = other->is_custom;
|
||||
@ -409,7 +418,7 @@ gtk_paper_size_copy (GtkPaperSize *other)
|
||||
/**
|
||||
* gtk_paper_size_free:
|
||||
* @size: a #GtkPaperSize
|
||||
*
|
||||
*
|
||||
* Free the given #GtkPaperSize object.
|
||||
*
|
||||
* Since: 2.10
|
||||
@ -428,23 +437,23 @@ gtk_paper_size_free (GtkPaperSize *size)
|
||||
* gtk_paper_size_is_equal:
|
||||
* @size1: a #GtkPaperSize object
|
||||
* @size2: another #GtkPaperSize object
|
||||
*
|
||||
*
|
||||
* Compares two #GtkPaperSize objects.
|
||||
*
|
||||
* Return value: %TRUE, if @size1 and @size2
|
||||
*
|
||||
* Return value: %TRUE, if @size1 and @size2
|
||||
* represent the same paper size
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gboolean
|
||||
gtk_paper_size_is_equal (GtkPaperSize *size1,
|
||||
GtkPaperSize *size2)
|
||||
GtkPaperSize *size2)
|
||||
{
|
||||
if (size1->info != NULL && size2->info != NULL)
|
||||
return size1->info == size2->info;
|
||||
|
||||
|
||||
return strcmp (gtk_paper_size_get_name (size1),
|
||||
gtk_paper_size_get_name (size2)) == 0;
|
||||
gtk_paper_size_get_name (size2)) == 0;
|
||||
}
|
||||
|
||||
GList * _gtk_load_custom_papers (void);
|
||||
@ -466,7 +475,7 @@ gtk_paper_size_get_paper_sizes (gboolean include_custom)
|
||||
{
|
||||
GList *list = NULL;
|
||||
guint i;
|
||||
#ifdef G_OS_UNIX /* _gtk_load_custom_papers() only on Unix so far */
|
||||
#ifdef G_OS_UNIX /* _gtk_load_custom_papers() only on Unix so far */
|
||||
if (include_custom)
|
||||
{
|
||||
GList *page_setups, *l;
|
||||
@ -500,9 +509,9 @@ gtk_paper_size_get_paper_sizes (gboolean include_custom)
|
||||
/**
|
||||
* gtk_paper_size_get_name:
|
||||
* @size: a #GtkPaperSize object
|
||||
*
|
||||
*
|
||||
* Gets the name of the #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: the name of @size
|
||||
*
|
||||
* Since: 2.10
|
||||
@ -519,9 +528,9 @@ gtk_paper_size_get_name (GtkPaperSize *size)
|
||||
/**
|
||||
* gtk_paper_size_get_display_name:
|
||||
* @size: a #GtkPaperSize object
|
||||
*
|
||||
*
|
||||
* Gets the human-readable name of the #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: the human-readable name of @size
|
||||
*
|
||||
* Since: 2.10
|
||||
@ -543,10 +552,10 @@ gtk_paper_size_get_display_name (GtkPaperSize *size)
|
||||
/**
|
||||
* gtk_paper_size_get_ppd_name:
|
||||
* @size: a #GtkPaperSize object
|
||||
*
|
||||
*
|
||||
* Gets the PPD name of the #GtkPaperSize, which
|
||||
* may be %NULL.
|
||||
*
|
||||
*
|
||||
* Return value: the PPD name of @size
|
||||
*
|
||||
* Since: 2.10
|
||||
@ -565,17 +574,17 @@ gtk_paper_size_get_ppd_name (GtkPaperSize *size)
|
||||
* gtk_paper_size_get_width:
|
||||
* @size: a #GtkPaperSize object
|
||||
* @unit: the unit for the return value
|
||||
*
|
||||
* Gets the paper width of the #GtkPaperSize, in
|
||||
*
|
||||
* Gets the paper width of the #GtkPaperSize, in
|
||||
* units of @unit.
|
||||
*
|
||||
* Return value: the paper width
|
||||
*
|
||||
* Return value: the paper width
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gdouble
|
||||
gtk_paper_size_get_width (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_get_width (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
{
|
||||
return _gtk_print_convert_from_mm (size->width, unit);
|
||||
}
|
||||
@ -584,17 +593,17 @@ gtk_paper_size_get_width (GtkPaperSize *size,
|
||||
* gtk_paper_size_get_height:
|
||||
* @size: a #GtkPaperSize object
|
||||
* @unit: the unit for the return value
|
||||
*
|
||||
* Gets the paper height of the #GtkPaperSize, in
|
||||
*
|
||||
* Gets the paper height of the #GtkPaperSize, in
|
||||
* units of @unit.
|
||||
*
|
||||
* Return value: the paper height
|
||||
*
|
||||
* Return value: the paper height
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gdouble
|
||||
gtk_paper_size_get_height (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_get_height (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
{
|
||||
return _gtk_print_convert_from_mm (size->height, unit);
|
||||
}
|
||||
@ -602,9 +611,9 @@ gtk_paper_size_get_height (GtkPaperSize *size,
|
||||
/**
|
||||
* gtk_paper_size_is_custom:
|
||||
* @size: a #GtkPaperSize object
|
||||
*
|
||||
*
|
||||
* Returns %TRUE if @size is not a standard paper size.
|
||||
*
|
||||
*
|
||||
* Return value: whether @size is a custom paper size.
|
||||
**/
|
||||
gboolean
|
||||
@ -619,16 +628,16 @@ gtk_paper_size_is_custom (GtkPaperSize *size)
|
||||
* @width: the new width in units of @unit
|
||||
* @height: the new height in units of @unit
|
||||
* @unit: the unit for @width and @height
|
||||
*
|
||||
*
|
||||
* Changes the dimensions of a @size to @width x @height.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
void
|
||||
gtk_paper_size_set_size (GtkPaperSize *size,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_set_size (GtkPaperSize *size,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkUnit unit)
|
||||
{
|
||||
g_return_if_fail (size != NULL);
|
||||
g_return_if_fail (size->is_custom);
|
||||
@ -643,12 +652,12 @@ gtk_paper_size_set_size (GtkPaperSize *size,
|
||||
/**
|
||||
* gtk_paper_size_get_default:
|
||||
*
|
||||
* Returns the name of the default paper size, which
|
||||
* depends on the current locale.
|
||||
*
|
||||
* Returns the name of the default paper size, which
|
||||
* depends on the current locale.
|
||||
*
|
||||
* Return value: the name of the default paper size. The string
|
||||
* is owned by GTK+ and should not be modified.
|
||||
*
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
@ -661,10 +670,10 @@ gtk_paper_size_get_default (void)
|
||||
{
|
||||
int width = NL_PAPER_GET (_NL_PAPER_WIDTH);
|
||||
int height = NL_PAPER_GET (_NL_PAPER_HEIGHT);
|
||||
|
||||
|
||||
if (width == 210 && height == 297)
|
||||
return GTK_PAPER_NAME_A4;
|
||||
|
||||
|
||||
if (width == 216 && height == 279)
|
||||
return GTK_PAPER_NAME_LETTER;
|
||||
}
|
||||
@ -701,7 +710,7 @@ gtk_paper_size_get_default (void)
|
||||
* I've taken the actual values used from the OSX page setup dialog.
|
||||
* I'm not sure exactly where they got these values for, but might
|
||||
* correspond to this (from ghostscript docs):
|
||||
*
|
||||
*
|
||||
* All DeskJets have 0.5 inches (1.27cm) of unprintable bottom margin,
|
||||
* due to the mechanical arrangement used to grab the paper. Side margins
|
||||
* are approximately 0.25 inches (0.64cm) for U.S. letter paper, and 0.15
|
||||
@ -712,16 +721,16 @@ gtk_paper_size_get_default (void)
|
||||
* gtk_paper_size_get_default_top_margin:
|
||||
* @size: a #GtkPaperSize object
|
||||
* @unit: the unit for the return value
|
||||
*
|
||||
*
|
||||
* Gets the default top margin for the #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: the default top margin
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gdouble
|
||||
gtk_paper_size_get_default_top_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_get_default_top_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
{
|
||||
gdouble margin;
|
||||
|
||||
@ -733,16 +742,16 @@ gtk_paper_size_get_default_top_margin (GtkPaperSize *size,
|
||||
* gtk_paper_size_get_default_bottom_margin:
|
||||
* @size: a #GtkPaperSize object
|
||||
* @unit: the unit for the return value
|
||||
*
|
||||
*
|
||||
* Gets the default bottom margin for the #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: the default bottom margin
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gdouble
|
||||
gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
{
|
||||
gdouble margin;
|
||||
const gchar *name;
|
||||
@ -754,7 +763,7 @@ gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
|
||||
strcmp (name, "na_legal") == 0 ||
|
||||
strcmp (name, "iso_a4") == 0)
|
||||
margin = _gtk_print_convert_to_mm (0.56, GTK_UNIT_INCH);
|
||||
|
||||
|
||||
return _gtk_print_convert_from_mm (margin, unit);
|
||||
}
|
||||
|
||||
@ -762,16 +771,16 @@ gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
|
||||
* gtk_paper_size_get_default_left_margin:
|
||||
* @size: a #GtkPaperSize object
|
||||
* @unit: the unit for the return value
|
||||
*
|
||||
*
|
||||
* Gets the default left margin for the #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: the default left margin
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gdouble
|
||||
gtk_paper_size_get_default_left_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_get_default_left_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
{
|
||||
gdouble margin;
|
||||
|
||||
@ -783,16 +792,16 @@ gtk_paper_size_get_default_left_margin (GtkPaperSize *size,
|
||||
* gtk_paper_size_get_default_right_margin:
|
||||
* @size: a #GtkPaperSize object
|
||||
* @unit: the unit for the return value
|
||||
*
|
||||
*
|
||||
* Gets the default right margin for the #GtkPaperSize.
|
||||
*
|
||||
*
|
||||
* Return value: the default right margin
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
gdouble
|
||||
gtk_paper_size_get_default_right_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
gtk_paper_size_get_default_right_margin (GtkPaperSize *size,
|
||||
GtkUnit unit)
|
||||
{
|
||||
gdouble margin;
|
||||
|
||||
@ -808,7 +817,7 @@ gtk_paper_size_get_default_right_margin (GtkPaperSize *size,
|
||||
* @error: (allow-none): return location for an error, or %NULL
|
||||
*
|
||||
* Reads a paper size from the group @group_name in the key file
|
||||
* @key_file.
|
||||
* @key_file.
|
||||
*
|
||||
* Returns: a new #GtkPaperSize object with the restored
|
||||
* paper size, or %NULL if an error occurred.
|
||||
@ -817,8 +826,8 @@ gtk_paper_size_get_default_right_margin (GtkPaperSize *size,
|
||||
*/
|
||||
GtkPaperSize *
|
||||
gtk_paper_size_new_from_key_file (GKeyFile *key_file,
|
||||
const gchar *group_name,
|
||||
GError **error)
|
||||
const gchar *group_name,
|
||||
GError **error)
|
||||
{
|
||||
GtkPaperSize *paper_size = NULL;
|
||||
char *name = NULL, *ppd_name = NULL, *display_name = NULL, *freeme = NULL;
|
||||
@ -855,11 +864,11 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
|
||||
#undef GET_DOUBLE
|
||||
|
||||
name = g_key_file_get_string (key_file, group_name,
|
||||
"Name", NULL);
|
||||
"Name", NULL);
|
||||
ppd_name = g_key_file_get_string (key_file, group_name,
|
||||
"PPDName", NULL);
|
||||
"PPDName", NULL);
|
||||
display_name = g_key_file_get_string (key_file, group_name,
|
||||
"DisplayName", NULL);
|
||||
"DisplayName", NULL);
|
||||
/* Fallback for old ~/.gtk-custom-paper entries */
|
||||
if (!display_name)
|
||||
display_name = g_strdup (name);
|
||||
@ -871,7 +880,7 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
|
||||
_gtk_print_convert_from_mm (height, GTK_UNIT_POINTS));
|
||||
else if (name != NULL)
|
||||
paper_size = gtk_paper_size_new_custom (name, display_name,
|
||||
width, height, GTK_UNIT_MM);
|
||||
width, height, GTK_UNIT_MM);
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
@ -904,8 +913,8 @@ out:
|
||||
*/
|
||||
void
|
||||
gtk_paper_size_to_key_file (GtkPaperSize *size,
|
||||
GKeyFile *key_file,
|
||||
const gchar *group_name)
|
||||
GKeyFile *key_file,
|
||||
const gchar *group_name)
|
||||
{
|
||||
const char *name, *ppd_name, *display_name;
|
||||
|
||||
@ -916,19 +925,19 @@ gtk_paper_size_to_key_file (GtkPaperSize *size,
|
||||
display_name = gtk_paper_size_get_display_name (size);
|
||||
ppd_name = gtk_paper_size_get_ppd_name (size);
|
||||
|
||||
if (ppd_name != NULL)
|
||||
if (ppd_name != NULL)
|
||||
g_key_file_set_string (key_file, group_name,
|
||||
"PPDName", ppd_name);
|
||||
"PPDName", ppd_name);
|
||||
else
|
||||
g_key_file_set_string (key_file, group_name,
|
||||
"Name", name);
|
||||
"Name", name);
|
||||
|
||||
if (display_name)
|
||||
if (display_name)
|
||||
g_key_file_set_string (key_file, group_name,
|
||||
"DisplayName", display_name);
|
||||
"DisplayName", display_name);
|
||||
|
||||
g_key_file_set_double (key_file, group_name,
|
||||
"Width", gtk_paper_size_get_width (size, GTK_UNIT_MM));
|
||||
"Width", gtk_paper_size_get_width (size, GTK_UNIT_MM));
|
||||
g_key_file_set_double (key_file, group_name,
|
||||
"Height", gtk_paper_size_get_height (size, GTK_UNIT_MM));
|
||||
"Height", gtk_paper_size_get_height (size, GTK_UNIT_MM));
|
||||
}
|
||||
|
@ -17,6 +17,21 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkprintjob
|
||||
* @Title: GtkPrintJob
|
||||
* @Short_description: Represents a print job
|
||||
*
|
||||
* A #GtkPrintJob object represents a job that is sent to a
|
||||
* printer. You only need to deal directly with print jobs if
|
||||
* you use the non-portable #GtkPrintUnixDialog API.
|
||||
*
|
||||
* Use gtk_print_job_get_surface() to obtain the cairo surface
|
||||
* onto which the pages must be drawn. Use gtk_print_job_send()
|
||||
* to send the finished job to the printer. If you don't use cairo
|
||||
* #GtkPrintJob also supports printing of manually generated postscript,
|
||||
* via gtk_print_job_set_source_file().
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -42,6 +42,16 @@ typedef struct _GtkPrintJob GtkPrintJob;
|
||||
typedef struct _GtkPrintJobClass GtkPrintJobClass;
|
||||
typedef struct _GtkPrintJobPrivate GtkPrintJobPrivate;
|
||||
|
||||
/**
|
||||
* GtkPrintJobCompleteFunc:
|
||||
* @print_job: the #GtkPrintJob
|
||||
* @user_data: user data that has been passed to gtk_print_job_send()
|
||||
* @error: a #GError that contains error information if the sending
|
||||
* of the print job failed, otherwise %NULL
|
||||
*
|
||||
* The type of callback that is passed to gtk_print_job_send().
|
||||
* It is called when the print job has been completely sent.
|
||||
*/
|
||||
typedef void (*GtkPrintJobCompleteFunc) (GtkPrintJob *print_job,
|
||||
gpointer user_data,
|
||||
const GError *error);
|
||||
|
@ -1208,6 +1208,7 @@ gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
|
||||
if (priv->orientation != orientation)
|
||||
{
|
||||
priv->orientation = orientation;
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (pbar));
|
||||
|
||||
if (gtk_widget_is_drawable (GTK_WIDGET (pbar)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (pbar));
|
||||
|
@ -51,6 +51,32 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkselection
|
||||
* @Title: Selections
|
||||
* @Short_description: Functions for handling inter-process communication
|
||||
* via selections
|
||||
* @See_also: #GtkWidget - Much of the operation of selections happens via
|
||||
* signals for #GtkWidget. In particular, if you are using the functions
|
||||
* in this section, you may need to pay attention to
|
||||
* #GtkWidget::selection-get, #GtkWidget::selection-received and
|
||||
* #GtkWidget::selection-clear-event signals
|
||||
*
|
||||
* The selection mechanism provides the basis for different types
|
||||
* of communication between processes. In particular, drag and drop and
|
||||
* #GtkClipboard work via selections. You will very seldom or
|
||||
* never need to use most of the functions in this section directly;
|
||||
* #GtkClipboard provides a nicer interface to the same functionality.
|
||||
*
|
||||
* Some of the datatypes defined this section are used in
|
||||
* the #GtkClipboard and drag-and-drop API's as well. The
|
||||
* #GtkTargetEntry structure and #GtkTargetList objects represent
|
||||
* lists of data types that are supported when sending or
|
||||
* receiving data. The #GtkSelectionData object is used to
|
||||
* store a chunk of data along with the data type and other
|
||||
* associated information.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkselection.h"
|
||||
|
@ -31,19 +31,39 @@
|
||||
#ifndef __GTK_SELECTION_H__
|
||||
#define __GTK_SELECTION_H__
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/gtktextiter.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkTargetList GtkTargetList;
|
||||
typedef struct _GtkTargetEntry GtkTargetEntry;
|
||||
/**
|
||||
* GtkTargetList:
|
||||
*
|
||||
* A #GtkTargetList structure is a reference counted list
|
||||
* of #GtkTargetPair. It is used to represent the same
|
||||
* information as a table of #GtkTargetEntry, but in
|
||||
* an efficient form. This structure should be treated as
|
||||
* opaque.
|
||||
*/
|
||||
typedef struct _GtkTargetList GtkTargetList;
|
||||
typedef struct _GtkTargetEntry GtkTargetEntry;
|
||||
|
||||
#define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
|
||||
#define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
|
||||
|
||||
/**
|
||||
* GtkTargetEntry:
|
||||
* @target: a string representation of the target type
|
||||
* @flags: #GtkTargetFlags for DND
|
||||
* @info: an application-assigned integer ID which will
|
||||
* get passed as a parater to e.g the #GtkWiget::selection-get
|
||||
* signal. It allows the application to identify the target
|
||||
* type without extensive string compares.
|
||||
*
|
||||
* A #GtkTargetEntry structure represents a single type of
|
||||
* data than can be supplied for by a widget for a selection
|
||||
* or for supplied or received during drag-and-drop.
|
||||
*/
|
||||
struct _GtkTargetEntry
|
||||
{
|
||||
gchar *target;
|
||||
@ -51,32 +71,15 @@ struct _GtkTargetEntry
|
||||
guint info;
|
||||
};
|
||||
|
||||
/* These structures not public, and are here only for the convenience of
|
||||
* gtkdnd.c
|
||||
*/
|
||||
|
||||
typedef struct _GtkTargetPair GtkTargetPair;
|
||||
|
||||
/* This structure is a list of destinations, and associated guint id's */
|
||||
struct _GtkTargetList {
|
||||
GList *list;
|
||||
guint ref_count;
|
||||
};
|
||||
|
||||
struct _GtkTargetPair {
|
||||
GdkAtom target;
|
||||
guint flags;
|
||||
guint info;
|
||||
};
|
||||
|
||||
GType gtk_target_list_get_type (void) G_GNUC_CONST;
|
||||
GtkTargetList *gtk_target_list_new (const GtkTargetEntry *targets,
|
||||
guint ntargets);
|
||||
guint ntargets);
|
||||
GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
|
||||
void gtk_target_list_unref (GtkTargetList *list);
|
||||
void gtk_target_list_add (GtkTargetList *list,
|
||||
GdkAtom target,
|
||||
guint flags,
|
||||
guint info);
|
||||
GdkAtom target,
|
||||
guint flags,
|
||||
guint info);
|
||||
void gtk_target_list_add_text_targets (GtkTargetList *list,
|
||||
guint info);
|
||||
void gtk_target_list_add_rich_text_targets (GtkTargetList *list,
|
||||
@ -89,43 +92,42 @@ void gtk_target_list_add_image_targets (GtkTargetList *list,
|
||||
void gtk_target_list_add_uri_targets (GtkTargetList *list,
|
||||
guint info);
|
||||
void gtk_target_list_add_table (GtkTargetList *list,
|
||||
const GtkTargetEntry *targets,
|
||||
guint ntargets);
|
||||
const GtkTargetEntry *targets,
|
||||
guint ntargets);
|
||||
void gtk_target_list_remove (GtkTargetList *list,
|
||||
GdkAtom target);
|
||||
GdkAtom target);
|
||||
gboolean gtk_target_list_find (GtkTargetList *list,
|
||||
GdkAtom target,
|
||||
guint *info);
|
||||
GdkAtom target,
|
||||
guint *info);
|
||||
|
||||
GtkTargetEntry * gtk_target_table_new_from_list (GtkTargetList *list,
|
||||
gint *n_targets);
|
||||
void gtk_target_table_free (GtkTargetEntry *targets,
|
||||
gint n_targets);
|
||||
|
||||
/* Public interface */
|
||||
|
||||
gboolean gtk_selection_owner_set (GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
guint32 time_);
|
||||
GdkAtom selection,
|
||||
guint32 time_);
|
||||
gboolean gtk_selection_owner_set_for_display (GdkDisplay *display,
|
||||
GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
guint32 time_);
|
||||
GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
guint32 time_);
|
||||
|
||||
void gtk_selection_add_target (GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint info);
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint info);
|
||||
void gtk_selection_add_targets (GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
const GtkTargetEntry *targets,
|
||||
guint ntargets);
|
||||
GdkAtom selection,
|
||||
const GtkTargetEntry *targets,
|
||||
guint ntargets);
|
||||
void gtk_selection_clear_targets (GtkWidget *widget,
|
||||
GdkAtom selection);
|
||||
GdkAtom selection);
|
||||
gboolean gtk_selection_convert (GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time_);
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time_);
|
||||
void gtk_selection_remove_all (GtkWidget *widget);
|
||||
|
||||
GdkAtom gtk_selection_data_get_selection (const GtkSelectionData *selection_data);
|
||||
GdkAtom gtk_selection_data_get_target (const GtkSelectionData *selection_data);
|
||||
@ -140,68 +142,52 @@ const guchar *gtk_selection_data_get_data_with_length
|
||||
GdkDisplay *gtk_selection_data_get_display (const GtkSelectionData *selection_data);
|
||||
|
||||
void gtk_selection_data_set (GtkSelectionData *selection_data,
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
const guchar *data,
|
||||
gint length);
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
const guchar *data,
|
||||
gint length);
|
||||
gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
|
||||
const gchar *str,
|
||||
gint len);
|
||||
const gchar *str,
|
||||
gint len);
|
||||
guchar * gtk_selection_data_get_text (const GtkSelectionData *selection_data);
|
||||
gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
|
||||
GdkPixbuf *pixbuf);
|
||||
GdkPixbuf *pixbuf);
|
||||
GdkPixbuf *gtk_selection_data_get_pixbuf (const GtkSelectionData *selection_data);
|
||||
gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data,
|
||||
gchar **uris);
|
||||
gchar **uris);
|
||||
gchar **gtk_selection_data_get_uris (const GtkSelectionData *selection_data);
|
||||
|
||||
gboolean gtk_selection_data_get_targets (const GtkSelectionData *selection_data,
|
||||
GdkAtom **targets,
|
||||
gint *n_atoms);
|
||||
GdkAtom **targets,
|
||||
gint *n_atoms);
|
||||
gboolean gtk_selection_data_targets_include_text (const GtkSelectionData *selection_data);
|
||||
gboolean gtk_selection_data_targets_include_rich_text (const GtkSelectionData *selection_data,
|
||||
GtkTextBuffer *buffer);
|
||||
gboolean gtk_selection_data_targets_include_image (const GtkSelectionData *selection_data,
|
||||
gboolean writable);
|
||||
gboolean writable);
|
||||
gboolean gtk_selection_data_targets_include_uri (const GtkSelectionData *selection_data);
|
||||
gboolean gtk_targets_include_text (GdkAtom *targets,
|
||||
gint n_targets);
|
||||
gint n_targets);
|
||||
gboolean gtk_targets_include_rich_text (GdkAtom *targets,
|
||||
gint n_targets,
|
||||
gint n_targets,
|
||||
GtkTextBuffer *buffer);
|
||||
gboolean gtk_targets_include_image (GdkAtom *targets,
|
||||
gint n_targets,
|
||||
gboolean writable);
|
||||
gint n_targets,
|
||||
gboolean writable);
|
||||
gboolean gtk_targets_include_uri (GdkAtom *targets,
|
||||
gint n_targets);
|
||||
gint n_targets);
|
||||
|
||||
/* Called when a widget is destroyed */
|
||||
|
||||
void gtk_selection_remove_all (GtkWidget *widget);
|
||||
|
||||
/* Event handlers */
|
||||
gboolean _gtk_selection_clear (GtkWidget *widget,
|
||||
GdkEventSelection *event);
|
||||
gboolean _gtk_selection_request (GtkWidget *widget,
|
||||
GdkEventSelection *event);
|
||||
gboolean _gtk_selection_incr_event (GdkWindow *window,
|
||||
GdkEventProperty *event);
|
||||
gboolean _gtk_selection_notify (GtkWidget *widget,
|
||||
GdkEventSelection *event);
|
||||
gboolean _gtk_selection_property_notify (GtkWidget *widget,
|
||||
GdkEventProperty *event);
|
||||
|
||||
GType gtk_selection_data_get_type (void) G_GNUC_CONST;
|
||||
GtkSelectionData *gtk_selection_data_copy (const GtkSelectionData *data);
|
||||
void gtk_selection_data_free (GtkSelectionData *data);
|
||||
void gtk_selection_data_free (GtkSelectionData *data);
|
||||
|
||||
GType gtk_target_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkTargetEntry *gtk_target_entry_new (const char *target, guint flags, guint info);
|
||||
GtkTargetEntry *gtk_target_entry_new (const gchar *target,
|
||||
guint flags,
|
||||
guint info);
|
||||
GtkTargetEntry *gtk_target_entry_copy (GtkTargetEntry *data);
|
||||
void gtk_target_entry_free (GtkTargetEntry *data);
|
||||
|
||||
GType gtk_target_list_get_type (void) G_GNUC_CONST;
|
||||
void gtk_target_entry_free (GtkTargetEntry *data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -28,6 +28,13 @@
|
||||
* sent.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SELECTIONPRIVATE_H__
|
||||
#define __GTK_SELECTIONPRIVATE_H__
|
||||
|
||||
#include "gtkselection.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _GtkSelectionData
|
||||
{
|
||||
GdkAtom selection;
|
||||
@ -38,3 +45,33 @@ struct _GtkSelectionData
|
||||
gint length;
|
||||
GdkDisplay *display;
|
||||
};
|
||||
|
||||
struct _GtkTargetList
|
||||
{
|
||||
GList *list;
|
||||
guint ref_count;
|
||||
};
|
||||
|
||||
typedef struct _GtkTargetPair GtkTargetPair;
|
||||
struct _GtkTargetPair
|
||||
{
|
||||
GdkAtom target;
|
||||
guint flags;
|
||||
guint info;
|
||||
};
|
||||
|
||||
|
||||
gboolean _gtk_selection_clear (GtkWidget *widget,
|
||||
GdkEventSelection *event);
|
||||
gboolean _gtk_selection_request (GtkWidget *widget,
|
||||
GdkEventSelection *event);
|
||||
gboolean _gtk_selection_incr_event (GdkWindow *window,
|
||||
GdkEventProperty *event);
|
||||
gboolean _gtk_selection_notify (GtkWidget *widget,
|
||||
GdkEventSelection *event);
|
||||
gboolean _gtk_selection_property_notify (GtkWidget *widget,
|
||||
GdkEventProperty *event);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SELECTIONPRIVATE_H__ */
|
||||
|
@ -125,6 +125,7 @@ gtk_separator_set_property (GObject *object,
|
||||
{
|
||||
case PROP_ORIENTATION:
|
||||
private->orientation = g_value_get_enum (value);
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (object));
|
||||
gtk_widget_queue_resize (GTK_WIDGET (object));
|
||||
break;
|
||||
default:
|
||||
|
@ -63,10 +63,16 @@ gtk_show_uri (GdkScreen *screen,
|
||||
{
|
||||
GdkAppLaunchContext *context;
|
||||
gboolean ret;
|
||||
GdkDisplay *display;
|
||||
|
||||
g_return_val_if_fail (uri != NULL, FALSE);
|
||||
|
||||
context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
|
||||
if (screen != NULL)
|
||||
display = gdk_screen_get_display (screen);
|
||||
else
|
||||
display = gdk_display_get_default ();
|
||||
|
||||
context = gdk_display_get_app_launch_context (display);
|
||||
gdk_app_launch_context_set_screen (context, screen);
|
||||
gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
|
||||
|
@ -3613,11 +3613,15 @@ gtk_render_check (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_check (priv->theming_engine, cr,
|
||||
x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3659,11 +3663,15 @@ gtk_render_option (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_option (priv->theming_engine, cr,
|
||||
x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3702,11 +3710,15 @@ gtk_render_arrow (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, size, size);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_arrow (priv->theming_engine, cr,
|
||||
angle, x, y, size);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3749,10 +3761,14 @@ gtk_render_background (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_background (priv->theming_engine, cr, x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3797,10 +3813,14 @@ gtk_render_frame (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_frame (priv->theming_engine, cr, x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3842,10 +3862,14 @@ gtk_render_expander (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_expander (priv->theming_engine, cr, x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3884,10 +3908,14 @@ gtk_render_focus (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_focus (priv->theming_engine, cr, x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3920,6 +3948,8 @@ gtk_render_layout (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
pango_layout_get_extents (layout, &extents, NULL);
|
||||
|
||||
store_animation_region (context,
|
||||
@ -3930,6 +3960,8 @@ gtk_render_layout (GtkStyleContext *context,
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_layout (priv->theming_engine, cr, x, y, layout);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3962,8 +3994,12 @@ gtk_render_line (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_line (priv->theming_engine, cr, x0, y0, x1, y1);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4007,10 +4043,14 @@ gtk_render_slider (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_slider (priv->theming_engine, cr, x, y, width, height, orientation);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4055,7 +4095,7 @@ gtk_render_frame_gap (GtkStyleContext *context,
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (width > 0);
|
||||
g_return_if_fail (height > 0);
|
||||
g_return_if_fail (xy0_gap < xy1_gap);
|
||||
g_return_if_fail (xy0_gap <= xy1_gap);
|
||||
g_return_if_fail (xy0_gap >= 0);
|
||||
|
||||
if (gap_side == GTK_POS_LEFT ||
|
||||
@ -4067,12 +4107,16 @@ gtk_render_frame_gap (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_frame_gap (priv->theming_engine, cr,
|
||||
x, y, width, height, gap_side,
|
||||
xy0_gap, xy1_gap);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4116,10 +4160,14 @@ gtk_render_extension (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_extension (priv->theming_engine, cr, x, y, width, height, gap_side);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4161,10 +4209,14 @@ gtk_render_handle (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_handle (priv->theming_engine, cr, x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4201,10 +4253,14 @@ gtk_render_activity (GtkStyleContext *context,
|
||||
priv = context->priv;
|
||||
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
store_animation_region (context, x, y, width, height);
|
||||
|
||||
_gtk_theming_engine_set_context (priv->theming_engine, context);
|
||||
engine_class->render_activity (priv->theming_engine, cr, x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,6 +202,15 @@ gtk_switch_button_release (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* toggle the switch if the handle was clicked but a drag had not been
|
||||
* initiated */
|
||||
if (!priv->is_dragging && !priv->in_press)
|
||||
{
|
||||
gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* dragged toggle */
|
||||
if (priv->is_dragging)
|
||||
{
|
||||
|
@ -97,13 +97,18 @@ gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
|
||||
gint *minimum,
|
||||
gint *natural)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
guint border_width;
|
||||
GtkBorder padding;
|
||||
GtkStateFlags state;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
*minimum = *natural = (border_width + style->xthickness + BORDER_SPACING) * 2;
|
||||
|
||||
*minimum = *natural = (border_width + BORDER_SPACING) * 2 + padding.left + padding.right;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -111,14 +116,19 @@ gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
gint *minimum,
|
||||
gint *natural)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
GtkBorder padding;
|
||||
GtkStateFlags state;
|
||||
GtkWidget *parent;
|
||||
guint border_width;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
*minimum = *natural = (border_width + style->ythickness) * 2;
|
||||
|
||||
*minimum = *natural = (border_width * 2) + padding.top + padding.bottom;
|
||||
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
|
||||
@ -128,8 +138,8 @@ gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
*minimum += style->ythickness + 4;
|
||||
*natural += style->ythickness + 4;
|
||||
*minimum += padding.top + 4;
|
||||
*natural += padding.top + 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,22 +148,22 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkMenuItem *menu_item;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStateType state;
|
||||
GtkStyle *style;
|
||||
GtkStateFlags state;
|
||||
GtkStyleContext *context;
|
||||
GtkBorder padding;
|
||||
gint x, y, width, height;
|
||||
gint right_max;
|
||||
guint border_width;
|
||||
GtkArrowType arrow_type;
|
||||
GtkTextDirection direction;
|
||||
GtkWidget *parent;
|
||||
GdkWindow *window;
|
||||
gdouble angle;
|
||||
|
||||
menu_item = GTK_MENU_ITEM (widget);
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
window = gtk_widget_get_window (widget);
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
state = gtk_widget_get_state (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_item));
|
||||
x = border_width;
|
||||
@ -162,19 +172,14 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
||||
height = gtk_widget_get_allocated_height (widget) - border_width * 2;
|
||||
right_max = x + width;
|
||||
|
||||
if (state == GTK_STATE_PRELIGHT)
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, state);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
if (state & GTK_STATE_FLAG_PRELIGHT)
|
||||
{
|
||||
gint selected_shadow_type;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"selected-shadow-type", &selected_shadow_type,
|
||||
NULL);
|
||||
gtk_paint_box (style,
|
||||
cr,
|
||||
GTK_STATE_PRELIGHT,
|
||||
selected_shadow_type,
|
||||
widget, "menuitem",
|
||||
x, y, width, height);
|
||||
gtk_render_background (context, cr, x, y, width, height);
|
||||
gtk_render_frame (context, cr, x, y, width, height);
|
||||
}
|
||||
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
@ -182,20 +187,15 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
||||
{
|
||||
gint arrow_x;
|
||||
|
||||
if (state == GTK_STATE_PRELIGHT)
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
else
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
|
||||
if (menu_item->priv->toggle_size > ARROW_SIZE)
|
||||
{
|
||||
if (direction == GTK_TEXT_DIR_LTR) {
|
||||
arrow_x = x + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
|
||||
arrow_type = GTK_ARROW_LEFT;
|
||||
angle = (3 * G_PI) / 2;
|
||||
}
|
||||
else {
|
||||
arrow_x = x + width - menu_item->priv->toggle_size + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
|
||||
arrow_type = GTK_ARROW_RIGHT;
|
||||
angle = G_PI / 2;
|
||||
}
|
||||
x += menu_item->priv->toggle_size + BORDER_SPACING;
|
||||
}
|
||||
@ -204,23 +204,19 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
||||
if (direction == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
arrow_x = ARROW_SIZE / 2;
|
||||
arrow_type = GTK_ARROW_LEFT;
|
||||
angle = (3 * G_PI) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow_x = x + width - 2 * ARROW_SIZE + ARROW_SIZE / 2;
|
||||
arrow_type = GTK_ARROW_RIGHT;
|
||||
angle = G_PI / 2;
|
||||
}
|
||||
x += 2 * ARROW_SIZE;
|
||||
}
|
||||
|
||||
|
||||
gtk_paint_arrow (style, cr,
|
||||
state, shadow_type,
|
||||
widget, "tearoffmenuitem",
|
||||
arrow_type, FALSE,
|
||||
arrow_x, y + height / 2 - 5,
|
||||
ARROW_SIZE, ARROW_SIZE);
|
||||
gtk_render_arrow (context, cr, angle,
|
||||
arrow_x, height / 2 - 5,
|
||||
ARROW_SIZE);
|
||||
}
|
||||
|
||||
while (x < right_max)
|
||||
@ -236,12 +232,14 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
|
||||
x2 = MAX (right_max - x - TEAR_LENGTH, 0);
|
||||
}
|
||||
|
||||
gtk_paint_hline (style, cr, GTK_STATE_NORMAL,
|
||||
widget, "tearoffmenuitem",
|
||||
x1, x2, y + (height - style->ythickness) / 2);
|
||||
gtk_render_line (context, cr,
|
||||
x1, y + (height - padding.bottom) / 2,
|
||||
x2, y + (height - padding.bottom) / 2);
|
||||
x += 2 * TEAR_LENGTH;
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,14 @@ typedef struct _GtkTextAttributes GtkTextAttributes;
|
||||
|
||||
typedef struct _GtkTextAppearance GtkTextAppearance;
|
||||
|
||||
/**
|
||||
* GtkTextAttributes:
|
||||
*
|
||||
* Using #GtkTextAttributes directly should rarely be necessary.
|
||||
* It's primarily useful with gtk_text_iter_get_attributes().
|
||||
* As with most GTK+ structs, the fields in this struct should only
|
||||
* be read, never modified directly.
|
||||
*/
|
||||
struct _GtkTextAppearance
|
||||
{
|
||||
/*< public >*/
|
||||
|
@ -47,6 +47,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:GtkTextTag
|
||||
* @Title: GtkTextTag
|
||||
* @Short_description: A tag that can be applied to text in a GtkTextBuffer
|
||||
*
|
||||
* You may wish to begin by reading the <link linkend="TextWidget">text widget
|
||||
* conceptual overview</link> which gives an overview of all the objects and
|
||||
* data types related to the text widget and how they work together.
|
||||
*
|
||||
* Tags should be in the #GtkTextTagTable for a given #GtkTextBuffer
|
||||
* before using them with that buffer.
|
||||
*
|
||||
* gtk_text_buffer_create_tag() is the best way to create tags.
|
||||
* See <application>gtk3-demo</application> for numerous examples.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "gtkmenuitem.h"
|
||||
#include "gtkseparatormenuitem.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtkselectionprivate.h"
|
||||
#include "gtkstock.h"
|
||||
#include "gtktextbufferrichtext.h"
|
||||
#include "gtktextdisplay.h"
|
||||
|
@ -1211,6 +1211,8 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
|
||||
if (border_style == GTK_BORDER_STYLE_SOLID)
|
||||
{
|
||||
cairo_set_line_width (cr, border_width);
|
||||
|
||||
cairo_new_sub_path (cr);
|
||||
cairo_arc (cr,
|
||||
x + exterior_size / 2.,
|
||||
y + exterior_size / 2.,
|
||||
@ -1266,6 +1268,7 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
|
||||
pad = MAX (0, (exterior_size - interior_size) / 2);
|
||||
}
|
||||
|
||||
cairo_new_sub_path (cr);
|
||||
cairo_arc (cr,
|
||||
x + pad + interior_size / 2.,
|
||||
y + pad + interior_size / 2.,
|
||||
@ -2029,10 +2032,20 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
|
||||
if (!running)
|
||||
progress = (flags & GTK_STATE_FLAG_ACTIVE) ? 1 : 0;
|
||||
|
||||
if (is_rtl)
|
||||
angle = (G_PI) - ((G_PI / 2) * progress);
|
||||
if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_HORIZONTAL))
|
||||
{
|
||||
if (is_rtl)
|
||||
angle = (G_PI) - ((G_PI / 2) * progress);
|
||||
else
|
||||
angle = (G_PI / 2) * progress;
|
||||
}
|
||||
else
|
||||
angle = (G_PI / 2) * progress;
|
||||
{
|
||||
if (is_rtl)
|
||||
angle = (G_PI / 2) + ((G_PI / 2) * progress);
|
||||
else
|
||||
angle = (G_PI / 2) - ((G_PI / 2) * progress);
|
||||
}
|
||||
|
||||
interp = progress;
|
||||
|
||||
|
@ -84,7 +84,6 @@ struct _GtkToolItemGroupPrivate
|
||||
gboolean animation;
|
||||
gint64 animation_start;
|
||||
GSource *animation_timeout;
|
||||
GtkExpanderStyle expander_style;
|
||||
gint expander_size;
|
||||
gint header_spacing;
|
||||
PangoEllipsizeMode ellipsize;
|
||||
@ -266,43 +265,52 @@ gtk_tool_item_group_header_draw_cb (GtkWidget *widget,
|
||||
{
|
||||
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (data);
|
||||
GtkToolItemGroupPrivate* priv = group->priv;
|
||||
GtkExpanderStyle expander_style;
|
||||
GtkOrientation orientation;
|
||||
gint x, y, width, height;
|
||||
GtkTextDirection direction;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state = 0;
|
||||
|
||||
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
|
||||
expander_style = priv->expander_style;
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
if (!priv->collapsed)
|
||||
state |= GTK_STATE_FLAG_ACTIVE;
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, state);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
|
||||
|
||||
if (GTK_ORIENTATION_VERTICAL == orientation)
|
||||
{
|
||||
if (GTK_TEXT_DIR_RTL == direction)
|
||||
x = width - priv->expander_size / 2;
|
||||
else
|
||||
x = priv->expander_size / 2;
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
|
||||
|
||||
y = height / 2;
|
||||
if (GTK_TEXT_DIR_RTL == direction)
|
||||
x = width;
|
||||
else
|
||||
x = 0;
|
||||
|
||||
y = height / 2 - priv->expander_size / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = width / 2;
|
||||
y = priv->expander_size / 2;
|
||||
|
||||
/* Unfortunatly gtk_paint_expander() doesn't support rotated drawing
|
||||
* modes. Luckily the following shady arithmetics produce the desired
|
||||
* result. */
|
||||
expander_style = GTK_EXPANDER_EXPANDED - expander_style;
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
||||
x = width / 2 - priv->expander_size / 2;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
gtk_paint_expander (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
gtk_widget_get_state (priv->header),
|
||||
GTK_WIDGET (group),
|
||||
"tool-palette-header", x, y,
|
||||
expander_style);
|
||||
/* The expander is the only animatable region */
|
||||
gtk_style_context_push_animatable_region (context, GUINT_TO_POINTER (1));
|
||||
|
||||
gtk_render_expander (context, cr, x, y,
|
||||
priv->expander_size,
|
||||
priv->expander_size);
|
||||
|
||||
gtk_style_context_pop_animatable_region (context);
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -382,7 +390,6 @@ gtk_tool_item_group_init (GtkToolItemGroup *group)
|
||||
priv->children = NULL;
|
||||
priv->header_spacing = DEFAULT_HEADER_SPACING;
|
||||
priv->expander_size = DEFAULT_EXPANDER_SIZE;
|
||||
priv->expander_style = GTK_EXPANDER_EXPANDED;
|
||||
|
||||
priv->label_widget = gtk_label_new (NULL);
|
||||
gtk_misc_set_alignment (GTK_MISC (priv->label_widget), 0.0, 0.5);
|
||||
@ -1200,10 +1207,12 @@ gtk_tool_item_group_realize (GtkWidget *widget)
|
||||
GdkDisplay *display;
|
||||
gint attributes_mask;
|
||||
guint border_width;
|
||||
GtkStyleContext *context;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
@ -1231,9 +1240,7 @@ gtk_tool_item_group_realize (GtkWidget *widget)
|
||||
|
||||
gdk_window_set_user_data (window, widget);
|
||||
|
||||
gtk_widget_style_attach (widget);
|
||||
gtk_style_set_background (gtk_widget_get_style (widget),
|
||||
window, GTK_STATE_NORMAL);
|
||||
gtk_style_context_set_background (context, window);
|
||||
|
||||
gtk_container_forall (GTK_CONTAINER (widget),
|
||||
(GtkCallback) gtk_widget_set_parent_window,
|
||||
@ -1254,11 +1261,10 @@ gtk_tool_item_group_unrealize (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_item_group_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
gtk_tool_item_group_style_updated (GtkWidget *widget)
|
||||
{
|
||||
gtk_tool_item_group_header_adjust_style (GTK_TOOL_ITEM_GROUP (widget));
|
||||
GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->style_set (widget, previous_style);
|
||||
GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->style_updated (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1573,7 +1579,7 @@ gtk_tool_item_group_class_init (GtkToolItemGroupClass *cls)
|
||||
wclass->size_allocate = gtk_tool_item_group_size_allocate;
|
||||
wclass->realize = gtk_tool_item_group_realize;
|
||||
wclass->unrealize = gtk_tool_item_group_unrealize;
|
||||
wclass->style_set = gtk_tool_item_group_style_set;
|
||||
wclass->style_updated = gtk_tool_item_group_style_updated;
|
||||
wclass->screen_changed = gtk_tool_item_group_screen_changed;
|
||||
|
||||
cclass->add = gtk_tool_item_group_add;
|
||||
@ -1866,22 +1872,6 @@ gtk_tool_item_group_animation_cb (gpointer data)
|
||||
/* Enque this early to reduce number of expose events. */
|
||||
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (group));
|
||||
|
||||
/* Figure out current style of the expander arrow. */
|
||||
if (priv->collapsed)
|
||||
{
|
||||
if (priv->expander_style == GTK_EXPANDER_EXPANDED)
|
||||
priv->expander_style = GTK_EXPANDER_SEMI_COLLAPSED;
|
||||
else
|
||||
priv->expander_style = GTK_EXPANDER_COLLAPSED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->expander_style == GTK_EXPANDER_COLLAPSED)
|
||||
priv->expander_style = GTK_EXPANDER_SEMI_EXPANDED;
|
||||
else
|
||||
priv->expander_style = GTK_EXPANDER_EXPANDED;
|
||||
}
|
||||
|
||||
gtk_tool_item_group_force_expose (group);
|
||||
|
||||
/* Finish animation when done. */
|
||||
@ -1921,6 +1911,8 @@ gtk_tool_item_group_set_collapsed (GtkToolItemGroup *group,
|
||||
GTK_WIDGET (group));
|
||||
if (collapsed != priv->collapsed)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
if (priv->animation)
|
||||
{
|
||||
if (priv->animation_timeout)
|
||||
@ -1932,14 +1924,23 @@ gtk_tool_item_group_set_collapsed (GtkToolItemGroup *group,
|
||||
g_source_set_callback (priv->animation_timeout,
|
||||
gtk_tool_item_group_animation_cb,
|
||||
group, NULL);
|
||||
|
||||
g_source_attach (priv->animation_timeout, NULL);
|
||||
|
||||
context = gtk_widget_get_style_context (gtk_bin_get_child (GTK_BIN (priv->header)));
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
|
||||
|
||||
gtk_style_context_notify_state_change (context,
|
||||
gtk_widget_get_window (priv->header),
|
||||
GUINT_TO_POINTER (1),
|
||||
GTK_STATE_FLAG_ACTIVE,
|
||||
!collapsed);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->expander_style = GTK_EXPANDER_COLLAPSED;
|
||||
gtk_tool_item_group_force_expose (group);
|
||||
}
|
||||
else
|
||||
gtk_tool_item_group_force_expose (group);
|
||||
|
||||
priv->collapsed = collapsed;
|
||||
g_object_notify (G_OBJECT (group), "collapsed");
|
||||
|
@ -263,6 +263,7 @@ gtk_tool_palette_set_property (GObject *object,
|
||||
if ((guint) g_value_get_enum (value) != palette->priv->orientation)
|
||||
{
|
||||
palette->priv->orientation = g_value_get_enum (value);
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (palette));
|
||||
gtk_tool_palette_reconfigured (palette);
|
||||
}
|
||||
break;
|
||||
|
1283
gtk/gtktreemodel.c
1283
gtk/gtktreemodel.c
File diff suppressed because it is too large
Load Diff
@ -42,15 +42,55 @@ typedef struct _GtkTreePath GtkTreePath;
|
||||
typedef struct _GtkTreeRowReference GtkTreeRowReference;
|
||||
typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
|
||||
typedef struct _GtkTreeModelIface GtkTreeModelIface;
|
||||
|
||||
/**
|
||||
* GtkTreeModelForeachFunc:
|
||||
* @model: the #GtkTreeModel being iterated
|
||||
* @path: the current #GtkTreePath
|
||||
* @iter: the current #GtkTreeIter
|
||||
* @data: The user data passed to gtk_tree_model_foreach()
|
||||
*
|
||||
* Type of the callback passed to gtk_tree_model_foreach() to
|
||||
* iterate over the rows in a tree model.
|
||||
*
|
||||
* Return value: %TRUE to stop iterating, %FALSE to continue
|
||||
*
|
||||
*/
|
||||
typedef gboolean (* GtkTreeModelForeachFunc) (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
|
||||
|
||||
|
||||
/**
|
||||
* GtkTreeModelFlags:
|
||||
* @GTK_TREE_MODEL_ITERS_PERSIST: iterators survive all signals
|
||||
* emitted by the tree
|
||||
* @GTK_TREE_MODEL_LIST_ONLY: the model is a list only, and never
|
||||
* has children
|
||||
*
|
||||
* These flags indicate various properties of a #GtkTreeModel.
|
||||
*
|
||||
* They are returned by gtk_tree_model_get_flags(), and must be
|
||||
* static for the lifetime of the object. A more complete description
|
||||
* of #GTK_TREE_MODEL_ITERS_PERSIST can be found in the overview of
|
||||
* this section.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_TREE_MODEL_ITERS_PERSIST = 1 << 0,
|
||||
GTK_TREE_MODEL_LIST_ONLY = 1 << 1
|
||||
} GtkTreeModelFlags;
|
||||
|
||||
/**
|
||||
* GtkTreeIter:
|
||||
* @stamp: a unique stamp to catch invalid iterators
|
||||
* @user_data: model-specific data
|
||||
* @user_data2: model-specific data
|
||||
* @user_data3: model-specific data
|
||||
*
|
||||
* The <structname>GtkTreeIter</structname> is the primary structure
|
||||
* for accessing a #GtkTreeModel. Models are expected to put a unique
|
||||
* integer in the <structfield>stamp</structfield> member, and put
|
||||
* model-specific data in the three <structfield>user_data</structfield>
|
||||
* members.
|
||||
*/
|
||||
struct _GtkTreeIter
|
||||
{
|
||||
gint stamp;
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "gtkmainprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkrc.h"
|
||||
#include "gtkselection.h"
|
||||
#include "gtkselectionprivate.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtksizegroup-private.h"
|
||||
#include "gtkwidget.h"
|
||||
|
@ -90,7 +90,7 @@ filtermodel_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += expander
|
||||
expander_SOURCES = expander.c
|
||||
expander_LDADD = $(progs_ldadd)
|
||||
expander_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += action
|
||||
action_SOURCES = action.c
|
||||
@ -99,8 +99,11 @@ action_LDADD = $(progs_ldadd)
|
||||
TEST_PROGS += stylecontext
|
||||
stylecontext_SOURCES = stylecontext.c
|
||||
stylecontext_LDADD = $(progs_ldadd)
|
||||
EXTRA_DIST += test.css test.png
|
||||
EXTRA_DIST += test.css test.png
|
||||
|
||||
TEST_PROGS += papersize
|
||||
papersize_SOURCES = papersize.c
|
||||
papersize_LDADD = $(progs_ldadd)
|
||||
|
||||
EXTRA_DIST += \
|
||||
file-chooser-test-dir/empty \
|
||||
|
128
gtk/tests/papersize.c
Normal file
128
gtk/tests/papersize.c
Normal file
@ -0,0 +1,128 @@
|
||||
/* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
test_parse (void)
|
||||
{
|
||||
GtkPaperSize *p;
|
||||
|
||||
p = gtk_paper_size_new (GTK_PAPER_NAME_A4);
|
||||
g_assert (p != NULL);
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 210);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 297);
|
||||
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "iso_a4");
|
||||
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "A4");
|
||||
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "A4");
|
||||
g_assert (!gtk_paper_size_is_custom (p));
|
||||
gtk_paper_size_free (p);
|
||||
|
||||
p = gtk_paper_size_new (GTK_PAPER_NAME_B5);
|
||||
g_assert (p != NULL);
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 176);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 250);
|
||||
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "iso_b5");
|
||||
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "B5");
|
||||
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "ISOB5");
|
||||
g_assert (!gtk_paper_size_is_custom (p));
|
||||
gtk_paper_size_free (p);
|
||||
|
||||
p = gtk_paper_size_new (GTK_PAPER_NAME_EXECUTIVE);
|
||||
g_assert (p != NULL);
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 184);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 266);
|
||||
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "na_executive");
|
||||
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "Executive");
|
||||
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "Executive");
|
||||
g_assert (!gtk_paper_size_is_custom (p));
|
||||
gtk_paper_size_free (p);
|
||||
|
||||
p = gtk_paper_size_new ("iso_a4_210x297mm");
|
||||
g_assert (p != NULL);
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 210);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 297);
|
||||
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "iso_a4");
|
||||
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "A4");
|
||||
g_assert_cmpstr (gtk_paper_size_get_ppd_name (p), ==, "A4");
|
||||
g_assert (!gtk_paper_size_is_custom (p));
|
||||
gtk_paper_size_free (p);
|
||||
|
||||
p = gtk_paper_size_new ("custom_w1_20x30in");
|
||||
g_assert (p != NULL);
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_INCH), ==, 20);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_INCH), ==, 30);
|
||||
g_assert_cmpstr (gtk_paper_size_get_name (p), ==, "custom_w1");
|
||||
g_assert_cmpstr (gtk_paper_size_get_display_name (p), ==, "custom_w1");
|
||||
g_assert (gtk_paper_size_is_custom (p));
|
||||
gtk_paper_size_free (p);
|
||||
}
|
||||
|
||||
static void
|
||||
test_compare (void)
|
||||
{
|
||||
GtkPaperSize *a1, *a2, *b, *c;
|
||||
|
||||
a1 = gtk_paper_size_new (GTK_PAPER_NAME_A4);
|
||||
a2 = gtk_paper_size_new ("iso_a4_210x297mm");
|
||||
b = gtk_paper_size_new (GTK_PAPER_NAME_B5);
|
||||
c = gtk_paper_size_new ("custom_w1_20x30in");
|
||||
|
||||
g_assert (gtk_paper_size_is_equal (a1, a2));
|
||||
g_assert (!gtk_paper_size_is_equal (a1, b));
|
||||
g_assert (!gtk_paper_size_is_equal (a1, c));
|
||||
g_assert (!gtk_paper_size_is_equal (b, c));
|
||||
|
||||
gtk_paper_size_free (a1);
|
||||
gtk_paper_size_free (a2);
|
||||
gtk_paper_size_free (b);
|
||||
gtk_paper_size_free (c);
|
||||
}
|
||||
|
||||
static void
|
||||
test_units (void)
|
||||
{
|
||||
GtkPaperSize *p;
|
||||
|
||||
p = gtk_paper_size_new (GTK_PAPER_NAME_A4);
|
||||
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_MM), ==, 210);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_MM), ==, 297);
|
||||
|
||||
/* compare up to 2 decimals */
|
||||
g_assert_cmpint (100 * gtk_paper_size_get_width (p, GTK_UNIT_INCH), ==, 100 * 8.26);
|
||||
g_assert_cmpint (100 * gtk_paper_size_get_height (p, GTK_UNIT_INCH), ==, 100 * 11.69);
|
||||
|
||||
g_assert_cmpint (gtk_paper_size_get_width (p, GTK_UNIT_POINTS), ==, 595);
|
||||
g_assert_cmpint (gtk_paper_size_get_height (p, GTK_UNIT_POINTS), ==, 841);
|
||||
|
||||
gtk_paper_size_free (p);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv);
|
||||
|
||||
g_test_add_func ("/paper-size/parse", test_parse);
|
||||
g_test_add_func ("/paper-size/compare", test_compare);
|
||||
g_test_add_func ("/paper-size/units", test_units);
|
||||
|
||||
return g_test_run();
|
||||
}
|
@ -5,7 +5,7 @@ wimp = ms-windows
|
||||
endif
|
||||
|
||||
# the theme engines need to be ported to GtkThemingEngine
|
||||
# SUBDIRS = $(wimp) pixbuf
|
||||
SUBDIRS = $(wimp) pixbuf
|
||||
|
||||
DIST_SUBDIRS = ms-windows pixbuf
|
||||
|
||||
|
@ -43,6 +43,10 @@
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
#include "gtk/gtk.h"
|
||||
#ifndef GTK_COMPILATION
|
||||
#define GTK_COMPILATION
|
||||
#endif
|
||||
#include "gtk/gtkmenushellprivate.h"
|
||||
|
||||
#ifdef BUILDING_STANDALONE
|
||||
#include "gdk/gdkwin32.h"
|
||||
@ -1337,9 +1341,9 @@ draw_arrow (GtkStyle *style,
|
||||
reverse_engineer_stepper_box (widget, arrow_type,
|
||||
&box_x, &box_y, &box_width, &box_height);
|
||||
|
||||
if (gtk_range_get_adjustment(&scrollbar->range)->page_size >=
|
||||
(gtk_range_get_adjustment(&scrollbar->range)->upper -
|
||||
gtk_range_get_adjustment(&scrollbar->range)->lower))
|
||||
if (gtk_adjustment_get_page_size(gtk_range_get_adjustment(&scrollbar->range)) >=
|
||||
(gtk_adjustment_get_upper(gtk_range_get_adjustment(&scrollbar->range)) -
|
||||
gtk_adjustment_get_lower(gtk_range_get_adjustment(&scrollbar->range))))
|
||||
{
|
||||
is_disabled = TRUE;
|
||||
}
|
||||
@ -1577,7 +1581,7 @@ draw_menu_item (cairo_t *cr, GtkWidget *widget, GtkStyle *style,
|
||||
|
||||
if (state_type == GTK_STATE_PRELIGHT)
|
||||
{
|
||||
draw_3d_border (dc, &rect, bar->active);
|
||||
draw_3d_border (dc, &rect, bar->priv->active);
|
||||
}
|
||||
|
||||
release_window_dc (&dc_info);
|
||||
@ -1881,9 +1885,9 @@ draw_box (GtkStyle *style,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_range_get_adjustment(&scrollbar->range)->page_size >=
|
||||
(gtk_range_get_adjustment(&scrollbar->range)->upper -
|
||||
gtk_range_get_adjustment(&scrollbar->range)->lower))
|
||||
if (gtk_adjustment_get_page_size(gtk_range_get_adjustment(&scrollbar->range)) >=
|
||||
(gtk_adjustment_get_page_size(gtk_range_get_adjustment(&scrollbar->range)) -
|
||||
gtk_adjustment_get_page_size(gtk_range_get_adjustment(&scrollbar->range))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
2148
po-properties/et.po
2148
po-properties/et.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
6
po/fa.po
6
po/fa.po
@ -11,7 +11,7 @@ msgstr ""
|
||||
"Project-Id-Version: gtk+ 2.6\n"
|
||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2b&component=general\n"
|
||||
"POT-Creation-Date: 2010-12-19 09:25+0000\n"
|
||||
"PO-Revision-Date: 2010-12-19 13:26+0330\n"
|
||||
"PO-Revision-Date: 2011-01-13 11:34+0330\n"
|
||||
"Last-Translator: Mahyar Moghimi <mahyar.moqimi@gmail.com>\n"
|
||||
"Language-Team: Persian <translate@ifsug.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -2569,7 +2569,7 @@ msgstr "_کوچک نمایی"
|
||||
#: ../gtk/gtkswitch.c:531
|
||||
msgctxt "switch"
|
||||
msgid "ON"
|
||||
msgstr "U+2759"
|
||||
msgstr "❙"
|
||||
|
||||
#. Translators: if the "off" state label requires more than three
|
||||
#. * glyphs then use WHITE CIRCLE (U+25CB) as the text for the state
|
||||
@ -2579,7 +2579,7 @@ msgstr "U+2759"
|
||||
#: ../gtk/gtkswitch.c:552
|
||||
msgctxt "switch"
|
||||
msgid "OFF"
|
||||
msgstr "U+25CB"
|
||||
msgstr "○"
|
||||
|
||||
#: ../gtk/gtkswitch.c:943
|
||||
msgctxt "light switch widget"
|
||||
|
Loading…
Reference in New Issue
Block a user