Gtk-3.0 Python API Documentation

Class: Gtk.AboutDialog

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Dialog

The GtkAboutDialog offers a simple way to display information about a program like its logo, name, copyright, website and license. It is also possible to give credits to the authors, documenters, translators and artists who have worked on the program. An about dialog is typically opened when the user selects the <literal>About</literal> option from the <literal>Help</literal> menu. All parts of the dialog are optional. About dialog often contain links and email addresses. GtkAboutDialog displays these as clickable links. By default, it calls gtk_show_uri() when a user clicks one. The behaviour can be overridden with the #GtkAboutDialog::activate-link signal. To make constructing a GtkAboutDialog as convenient as possible, you can use the function gtk_show_about_dialog() which constructs and shows a dialog and keeps it around so that it can be shown again. Note that GTK+ sets a default title of <literal>_("About &percnt;s")</literal> on the dialog window (where &percnt;s is replaced by the name of the application, but in order to ensure proper translation of the title, applications should set the title property explicitly when constructing a GtkAboutDialog, as shown in the following example: <informalexample><programlisting> gtk_show_about_dialog (NULL, "program-name", "ExampleCode", "logo", example_logo, "title" _("About ExampleCode"), NULL); </programlisting></informalexample>

Properties

string"website"read/write

The URL for the link to the website of the program. This should be a string starting with "http://.

string"translator-credits"read/write

Credits to the translators. This string should be marked as translatable. The string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.

Gtk.License"license-type"read/write

The license of the program, as a value of the %GtkLicense enumeration. The #GtkAboutDialog will automatically fill out a standard disclaimer and link the user to the appropriate online resource for the license text. If %GTK_LICENSE_UNKNOWN is used, the link used will be the same specified in the #GtkAboutDialog:website property. If %GTK_LICENSE_CUSTOM is used, the current contents of the #GtkAboutDialog:license property are used. For any other #GtkLicense value, the contents of the #GtkAboutDialog:license property are also set by this property as a side effect.

string"program-name"read/write

The name of the program. If this is not set, it defaults to g_get_application_name().

string"copyright"read/write

Copyright information for the program.

string"license"read/write

The license of the program. This string is displayed in a text view in a secondary dialog, therefore it is fine to use a long multi-paragraph text. Note that the text is only wrapped in the text view if the "wrap-license" property is set to %TRUE; otherwise the text itself must contain the intended linebreaks. When setting this property to a non-%NULL value, the #GtkAboutDialog:license-type property is set to %GTK_LICENSE_CUSTOM as a side effect.

bool"wrap-license"read/write

Whether to wrap the text in the license dialog.

Array"documenters"read/write

The people documenting the program, as a %NULL-terminated array of strings. Each string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.

Array"artists"read/write

The people who contributed artwork to the program, as a %NULL-terminated array of strings. Each string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.

string"logo-icon-name"read/write

A named icon to use as the logo for the about box. This property overrides the #GtkAboutDialog:logo property.

string"comments"read/write

Comments about the program. This string is displayed in a label in the main dialog, thus it should be a short explanation of the main purpose of the program, not a detailed list of features.

string"version"read/write

The version of the program.

Array"authors"read/write

The authors of the program, as a %NULL-terminated array of strings. Each string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.

GdkPixbuf.Pixbufread/write

A logo for the about box. If this is not set, it defaults to gtk_window_get_default_icon_list().

string"website-label"read/write

The label for the link to the website of the program.

Signals

bool"activate-link"(self, about_dialog, uri)

The signal which gets emitted to activate a URI. Applications may connect to it to override the default behaviour, which is to call gtk_show_uri().

Methods

boolactivate_link(uri)

Arrayget_artists()

Arrayget_authors()

stringget_comments()

stringget_copyright()

Arrayget_documenters()

stringget_license()

Gtk.Licenseget_license_type()

GdkPixbuf.Pixbuf()

stringget_logo_icon_name()

stringget_program_name()

stringget_translator_credits()

stringget_version()

stringget_website()

stringget_website_label()

boolget_wrap_license()

voidset_artists(artists)

voidset_authors(authors)

voidset_comments(comments)

voidset_copyright(copyright)

voidset_documenters(documenters)

voidset_license(license)

voidset_license_type(license_type)

void(logo)

voidset_logo_icon_name(icon_name)

voidset_program_name(name)

voidset_translator_credits(translator_credits)

voidset_version(version)

voidset_website(website)

voidset_website_label(website_label)

voidset_wrap_license(wrap_license)

Class: Gtk.AccelGroup

Subclass of: GObject.Object

A #GtkAccelGroup represents a group of keyboard accelerators, typically attached to a toplevel #GtkWindow (with gtk_window_add_accel_group()). Usually you won't need to create a #GtkAccelGroup directly; instead, when using #GtkUIManager, GTK+ automatically sets up the accelerators for your menus in the ui manager's #GtkAccelGroup. Note that <firstterm>accelerators</firstterm> are different from <firstterm>mnemonics</firstterm>. Accelerators are shortcuts for activating a menu item; they appear alongside the menu item they're a shortcut for. For example "Ctrl+Q" might appear alongside the "Quit" menu item. Mnemonics are shortcuts for GUI elements such as text entries or buttons; they appear as underlined characters. See gtk_label_new_with_mnemonic(). Menu items can have both accelerators and mnemonics, of course.

Properties

Gdk.ModifierType"modifier-mask"read-only

bool"is-locked"read-only

Signals

bool"accel-activate"(self, accel_group, acceleratable, keyval, modifier)

The accel-activate signal is an implementation detail of #GtkAccelGroup and not meant to be used by applications.

void"accel-changed"(self, accel_group, keyval, modifier, accel_closure)

The accel-changed signal is emitted when a #GtkAccelGroupEntry is added to or removed from the accel group. Widgets like #GtkAccelLabel which display an associated accelerator should connect to this signal, and rebuild their visual representation if the @accel_closure is theirs.

Methods

voidaccel_changed(keyval, modifier, accel_closure)

boolactivate(accel_quark, acceleratable, accel_key, accel_mods)

voidconnect(accel_key, accel_mods, accel_flags, closure)

voidconnect_by_path(accel_path, closure)

booldisconnect(closure)

booldisconnect_key(accel_key, accel_mods)

Gtk.AccelKeyfind(find_func, data)

Gtk.AccelGroupfrom_accel_closure(closure)(static method)

boolget_is_locked()

Gdk.ModifierTypeget_modifier_mask()

voidlock()

Array, intquery(accel_key, accel_mods)

voidunlock()

Class: Gtk.AccelLabel

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Label

The #GtkAccelLabel widget is a subclass of #GtkLabel that also displays an accelerator key on the right of the label text, e.g. 'Ctl+S'. It is commonly used in menus to show the keyboard short-cuts for commands. The accelerator key to display is not set explicitly. Instead, the #GtkAccelLabel displays the accelerators which have been added to a particular widget. This widget is set by calling gtk_accel_label_set_accel_widget(). For example, a #GtkMenuItem widget may have an accelerator added to emit the "activate" signal when the 'Ctl+S' key combination is pressed. A #GtkAccelLabel is created and added to the #GtkMenuItem, and gtk_accel_label_set_accel_widget() is called with the #GtkMenuItem as the second argument. The #GtkAccelLabel will now display 'Ctl+S' after its label. Note that creating a #GtkMenuItem with gtk_menu_item_new_with_label() (or one of the similar functions for #GtkCheckMenuItem and #GtkRadioMenuItem) automatically adds a #GtkAccelLabel to the #GtkMenuItem and calls gtk_accel_label_set_accel_widget() to set it up for you. A #GtkAccelLabel will only display accelerators which have %GTK_ACCEL_VISIBLE set (see #GtkAccelFlags). A #GtkAccelLabel can display multiple accelerators and even signal names, though it is almost always used to display just one accelerator key. <example> <title>Creating a simple menu item with an accelerator key.</title> <programlisting> GtkWidget *save_item; GtkAccelGroup *accel_group; /<!---->* Create a GtkAccelGroup and add it to the window. *<!---->/ accel_group = gtk_accel_group_new (<!-- -->); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); /<!---->* Create the menu item using the convenience function. *<!---->/ save_item = gtk_menu_item_new_with_label ("Save"); gtk_widget_show (save_item); gtk_container_add (GTK_CONTAINER (menu), save_item); /<!---->* Now add the accelerator to the GtkMenuItem. Note that since we called gtk_menu_item_new_with_label(<!-- -->) to create the GtkMenuItem the GtkAccelLabel is automatically set up to display the GtkMenuItem accelerators. We just need to make sure we use GTK_ACCEL_VISIBLE here. *<!---->/ gtk_widget_add_accelerator (save_item, "activate", accel_group, GDK_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); </programlisting> </example>

Properties

Gtk.Widget"accel-widget"read/write

GObject.Closure"accel-closure"read/write

Methods

Gtk.Widgetget_accel_widget()

intget_accel_width()

boolrefetch()

voidset_accel_closure(accel_closure)

voidset_accel_widget(accel_widget)

Class: Gtk.AccelMap

Subclass of: GObject.Object

Accelerator maps are used to define runtime configurable accelerators. Functions for manipulating them are are usually used by higher level convenience mechanisms like #GtkUIManager and are thus considered "low-level". You'll want to use them if you're manually creating menus that should have user-configurable accelerators. Accelerator is uniquely defined by: <itemizedlist> <listitem><para>accelerator path</para></listitem> <listitem><para>accelerator key</para></listitem> <listitem><para>accelerator modifiers</para></listitem> </itemizedlist> The accelerator path must consist of "&lt;WINDOWTYPE&gt;/Category1/Category2/.../Action", where WINDOWTYPE should be a unique application-specific identifier that corresponds to the kind of window the accelerator is being used in, e.g. "Gimp-Image", "Abiword-Document" or "Gnumeric-Settings". The "Category1/.../Action" portion is most appropriately chosen by the action the accelerator triggers, i.e. for accelerators on menu items, choose the item's menu path, e.g. "File/Save As", "Image/View/Zoom" or "Edit/Select All". So a full valid accelerator path may look like: "&lt;Gimp-Toolbox&gt;/File/Dialogs/Tool Options...". All accelerators are stored inside one global #GtkAccelMap that can be obtained using gtk_accel_map_get(). See <link linkend="monitoring-changes">Monitoring changes</link> for additional details. <refsect2 id="manipulating-accelerators"> <title>Manipulating accelerators</title> <para> New accelerators can be added using gtk_accel_map_add_entry(). To search for specific accelerator, use gtk_accel_map_lookup_entry(). Modifications of existing accelerators should be done using gtk_accel_map_change_entry(). In order to avoid having some accelerators changed, they can be locked using gtk_accel_map_lock_path(). Unlocking is done using gtk_accel_map_unlock_path(). </para> </refsect2> <refsect2 id="saving-and-loading"> <title>Saving and loading accelerator maps</title> <para> Accelerator maps can be saved to and loaded from some external resource. For simple saving and loading from file, gtk_accel_map_save() and gtk_accel_map_load() are provided. Saving and loading can also be done by providing file descriptor to gtk_accel_map_save_fd() and gtk_accel_map_load_fd(). </para> </refsect2> <refsect2 id="monitoring-changes"> <title>Monitoring changes</title> <para> #GtkAccelMap object is only useful for monitoring changes of accelerators. By connecting to #GtkAccelMap::changed signal, one can monitor changes of all accelerators. It is also possible to monitor only single accelerator path by using it as a detail of the #GtkAccelMap::changed signal. </para> </refsect2>

Signals

void"changed"(self, accel_map, accel_path, accel_key, accel_mods)

Notifies of a change in the global accelerator map. The path is also used as the detail for the signal, so it is possible to connect to changed::<replaceable>accel_path</replaceable>.

Methods

voidadd_entry(accel_path, accel_key, accel_mods)(static method)

voidadd_filter(filter_pattern)(static method)

boolchange_entry(accel_path, accel_key, accel_mods, replace)(static method)

voidforeach(data, foreach_func)(static method)

voidforeach_unfiltered(data, foreach_func)(static method)

Gtk.AccelMapget()(static method)

voidload(file_name)(static method)

voidload_fd(fd)(static method)

voidload_scanner(scanner)(static method)

voidlock_path(accel_path)(static method)

bool, Gtk.AccelKeylookup_entry(accel_path)(static method)

voidsave(file_name)(static method)

voidsave_fd(fd)(static method)

voidunlock_path(accel_path)(static method)

Class: Gtk.Accessible

Subclass of: Atk.Object

Methods

voidconnect_widget_destroyed()

Gtk.Widgetget_widget()

voidset_widget(widget)

Class: Gtk.Action

Implements: Gtk.Buildable

Known subclasses: Gtk.RecentAction, Gtk.ToggleAction

Subclass of: GObject.Object

Actions represent operations that the user can be perform, along with some information how it should be presented in the interface. Each action provides methods to create icons, menu items and toolbar items representing itself. As well as the callback that is called when the action gets activated, the following also gets associated with the action: <itemizedlist> <listitem><para>a name (not translated, for path lookup)</para></listitem> <listitem><para>a label (translated, for display)</para></listitem> <listitem><para>an accelerator</para></listitem> <listitem><para>whether label indicates a stock id</para></listitem> <listitem><para>a tooltip (optional, translated)</para></listitem> <listitem><para>a toolbar label (optional, shorter than label)</para></listitem> </itemizedlist> The action will also have some state information: <itemizedlist> <listitem><para>visible (shown/hidden)</para></listitem> <listitem><para>sensitive (enabled/disabled)</para></listitem> </itemizedlist> Apart from regular actions, there are <link linkend="GtkToggleAction">toggle actions</link>, which can be toggled between two states and <link linkend="GtkRadioAction">radio actions</link>, of which only one in a group can be in the "active" state. Other actions can be implemented as #GtkAction subclasses. Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement #GtkActivatable interface. Proxies mirror the state of the action and should change when the action's state changes. Properties that are always mirrored by proxies are #GtkAction:sensitive and #GtkAction:visible. #GtkAction:gicon, #GtkAction:icon-name, #GtkAction:label, #GtkAction:short-label and #GtkAction:stock-id properties are only mirorred if proxy widget has #GtkActivatable:use-action-appearance property set to %TRUE. When the proxy is activated, it should activate its action.

Properties

bool"always-show-image"construct-only

If %TRUE, the action's menu item proxies will ignore the #GtkSettings:gtk-menu-images setting and always show their image, if available. Use this property if the menu item would be useless or hard to use without their image.

string"name"construct-only

string"stock-id"read/write

The stock icon displayed in widgets representing this action. This is an appearance property and thus only applies if #GtkActivatable:use-action-appearance is %TRUE.

bool"sensitive"read/write

string"short-label"read/write

A shorter label that may be used on toolbar buttons. This is an appearance property and thus only applies if #GtkActivatable:use-action-appearance is %TRUE.

bool"visible"read/write

string"icon-name"read/write

The name of the icon from the icon theme. Note that the stock icon is preferred, if the #GtkAction:stock-id property holds the id of an existing stock icon, and the #GIcon is preferred if the #GtkAction:gicon property is set. This is an appearance property and thus only applies if #GtkActivatable:use-action-appearance is %TRUE.

string"tooltip"read/write

string"label"read/write

The label used for menu items and buttons that activate this action. If the label is %NULL, GTK+ uses the stock label specified via the stock-id property. This is an appearance property and thus only applies if #GtkActivatable:use-action-appearance is %TRUE.

bool"is-important"read/write

Gio.Icon"gicon"read/write

The #GIcon displayed in the #GtkAction. Note that the stock icon is preferred, if the #GtkAction:stock-id property holds the id of an existing stock icon. This is an appearance property and thus only applies if #GtkActivatable:use-action-appearance is %TRUE.

bool"visible-horizontal"read/write

Gtk.ActionGroup"action-group"read/write

bool"visible-vertical"read/write

bool"visible-overflown"read/write

When %TRUE, toolitem proxies for this action are represented in the toolbar overflow menu.

bool"hide-if-empty"read/write

Signals

void"activate"(self, action)

The "activate" signal is emitted when the action is activated.

Methods

voidactivate()

voidblock_activate()

voidconnect_accelerator()

voidconnect_proxy(proxy)

Gtk.Widgetcreate_icon(icon_size)

Gtk.Widgetcreate_menu()

Gtk.Widgetcreate_menu_item()

Gtk.Widgetcreate_tool_item()

voiddisconnect_accelerator()

voiddisconnect_proxy(proxy)

GObject.Closureget_accel_closure()

stringget_accel_path()

boolget_always_show_image()

Gio.Iconget_gicon()

stringget_icon_name()

boolget_is_important()

stringget_label()

stringget_name()

GLib.SListget_proxies()

boolget_sensitive()

stringget_short_label()

stringget_stock_id()

stringget_tooltip()

boolget_visible()

boolget_visible_horizontal()

boolget_visible_vertical()

boolis_sensitive()

boolis_visible()

voidset_accel_group(accel_group)

voidset_accel_path(accel_path)

voidset_always_show_image(always_show)

voidset_gicon(icon)

voidset_icon_name(icon_name)

voidset_is_important(is_important)

voidset_label(label)

voidset_sensitive(sensitive)

voidset_short_label(short_label)

voidset_stock_id(stock_id)

voidset_tooltip(tooltip)

voidset_visible(visible)

voidset_visible_horizontal(visible_horizontal)

voidset_visible_vertical(visible_vertical)

voidunblock_activate()

Class: Gtk.ActionGroup

Implements: Gtk.Buildable

Subclass of: GObject.Object

Actions are organised into groups. An action group is essentially a map from names to #GtkAction objects. All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window's menus would be constructed from a combination of two action groups. </para> <para id="Action-Accel"> Accelerators are handled by the GTK+ accelerator map. All actions are assigned an accelerator path (which normally has the form <literal>&lt;Actions&gt;/group-name/action-name</literal>) and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The GTK+ accelerator map code makes sure that the correct shortcut is displayed next to the menu item. <refsect2 id="GtkActionGroup-BUILDER-UI"> <title>GtkActionGroup as GtkBuildable</title> <para> The #GtkActionGroup implementation of the #GtkBuildable interface accepts #GtkAction objects as &lt;child&gt; elements in UI definitions. Note that it is probably more common to define actions and action groups in the code, since they are directly related to what the code can do. The GtkActionGroup implementation of the GtkBuildable interface supports a custom &lt;accelerator&gt; element, which has attributes named key and modifiers and allows to specify accelerators. This is similar to the &lt;accelerator&gt; element of #GtkWidget, the main difference is that it doesn't allow you to specify a signal. </para> <example> <title>A #GtkDialog UI definition fragment.</title> <programlisting><![CDATA[ <object class="GtkActionGroup" id="actiongroup"> <child> <object class="GtkAction" id="About"> <property name="name">About</property> <property name="stock_id">gtk-about</property> <signal handler="about_activate" name="activate"/> </object> <accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/> </child> </object> ]]></programlisting> </example> </refsect2>

Properties

bool"sensitive"read/write

string"name"construct-only

bool"visible"read/write

Signals

void"connect-proxy"(self, action_group, action, proxy)

The ::connect-proxy signal is emitted after connecting a proxy to an action in the group. Note that the proxy may have been connected to a different action before. This is intended for simple customizations for which a custom action class would be too clumsy, e.g. showing tooltips for menuitems in the statusbar. #GtkUIManager proxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.

void"disconnect-proxy"(self, action_group, action, proxy)

The ::disconnect-proxy signal is emitted after disconnecting a proxy from an action in the group. #GtkUIManager proxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.

void"pre-activate"(self, action_group, action)

The ::pre-activate signal is emitted just before the @action in the This is intended for #GtkUIManager to proxy the signal and provide global notification just before any action is activated.

void"post-activate"(self, action_group, action)

The ::post-activate signal is emitted just after the @action in the This is intended for #GtkUIManager to proxy the signal and provide global notification just after any action is activated.

Methods

voidadd_action(action)

voidadd_action_with_accel(action, accelerator)

Gtk.Actionget_action(action_name)

stringget_name()

boolget_sensitive()

boolget_visible()

GLib.Listlist_actions()

voidremove_action(action)

voidset_sensitive(sensitive)

voidset_translate_func(func, data, notify)

voidset_translation_domain(domain)

voidset_visible(visible)

stringtranslate_string(string)

Interface: Gtk.Activatable

Classes implementing Gtk.Activatable: Gtk.MenuItem, Gtk.VolumeButton, Gtk.RadioButton, Gtk.ColorButton, Gtk.LinkButton, Gtk.CheckMenuItem, Gtk.RadioMenuItem, Gtk.ScaleButton, Gtk.RadioToolButton, Gtk.Switch, Gtk.TearoffMenuItem, Gtk.FontButton, Gtk.MenuToolButton, Gtk.ToolButton, Gtk.RecentChooserMenu, Gtk.CheckButton, Gtk.ToolItem, Gtk.SeparatorMenuItem, Gtk.ToggleButton, Gtk.Button, Gtk.ToggleToolButton, Gtk.ImageMenuItem, Gtk.SeparatorToolItem

Activatable widgets can be connected to a #GtkAction and reflects the state of its action. A #GtkActivatable can also provide feedback through its action, as they are responsible for activating their related actions. <refsect2> <title>Implementing GtkActivatable</title> <para> When extending a class that is already #GtkActivatable; it is only necessary to implement the #GtkActivatable->sync_action_properties() and #GtkActivatable->update() methods and chain up to the parent implementation, however when introducing a new #GtkActivatable class; the #GtkActivatable:related-action and #GtkActivatable:use-action-appearance properties need to be handled by the implementor. Handling these properties is mostly a matter of installing the action pointer and boolean flag on your instance, and calling gtk_activatable_do_set_related_action() and gtk_activatable_sync_action_properties() at the appropriate times. </para> <example> <title>A class fragment implementing #GtkActivatable</title> <programlisting><![CDATA[ enum { ... PROP_ACTIVATABLE_RELATED_ACTION, PROP_ACTIVATABLE_USE_ACTION_APPEARANCE } struct _FooBarPrivate { ... GtkAction *action; gboolean use_action_appearance; }; ... static void foo_bar_activatable_interface_init (GtkActivatableIface *iface); static void foo_bar_activatable_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name); static void foo_bar_activatable_sync_action_properties (GtkActivatable *activatable, GtkAction *action); ... static void foo_bar_class_init (FooBarClass *klass) { ... g_object_class_override_property (gobject_class, PROP_ACTIVATABLE_RELATED_ACTION, "related-action"); g_object_class_override_property (gobject_class, PROP_ACTIVATABLE_USE_ACTION_APPEARANCE, "use-action-appearance"); ... } static void foo_bar_activatable_interface_init (GtkActivatableIface *iface) { iface->update = foo_bar_activatable_update; iface->sync_action_properties = foo_bar_activatable_sync_action_properties; } ... Break the reference using gtk_activatable_do_set_related_action()... static void foo_bar_dispose (GObject *object) { FooBar *bar = FOO_BAR (object); FooBarPrivate *priv = FOO_BAR_GET_PRIVATE (bar); ... if (priv->action) { gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (bar), NULL); priv->action = NULL; } G_OBJECT_CLASS (foo_bar_parent_class)->dispose (object); } ... Handle the "related-action" and "use-action-appearance" properties ... static void foo_bar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { FooBar *bar = FOO_BAR (object); FooBarPrivate *priv = FOO_BAR_GET_PRIVATE (bar); switch (prop_id) { ... case PROP_ACTIVATABLE_RELATED_ACTION: foo_bar_set_related_action (bar, g_value_get_object (value)); break; case PROP_ACTIVATABLE_USE_ACTION_APPEARANCE: foo_bar_set_use_action_appearance (bar, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void foo_bar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { FooBar *bar = FOO_BAR (object); FooBarPrivate *priv = FOO_BAR_GET_PRIVATE (bar); switch (prop_id) { ... case PROP_ACTIVATABLE_RELATED_ACTION: g_value_set_object (value, priv->action); break; case PROP_ACTIVATABLE_USE_ACTION_APPEARANCE: g_value_set_boolean (value, priv->use_action_appearance); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void foo_bar_set_use_action_appearance (FooBar *bar, gboolean use_appearance) { FooBarPrivate *priv = FOO_BAR_GET_PRIVATE (bar); if (priv->use_action_appearance != use_appearance) { priv->use_action_appearance = use_appearance; gtk_activatable_sync_action_properties (GTK_ACTIVATABLE (bar), priv->action); } } ... call gtk_activatable_do_set_related_action() and then assign the action pointer, no need to reference the action here since gtk_activatable_do_set_related_action() already holds a reference here for you... static void foo_bar_set_related_action (FooBar *bar, GtkAction *action) { FooBarPrivate *priv = FOO_BAR_GET_PRIVATE (bar); if (priv->action == action) return; gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (bar), action); priv->action = action; } ... Selectively reset and update activatable depending on the use-action-appearance property ... static void gtk_button_activatable_sync_action_properties (GtkActivatable *activatable, GtkAction *action) { GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (activatable); if (!action) return; if (gtk_action_is_visible (action)) gtk_widget_show (GTK_WIDGET (activatable)); else gtk_widget_hide (GTK_WIDGET (activatable)); gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action)); ... if (priv->use_action_appearance) { if (gtk_action_get_stock_id (action)) foo_bar_set_stock (button, gtk_action_get_stock_id (action)); else if (gtk_action_get_label (action)) foo_bar_set_label (button, gtk_action_get_label (action)); ... } } static void foo_bar_activatable_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name) { FooBarPrivate *priv = FOO_BAR_GET_PRIVATE (activatable); if (strcmp (property_name, "visible") == 0) { if (gtk_action_is_visible (action)) gtk_widget_show (GTK_WIDGET (activatable)); else gtk_widget_hide (GTK_WIDGET (activatable)); } else if (strcmp (property_name, "sensitive") == 0) gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action)); ... if (!priv->use_action_appearance) return; if (strcmp (property_name, "stock-id") == 0) foo_bar_set_stock (button, gtk_action_get_stock_id (action)); else if (strcmp (property_name, "label") == 0) foo_bar_set_label (button, gtk_action_get_label (action)); ... }]]></programlisting> </example> </refsect2>

Properties

gboolean"use-action-appearance"read/write

Whether this activatable should reset its layout and appearance when setting the related action or when the action changes appearance. See the #GtkAction documentation directly to find which properties should be ignored by the #GtkActivatable when this property is %FALSE. <note><para>#GtkActivatable implementors need to handle this property and call gtk_activatable_sync_action_properties() on the activatable widget when it changes.</para></note>

Gtk.Action"related-action"read/write

The action that this activatable will activate and receive updates from for various states and possibly appearance. <note><para>#GtkActivatable implementors need to handle the this property and call gtk_activatable_do_set_related_action() when it changes.</para></note>

Methods

voiddo_set_related_action(action)

Gtk.Actionget_related_action()

boolget_use_action_appearance()

voidset_related_action(action)

voidset_use_action_appearance(use_appearance)

voidsync_action_properties(action)

voidupdate(action, property_name)

Class: Gtk.Adjustment

Subclass of: GObject.InitiallyUnowned

The #GtkAdjustment object represents a value which has an associated lower and upper bound, together with step and page increments, and a page size. It is used within several GTK+ widgets, including #GtkSpinButton, #GtkViewport, and #GtkRange (which is a base class for #GtkHScrollbar, #GtkVScrollbar, #GtkHScale, and #GtkVScale). The #GtkAdjustment object does not update the value itself. Instead it is left up to the owner of the #GtkAdjustment to control the value. The owner of the #GtkAdjustment typically calls the gtk_adjustment_value_changed() and gtk_adjustment_changed() functions after changing the value and its bounds. This results in the emission of the #GtkAdjustment::value_changed or #GtkAdjustment::changed signal respectively.

Properties

float"page-size"read/write

The page size of the adjustment. Note that the page-size is irrelevant and should be set to zero if the adjustment is used for a simple scalar value, e.g. in a #GtkSpinButton.

float"upper"read/write

The maximum value of the adjustment. Note that values will be restricted by <literal>upper - page-size</literal> if the page-size property is nonzero.

float"lower"read/write

The minimum value of the adjustment.

float"step-increment"read/write

The step increment of the adjustment.

float"value"read/write

The value of the adjustment.

float"page-increment"read/write

The page increment of the adjustment.

Signals

void"changed"(self, adjustment)

Emitted when one or more of the #GtkAdjustment fields have been changed, other than the value field.

void"value-changed"(self, adjustment)

Emitted when the #GtkAdjustment value field has been changed.

Methods

voidchanged()

voidclamp_page(lower, upper)

voidconfigure(value, lower, upper, step_increment, page_increment, page_size)

floatget_lower()

floatget_page_increment()

floatget_page_size()

floatget_step_increment()

floatget_upper()

floatget_value()

voidset_lower(lower)

voidset_page_increment(page_increment)

voidset_page_size(page_size)

voidset_step_increment(step_increment)

voidset_upper(upper)

voidset_value(value)

voidvalue_changed()

Class: Gtk.Alignment

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Bin

The #GtkAlignment widget controls the alignment and size of its child widget. The scale settings are used to specify how much the child widget should expand to fill the space allocated to the #GtkAlignment. The values can range from 0 (meaning the child doesn't expand at all) to 1 (meaning the child expands to fill all of the available space). The align settings are used to place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect. <note> <para> Note that the desired effect can in most cases be achieved by using the #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties on the child widget, so #GtkAlignment should not be used in new code. </para> </note>

Properties

float"xalign"read/write

int"top-padding"read/write

The padding to insert at the top of the widget.

float"yalign"read/write

int"left-padding"read/write

The padding to insert at the left of the widget.

float"yscale"read/write

int"right-padding"read/write

The padding to insert at the right of the widget.

float"xscale"read/write

int"bottom-padding"read/write

The padding to insert at the bottom of the widget.

Methods

void, int, int, int, intget_padding()

voidset(xalign, yalign, xscale, yscale)

voidset_padding(padding_top, padding_bottom, padding_left, padding_right)

Interface: Gtk.AppChooser

Classes implementing Gtk.AppChooser: Gtk.AppChooserWidget, Gtk.AppChooserButton, Gtk.AppChooserDialog

#GtkAppChooser is an interface that can be implemented by widgets which allow the user to choose an application (typically for the purpose of opening a file). The main objects that implement this interface are #GtkAppChooserWidget, #GtkAppChooserDialog and #GtkAppChooserButton.

Properties

utf8"content-type"construct-only

The content type of the #GtkAppChooser object.

Methods

Gio.AppInfoget_app_info()

stringget_content_type()

voidrefresh()

Class: Gtk.AppChooserButton

Implements: Gtk.AppChooser, Gtk.CellLayout, Gtk.Buildable, Gtk.CellEditable, Atk.ImplementorIface

Subclass of: Gtk.ComboBox

The #GtkAppChooserButton is a widget that lets the user select an application. It implements the #GtkAppChooser interface.

Properties

bool"show-dialog-item"construct-only

The #GtkAppChooserButton:show-dialog-item property determines whether the dropdown menu should show an item that triggers a #GtkAppChooserDialog when clicked.

string"heading"read/write

The text to show at the top of the dialog that can be opened from the button. The string may contain Pango markup.

Signals

void"custom-item-activated"(self, app_chooser_button, item_name)

Emitted when a custom item, previously added with gtk_app_chooser_button_append_custom_item(), is activated from the dropdown menu.

Methods

voidappend_custom_item(name, label, icon)

voidappend_separator()

voidcustom_item_activated(item_name)

stringget_heading()

boolget_show_dialog_item()

voidset_active_custom_item(name)

voidset_heading(heading)

voidset_show_dialog_item(setting)

Class: Gtk.AppChooserDialog

Implements: Gtk.AppChooser, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Dialog

#GtkAppChooserDialog shows a #GtkAppChooserWidget inside a #GtkDialog. Note that #GtkAppChooserDialog does not have any interesting methods of its own. Instead, you should get the embedded #GtkAppChooserWidget using gtk_app_chooser_dialog_get_widget() and call its methods if the generic #GtkAppChooser interface is not sufficient for your needs.

Properties

Gio.File"gfile"construct-only

The GFile used by the #GtkAppChooserDialog. The dialog's #GtkAppChooserWidget content type will be guessed from the file, if present.

string"heading"read/write

The text to show at the top of the dialog. The string may contain Pango markup.

Methods

stringget_heading()

Gtk.Widgetget_widget()

voidset_heading(heading)

Class: Gtk.AppChooserWidget

Implements: Gtk.AppChooser, Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Box

#GtkAppChooserWidget is a widget for selecting applications. It is the main building block for #GtkAppChooserDialog. Most applications only need to use the latter; but you can use this widget as part of a larger widget if you have special needs.

Properties

string"default-text"read/write

The #GtkAppChooserWidget:default-text property determines the text that appears in the widget when there are no applications for the given content type. See also gtk_app_chooser_widget_set_default_text().

bool"show-fallback"construct-only

The #GtkAppChooserWidget:show-fallback property determines whether the app chooser should show a section for related applications. If %FALSE, the related applications are listed among the other applications.

bool"show-all"construct-only

If the #GtkAppChooserWidget:show-all property is %TRUE, the app chooser presents all applications in a single list, without subsections for default, recommended or related applications.

bool"show-recommended"construct-only

The #GtkAppChooserWidget:show-recommended property determines whether the app chooser should show a section for recommended applications. If %FALSE, the recommended applications are listed among the other applications.

bool"show-other"construct-only

The #GtkAppChooserWidget:show-other property determines whether the app chooser should show a section for other applications.

bool"show-default"construct-only

The ::show-default property determines whether the app chooser should show the default handler for the content type in a separate section. If %FALSE, the default handler is listed among the recommended applications.

Signals

void"populate-popup"(self, app_chooser_widget, menu, application)

Emitted when a context menu is about to popup over an application item. Clients can insert menu items into the provided #GtkMenu object in the callback of this signal; the context menu will be shown over the item if at least one item has been added to the menu.

void"application-selected"(self, app_chooser_widget, application)

Emitted when an application item is selected from the widget's list.

void"application-activated"(self, app_chooser_widget, application)

Emitted when an application item is activated from the widget's list. This usually happens when the user double clicks an item, or an item is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

Methods

voidapplication_activated(app_info)

voidapplication_selected(app_info)

stringget_default_text()

boolget_show_all()

boolget_show_default()

boolget_show_fallback()

boolget_show_other()

boolget_show_recommended()

voidpopulate_popup(menu, app_info)

voidset_default_text(text)

voidset_show_all(setting)

voidset_show_default(setting)

voidset_show_fallback(setting)

voidset_show_other(setting)

voidset_show_recommended(setting)

Class: Gtk.Application

Implements: Gio.ActionGroup

Subclass of: Gio.Application

#GtkApplication is a class that handles many important aspects of a GTK+ application in a convenient fashion, without enforcing a one-size-fits-all application model. Currently, GtkApplication handles GTK+ initialization, application uniqueness, provides some basic scriptability by exporting 'actions', and manages a list of toplevel windows whose life-cycle is automatically tied to the life-cycle of your application. <example id="gtkapplication"><title>A simple application</title> <programlisting> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../examples/bloatpad.c"> <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback> </xi:include> </programlisting> </example>

Methods

voidadd_window(window)

GLib.Listget_windows()

voidremove_window(window)

Class: Gtk.Arrow

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Misc

GtkArrow should be used to draw simple arrows that need to point in one of the four cardinal directions (up, down, left, or right). The style of the arrow can be one of shadow in, shadow out, etched in, or etched out. Note that these directions and style types may be ammended in versions of GTK+ to come. GtkArrow will fill any space alloted to it, but since it is inherited from #GtkMisc, it can be padded and/or aligned, to fill exactly the space the programmer desires. Arrows are created with a call to gtk_arrow_new(). The direction or style of an arrow can be changed after creation by using gtk_arrow_set().

Properties

Gtk.ShadowType"shadow-type"read/write

Gtk.ArrowType"arrow-type"read/write

Methods

Class: Gtk.AspectFrame

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Frame

The #GtkAspectFrame is useful when you want pack a widget so that it can resize but always retains the same aspect ratio. For instance, one might be drawing a small preview of a larger image. #GtkAspectFrame derives from #GtkFrame, so it can draw a label and a frame around the child. The frame will be "shrink-wrapped" to the size of the child.

Properties

float"xalign"read/write

bool"obey-child"read/write

float"ratio"read/write

float"yalign"read/write

Methods

voidset(xalign, yalign, ratio, obey_child)

Class: Gtk.Assistant

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Window

A #GtkAssistant is a widget used to represent a generally complex operation splitted in several steps, guiding the user through its pages and controlling the page flow to collect the necessary data. The design of GtkAssistant is that it controls what buttons to show and to make sensitive, based on what it knows about the page sequence and the <link linkend="GtkAssistantPageType">type</link> of each page, in addition to state information like the page <link linkend="gtk-assistant-set-page-complete">completion</link> and <link linkend="gtk-assistant-commit">committed</link> status. If you have a case that doesn't quite fit in #GtkAssistants way of handling buttons, you can use the #GTK_ASSISTANT_PAGE_CUSTOM page type and handle buttons yourself. <refsect2 id="GtkAssistant-BUILDER-UI"> <title>GtkAssistant as GtkBuildable</title> <para> The GtkAssistant implementation of the GtkBuildable interface exposes the To add pages to an assistant in GtkBuilder, simply add it as a &lt;child&gt; to the GtkAssistant object, and set its child properties as necessary. </para> </refsect2>

Signals

void"cancel"(self, assistant)

The ::cancel signal is emitted when then the cancel button is clicked.

void"apply"(self, assistant)

The ::apply signal is emitted when the apply button is clicked. The default behavior of the #GtkAssistant is to switch to the page after the current page, unless the current page is the last one. A handler for the ::apply signal should carry out the actions for which the wizard has collected data. If the action takes a long time to complete, you might consider putting a page of type %GTK_ASSISTANT_PAGE_PROGRESS after the confirmation page and handle this operation within the #GtkAssistant::prepare signal of the progress page.

void"prepare"(self, assistant, page)

The ::prepare signal is emitted when a new page is set as the assistant's current page, before making the new page visible. A handler for this signal can do any preparation which are necessary before showing @page.

void"close"(self, assistant)

The ::close signal is emitted either when the close button of a summary page is clicked, or when the apply button in the last page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.

Methods

voidadd_action_widget(child)

intappend_page(page)

voidapply()

voidcancel()

voidclose()

voidcommit()

intget_current_page()

intget_n_pages()

Gtk.Widgetget_nth_page(page_num)

boolget_page_complete(page)

GdkPixbuf.Pixbufget_page_header_image(page)

GdkPixbuf.Pixbufget_page_side_image(page)

stringget_page_title(page)

Gtk.AssistantPageTypeget_page_type(page)

intinsert_page(page, position)

voidnext_page()

voidprepare(page)

intprepend_page(page)

voidprevious_page()

voidremove_action_widget(child)

voidset_current_page(page_num)

voidset_forward_page_func(page_func, data, destroy)

voidset_page_complete(page, complete)

voidset_page_header_image(page, pixbuf)

voidset_page_side_image(page, pixbuf)

voidset_page_title(page, title)

voidset_page_type(page, type)

voidupdate_buttons_state()

Abstract Class: Gtk.Bin

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.Expander, Gtk.Alignment, Gtk.ToolItem, Gtk.Viewport, Gtk.ComboBox, Gtk.Window, Gtk.Frame, Gtk.ScrolledWindow, Gtk.MenuItem, Gtk.Button, Gtk.EventBox, Gtk.HandleBox

Subclass of: Gtk.Container

The #GtkBin widget is a container with just one child. It is not very useful itself, but it is useful for deriving subclasses, since it provides common code needed for handling a single child widget. Many GTK+ widgets are subclasses of #GtkBin, including #GtkWindow, #GtkButton, #GtkFrame, #GtkHandleBox or #GtkScrolledWindow.

Methods

Gtk.Widgetget_child()

Class: Gtk.Box

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.ButtonBox, Gtk.AppChooserWidget, Gtk.VBox, Gtk.HBox

Subclass of: Gtk.Container

GtkBox is an widget which encapsulates functionality for a particular kind of container, one that organizes a variable number of widgets into a rectangular area. GtkBox has a number of derived classes, e.g. #GtkHBox and #GtkVBox. The rectangular area of a GtkBox is organized into either a single row or a single column of child widgets depending upon whether the box is of type #GtkHBox or #GtkVBox, respectively. Thus, all children of a GtkBox are allocated one dimension in common, which is the height of a row, or the width of a column. GtkBox uses a notion of <emphasis>packing</emphasis>. Packing refers to adding widgets with reference to a particular position in a #GtkContainer. For a GtkBox, there are two reference positions: the <emphasis>start</emphasis> and the <emphasis>end</emphasis> of the box. For a #GtkVBox, the start is defined as the top of the box and the end is defined as the bottom. For a #GtkHBox the start is defined as the left side and the end is defined as the right side. Use repeated calls to gtk_box_pack_start() to pack widgets into a GtkBox from start to end. Use gtk_box_pack_end() to add widgets from end to start. You may intersperse these calls and add widgets from both ends of the same GtkBox. Because GtkBox is a #GtkContainer, you may also use gtk_container_add() to insert widgets into the box, and they will be packed with the default values for #GtkBox:expand and #GtkBox:fill. Use gtk_container_remove() to remove widgets from the GtkBox. Use gtk_box_set_homogeneous() to specify whether or not all children of the GtkBox are forced to get the same amount of space. Use gtk_box_set_spacing() to determine how much space will be minimally placed between all children in the GtkBox. Note that spacing is added <emphasis>between</emphasis> the children, while padding added by gtk_box_pack_start() or gtk_box_pack_end() is added <emphasis>on either side</emphasis> of the widget it belongs to. Use gtk_box_reorder_child() to move a GtkBox child to a different place in the box. Use gtk_box_set_child_packing() to reset the #GtkBox:expand, #GtkBox:fill and #GtkBox:padding child properties. Use gtk_box_query_child_packing() to query these fields. <note> <para> Note that a single-row or single-column #GtkGrid provides exactly the same functionality as #GtkBox. </para> </note>

Properties

bool"homogeneous"read/write

int"spacing"read/write

Methods

boolget_homogeneous()

intget_spacing()

voidpack_end(child, expand, fill, padding)

voidpack_start(child, expand, fill, padding)

void, bool, bool, int, Gtk.PackTypequery_child_packing(child)

voidreorder_child(child, position)

voidset_child_packing(child, expand, fill, padding, pack_type)

voidset_homogeneous(homogeneous)

voidset_spacing(spacing)

Interface: Gtk.Buildable

Classes implementing Gtk.Buildable: Gtk.RecentChooserWidget, Gtk.CellView, Gtk.Layout, Gtk.IconView, Gtk.VScale, Gtk.Misc, Gtk.Table, Gtk.Button, Gtk.OffscreenWindow, Gtk.ButtonBox, Gtk.ColorSelectionDialog, Gtk.ComboBox, Gtk.Notebook, Gtk.ComboBoxText, Gtk.TreeView, Gtk.RadioToolButton, Gtk.VolumeButton, Gtk.SizeGroup, Gtk.Action, Gtk.RadioAction, Gtk.Menu, Gtk.CellAreaBox, Gtk.RecentFilter, Gtk.Fixed, Gtk.LinkButton, Gtk.ToolPalette, Gtk.ToolItem, Gtk.AboutDialog, Gtk.FontSelectionDialog, Gtk.Frame, Gtk.ActionGroup, Gtk.Window, Gtk.ListStore, Gtk.ScaleButton, Gtk.Range, Gtk.HandleBox, Gtk.CellArea, Gtk.Box, Gtk.MenuToolButton, Gtk.Dialog, Gtk.DrawingArea, Gtk.HPaned, Gtk.FontButton, Gtk.EventBox, Gtk.AspectFrame, Gtk.Scale, Gtk.ProgressBar, Gtk.HSV, Gtk.FontSelection, Gtk.ToggleAction, Gtk.VButtonBox, Gtk.ToggleButton, Gtk.HScrollbar, Gtk.Invisible, Gtk.HSeparator, Gtk.VBox, Gtk.InfoBar, Gtk.FileFilter, Gtk.MenuBar, Gtk.MenuItem, Gtk.SeparatorToolItem, Gtk.ColorButton, Gtk.Socket, Gtk.RecentAction, Gtk.VScrollbar, Gtk.CheckMenuItem, Gtk.AppChooserDialog, Gtk.Paned, Gtk.FileChooserButton, Gtk.Arrow, Gtk.Entry, Gtk.AccelLabel, Gtk.Expander, Gtk.ToolItemGroup, Gtk.CheckButton, Gtk.HScale, Gtk.IconFactory, Gtk.RecentChooserDialog, Gtk.SeparatorMenuItem, Gtk.Alignment, Gtk.AppChooserWidget, Gtk.Toolbar, Gtk.RadioButton, Gtk.TextTagTable, Gtk.UIManager, Gtk.HButtonBox, Gtk.TreeViewColumn, Gtk.Plug, Gtk.EntryCompletion, Gtk.RadioMenuItem, Gtk.ColorSelection, Gtk.Image, Gtk.Container, Gtk.MessageDialog, Gtk.Label, Gtk.Switch, Gtk.SpinButton, Gtk.TextView, Gtk.Scrollbar, Gtk.Widget, Gtk.TearoffMenuItem, Gtk.Statusbar, Gtk.HBox, Gtk.Calendar, Gtk.ToggleToolButton, Gtk.ToolButton, Gtk.TreeStore, Gtk.AppChooserButton, Gtk.RecentChooserMenu, Gtk.VPaned, Gtk.VSeparator, Gtk.Viewport, Gtk.FileChooserDialog, Gtk.Spinner, Gtk.ScrolledWindow, Gtk.FileChooserWidget, Gtk.Assistant, Gtk.MenuShell, Gtk.Separator, Gtk.ImageMenuItem, Gtk.Bin, Gtk.Grid

GtkBuildable allows objects to extend and customize thier deserialization from <link linkend="BUILDER-UI">GtkBuilder UI descriptions</link>. The interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects. The GtkBuildable interface is implemented by all widgets and many of the non-widget objects that are provided by GTK+. The main user of this interface is #GtkBuilder. There should be very little need for applications to call any <function>gtk_buildable_...</function> functions. <note><para>An object only needs to implement this interface if it needs to extend the #GtkBuilder format or run any extra routines at deserialization time</para></note>

Methods

voidadd_child(builder, child, type)

GObject.Objectconstruct_child(builder, name)

voidcustom_finished(builder, child, tagname, data)

voidcustom_tag_end(builder, child, tagname, data)

bool, GLib.MarkupParser, gpointercustom_tag_start(builder, child, tagname)

GObject.Objectget_internal_child(builder, childname)

stringget_name()

voidparser_finished(builder)

voidset_buildable_property(builder, name, value)

voidset_name(name)

Class: Gtk.Builder

Subclass of: GObject.Object

A GtkBuilder is an auxiliary object that reads textual descriptions of a user interface and instantiates the described objects. To pass a description to a GtkBuilder, call gtk_builder_add_from_file() or gtk_builder_add_from_string(). These functions can be called multiple times; the builder merges the content of all descriptions. A GtkBuilder holds a reference to all objects that it has constructed and drops these references when it is finalized. This finalization can cause the destruction of non-widget objects or widgets which are not contained in a toplevel window. For toplevel windows constructed by a builder, it is the responsibility of the user to call gtk_widget_destroy() to get rid of them and all the widgets they contain. The functions gtk_builder_get_object() and gtk_builder_get_objects() can be used to access the widgets in the interface by the names assigned to them inside the UI description. Toplevel windows returned by these functions will stay around until the user explicitly destroys them with gtk_widget_destroy(). Other widgets will either be part of a larger hierarchy constructed by the builder (in which case you should not have to worry about their lifecycle), or without a parent, in which case they have to be added to some container to make use of them. Non-widget objects need to be reffed with g_object_ref() to keep them beyond the lifespan of the builder. The function gtk_builder_connect_signals() and variants thereof can be used to connect handlers to the named signals in the description. <refsect2 id="BUILDER-UI"> <title>GtkBuilder UI Definitions</title> <para> GtkBuilder parses textual descriptions of user interfaces which are specified in an XML format which can be roughly described by the DTD below. We refer to these descriptions as <firstterm>GtkBuilder UI definitions</firstterm> or just <firstterm>UI definitions</firstterm> if the context is clear. Do not confuse GtkBuilder UI Definitions with <link linkend="XML-UI">GtkUIManager UI Definitions</link>, which are more limited in scope. </para> <programlisting><![CDATA[ <!ELEMENT interface (requires|object)* > <!ELEMENT object (property|signal|child|ANY)* > <!ELEMENT property PCDATA > <!ELEMENT signal EMPTY > <!ELEMENT requires EMPTY > <!ELEMENT child (object|ANY*) > <!ATTLIST interface domain #IMPLIED > <!ATTLIST object id #REQUIRED class #REQUIRED type-func #IMPLIED constructor #IMPLIED > <!ATTLIST requires lib #REQUIRED version #REQUIRED > <!ATTLIST property name #REQUIRED translatable #IMPLIED comments #IMPLIED context #IMPLIED > <!ATTLIST signal name #REQUIRED handler #REQUIRED after #IMPLIED swapped #IMPLIED object #IMPLIED last_modification_time #IMPLIED > <!ATTLIST child type #IMPLIED internal-child #IMPLIED > ]]></programlisting> <para> The toplevel element is &lt;interface&gt;. It optionally takes a "domain" attribute, which will make the builder look for translated strings using dgettext() in the domain specified. This can also be done by calling gtk_builder_set_translation_domain() on the builder. Objects are described by &lt;object&gt; elements, which can contain &lt;property&gt; elements to set properties, &lt;signal&gt; elements which connect signals to handlers, and &lt;child&gt; elements, which describe child objects (most often widgets inside a container, but also e.g. actions in an action group, or columns in a tree model). A &lt;child&gt; element contains an &lt;object&gt; element which describes the child object. The target toolkit version(s) are described by &lt;requires&gt; elements, the "lib" attribute specifies the widget library in question (currently the only supported value is "gtk+") and the "version" attribute specifies the target version in the form "&lt;major&gt;.&lt;minor&gt;". The builder will error out if the version requirements are not met. Typically, the specific kind of object represented by an &lt;object&gt; element is specified by the "class" attribute. If the type has not been loaded yet, GTK+ tries to find the <function>_get_type()</function> from the class name by applying heuristics. This works in most cases, but if necessary, it is possible to specify the name of the <function>_get_type()</function> explictly with the "type-func" attribute. As a special case, GtkBuilder allows to use an object that has been constructed by a #GtkUIManager in another part of the UI definition by specifying the id of the #GtkUIManager in the "constructor" attribute and the name of the object in the "id" attribute. Objects must be given a name with the "id" attribute, which allows the application to retrieve them from the builder with gtk_builder_get_object(). An id is also necessary to use the object as property value in other parts of the UI definition. </para> <note><para> Prior to 2.20, GtkBuilder was setting the "name" property of constructed widgets to the "id" attribute. In GTK+ 2.20 or newer, you have to use gtk_buildable_get_name() instead of gtk_widget_get_name() to obtain the "id", or set the "name" property in your UI definition. </para></note> <para> Setting properties of objects is pretty straightforward with the &lt;property&gt; element: the "name" attribute specifies the name of the property, and the content of the element specifies the value. If the "translatable" attribute is set to a true value, GTK+ uses gettext() (or dgettext() if the builder has a translation domain set) to find a translation for the value. This happens before the value is parsed, so it can be used for properties of any type, but it is probably most useful for string properties. It is also possible to specify a context to disambiguate short strings, and comments which may help the translators. GtkBuilder can parse textual representations for the most common property (strings like "TRUE", "t", "yes", "y", "1" are interpreted as %TRUE, strings like "FALSE, "f", "no", "n", "0" are interpreted as %FALSE), enumerations (can be specified by their name, nick or integer value), flags (can be specified by their name, nick, integer value, optionally combined with "|", e.g. "GTK_VISIBLE|GTK_REALIZED") and colors (in a format understood by gdk_color_parse()). Objects can be referred to by their name. Pixbufs can be specified as a filename of an image file to load. In general, GtkBuilder allows forward references to objects &mdash; an object doesn't have to be constructed before it can be referred to. The exception to this rule is that an object has to be constructed before it can be used as the value of a construct-only property. Signal handlers are set up with the &lt;signal&gt; element. The "name" attribute specifies the name of the signal, and the "handler" attribute specifies the function to connect to the signal. By default, GTK+ tries to find the handler using g_module_symbol(), but this can be changed by passing a custom #GtkBuilderConnectFunc to gtk_builder_connect_signals_full(). The remaining attributes, "after", "swapped" and "object", have the same meaning as the corresponding parameters of the g_signal_connect_object() or g_signal_connect_data() functions. A "last_modification_time" attribute is also allowed, but it does not have a meaning to the builder. Sometimes it is necessary to refer to widgets which have implicitly been constructed by GTK+ as part of a composite widget, to set properties on them or to add further children (e.g. the @vbox of a #GtkDialog). This can be achieved by setting the "internal-child" propery of the &lt;child&gt; element to a true value. Note that GtkBuilder still requires an &lt;object&gt; element for the internal child, even if it has already been constructed. A number of widgets have different places where a child can be added (e.g. tabs vs. page content in notebooks). This can be reflected in a UI definition by specifying the "type" attribute on a &lt;child&gt;. The possible values for the "type" attribute are described in the sections describing the widget-specific portions of UI definitions. </para> <example> <title>A GtkBuilder UI Definition</title> <programlisting><![CDATA[ <interface> <object class="GtkDialog" id="dialog1"> <child internal-child="vbox"> <object class="GtkVBox" id="vbox1"> <property name="border-width">10</property> <child internal-child="action_area"> <object class="GtkHButtonBox" id="hbuttonbox1"> <property name="border-width">20</property> <child> <object class="GtkButton" id="ok_button"> <property name="label">gtk-ok</property> <property name="use-stock">TRUE</property> <signal name="clicked" handler="ok_button_clicked"/> </object> </child> </object> </child> </object> </child> </object> </interface> ]]></programlisting> </example> <para> Beyond this general structure, several object classes define their own XML DTD fragments for filling in the ANY placeholders in the DTD above. Note that a custom element in a &lt;child&gt; element gets parsed by the custom tag handler of the parent object, while a custom element in an &lt;object&gt; element gets parsed by the custom tag handler of the object. These XML fragments are explained in the documentation of the respective objects, see <link linkend="GtkWidget-BUILDER-UI">GtkWidget</link>, <link linkend="GtkLabel-BUILDER-UI">GtkLabel</link>, <link linkend="GtkWindow-BUILDER-UI">GtkWindow</link>, <link linkend="GtkContainer-BUILDER-UI">GtkContainer</link>, <link linkend="GtkDialog-BUILDER-UI">GtkDialog</link>, <link linkend="GtkCellLayout-BUILDER-UI">GtkCellLayout</link>, <link linkend="GtkColorSelectionDialog-BUILDER-UI">GtkColorSelectionDialog</link>, <link linkend="GtkFontSelectionDialog-BUILDER-UI">GtkFontSelectionDialog</link>, <link linkend="GtkExpander-BUILDER-UI">GtkExpander</link>, <link linkend="GtkFrame-BUILDER-UI">GtkFrame</link>, <link linkend="GtkListStore-BUILDER-UI">GtkListStore</link>, <link linkend="GtkTreeStore-BUILDER-UI">GtkTreeStore</link>, <link linkend="GtkNotebook-BUILDER-UI">GtkNotebook</link>, <link linkend="GtkSizeGroup-BUILDER-UI">GtkSizeGroup</link>, <link linkend="GtkTreeView-BUILDER-UI">GtkTreeView</link>, <link linkend="GtkUIManager-BUILDER-UI">GtkUIManager</link>, <link linkend="GtkActionGroup-BUILDER-UI">GtkActionGroup</link>. <link linkend="GtkMenuItem-BUILDER-UI">GtkMenuItem</link>, <link linkend="GtkMenuToolButton-BUILDER-UI">GtkMenuToolButton</link>, <link linkend="GtkAssistant-BUILDER-UI">GtkAssistant</link>, <link linkend="GtkScale-BUILDER-UI">GtkScale</link>, <link linkend="GtkComboBoxText-BUILDER-UI">GtkComboBoxText</link>, <link linkend="GtkRecentFilter-BUILDER-UI">GtkRecentFilter</link>, <link linkend="GtkFileFilter-BUILDER-UI">GtkFileFilter</link>, <link linkend="GtkTextTagTable-BUILDER-UI">GtkTextTagTable</link>. </para> </refsect2>

Properties

string"translation-domain"read/write

The translation domain used when translating property values that have been marked as translatable in interface descriptions. If the translation domain is %NULL, #GtkBuilder uses gettext(), otherwise g_dgettext().

Methods

intadd_from_file(filename)

intadd_from_string(buffer, length)

intadd_objects_from_file(filename, object_ids)

intadd_objects_from_string(buffer, length, object_ids)

voidconnect_signals(user_data)

voidconnect_signals_full(func, user_data)

GObject.Objectget_object(name)

GLib.SListget_objects()

stringget_translation_domain()

GTypeget_type_from_name(type_name)

voidset_translation_domain(domain)

bool, GObject.Valuevalue_from_string(pspec, string)

bool, GObject.Valuevalue_from_string_type(type, string)

Class: Gtk.Button

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.FontButton, Gtk.ScaleButton, Gtk.LinkButton, Gtk.ColorButton, Gtk.ToggleButton

Subclass of: Gtk.Bin

The #GtkButton widget is generally used to attach a function to that is called when the button is pressed. The various signals and how to use them are outlined below. The #GtkButton widget can hold any valid child widget. That is it can hold most any other standard #GtkWidget. The most commonly used child is the #GtkLabel.

Properties

float"xalign"read/write

If the child of the button is a #GtkMisc or #GtkAlignment, this property can be used to control its horizontal alignment. 0.0 is left aligned, 1.0 is right aligned.

float"yalign"read/write

If the child of the button is a #GtkMisc or #GtkAlignment, this property can be used to control its vertical alignment. 0.0 is top aligned, 1.0 is bottom aligned.

Gtk.Widget"image"read/write

The child widget to appear next to the button text.

bool"focus-on-click"read/write

string"label"construct-only

Gtk.ReliefStyle"relief"read/write

bool"use-underline"construct-only

bool"use-stock"construct-only

Gtk.PositionType"image-position"read/write

The position of the image relative to the text inside the button.

Signals

void"activate"(self, button)

The ::activate signal on GtkButton is an action signal and emitting it causes the button to animate press then release. Applications should never connect to this signal, but use the #GtkButton::clicked signal.

void"clicked"(self, button)

Emitted when the button has been activated (pressed and released).

void"leave"(self, button)

Emitted when the pointer leaves the button.

void"released"(self, button)

Emitted when the button is released.

void"pressed"(self, button)

Emitted when the button is pressed.

void"enter"(self, button)

Emitted when the pointer enters the button.

Methods

voidactivate()

voidclicked()

voidenter()

void, float, floatget_alignment()

Gdk.Windowget_event_window()

boolget_focus_on_click()

Gtk.Widgetget_image()

Gtk.PositionTypeget_image_position()

stringget_label()

Gtk.ReliefStyleget_relief()

boolget_use_stock()

boolget_use_underline()

voidleave()

voidpressed()

voidreleased()

voidset_alignment(xalign, yalign)

voidset_focus_on_click(focus_on_click)

voidset_image(image)

voidset_image_position(position)

voidset_label(label)

voidset_relief(newstyle)

voidset_use_stock(use_stock)

voidset_use_underline(use_underline)

Class: Gtk.ButtonBox

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.HButtonBox, Gtk.VButtonBox

Subclass of: Gtk.Box

Properties

Gtk.ButtonBoxStyle"layout-style"read/write

Methods

boolget_child_secondary(child)

Gtk.ButtonBoxStyleget_layout()

voidset_child_secondary(child, is_secondary)

voidset_layout(layout_style)

Class: Gtk.Calendar

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Widget

#GtkCalendar is a widget that displays a Gregorian calendar, one month at a time. It can be created with gtk_calendar_new(). The month and year currently displayed can be altered with gtk_calendar_select_month(). The exact day can be selected from the displayed month using gtk_calendar_select_day(). To place a visual marker on a particular day, use gtk_calendar_mark_day() and to remove the marker, gtk_calendar_unmark_day(). Alternative, all marks can be cleared with gtk_calendar_clear_marks(). The way in which the calendar itself is displayed can be altered using gtk_calendar_set_display_options(). The selected date can be retrieved from a #GtkCalendar using gtk_calendar_get_date(). Users should be aware that, although the Gregorian calendar is the legal calendar in most countries, it was adopted progressively between 1582 and 1929. Display before these dates is likely to be historically incorrect.

Properties

bool"show-details"read/write

Determines whether details are shown directly in the widget, or if they are available only as tooltip. When this property is set days with details are marked.

bool"show-heading"read/write

Determines whether a heading is displayed.

int"year"read/write

The selected year. This property gets initially set to the current year.

int"detail-width-chars"read/write

Width of a detail cell, in characters. A value of 0 allows any width. See gtk_calendar_set_detail_func().

int"month"read/write

The selected month (as a number between 0 and 11). This property gets initially set to the current month.

int"detail-height-rows"read/write

Height of a detail cell, in rows. A value of 0 allows any width. See gtk_calendar_set_detail_func().

bool"show-week-numbers"read/write

Determines whether week numbers are displayed.

bool"show-day-names"read/write

Determines whether day names are displayed.

int"day"read/write

The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day). This property gets initially set to the current day.

bool"no-month-change"read/write

Determines whether the selected month can be changed.

Signals

void"month-changed"(self, calendar)

Emitted when the user clicks a button to change the selected month on a calendar.

void"day-selected-double-click"(self, calendar)

Emitted when the user double-clicks a day.

void"next-month"(self, calendar)

Emitted when the user switched to the next month.

void"prev-year"(self, calendar)

Emitted when user switched to the previous year.

void"day-selected"(self, calendar)

Emitted when the user selects a day.

void"prev-month"(self, calendar)

Emitted when the user switched to the previous month.

void"next-year"(self, calendar)

Emitted when user switched to the next year.

Methods

voidclear_marks()

voidday_selected()

voidday_selected_double_click()

void, int, int, intget_date()

boolget_day_is_marked(day)

intget_detail_height_rows()

intget_detail_width_chars()

Gtk.CalendarDisplayOptionsget_display_options()

voidmark_day(day)

voidmonth_changed()

voidnext_month()

voidnext_year()

voidprev_month()

voidprev_year()

voidselect_day(day)

voidselect_month(month, year)

voidset_detail_func(func, data, destroy)

voidset_detail_height_rows(rows)

voidset_detail_width_chars(chars)

voidset_display_options(flags)

voidunmark_day(day)

Abstract Class: Gtk.CellArea

Implements: Gtk.CellLayout, Gtk.Buildable

Known subclasses: Gtk.CellAreaBox

Subclass of: GObject.InitiallyUnowned

The #GtkCellArea is an abstract class for #GtkCellLayout widgets (also referred to as "layouting widgets") to interface with an arbitrary number of #GtkCellRenderers and interact with the user for a given #GtkTreeModel row. The cell area handles events, focus navigation, drawing and size requests and allocations for a given row of data. Usually users dont have to interact with the #GtkCellArea directly unless they are implementing a cell-layouting widget themselves. <refsect2 id="cell-area-geometry-management"> <title>Requesting area sizes</title> <para> As outlined in <link linkend="geometry-management">GtkWidget's geometry management section</link>, GTK+ uses a height-for-width geometry management system to compute the sizes of widgets and user interfaces. #GtkCellArea uses the same semantics to calculate the size of an area for an arbitrary number of #GtkTreeModel rows. When requesting the size of a cell area one needs to calculate the size for a handful of rows, and this will be done differently by different layouting widgets. For instance a #GtkTreeViewColumn always lines up the areas from top to bottom while a #GtkIconView on the other hand might enforce that all areas received the same width and wrap the areas around, requesting height for more cell areas when allocated less width. It's also important for areas to maintain some cell alignments with areas rendered for adjacent rows (cells can appear "columnized" inside an area even when the size of cells are different in each row). For this reason the #GtkCellArea uses a #GtkCellAreaContext object to store the alignments and sizes along the way (as well as the overall largest minimum and natural size for all the rows which have been calculated with the said context). The #GtkCellAreaContext is an opaque object specific to the #GtkCellArea which created it (see gtk_cell_area_create_context()). The owning cell-layouting widget can create as many contexts as it wishes to calculate sizes of rows which should receive the same size in at least one orientation (horizontally or vertically), However, it's important that the same #GtkCellAreaContext which was used to request the sizes for a given #GtkTreeModel row be used when rendering or processing events for that row. In order to request the width of all the rows at the root level of a #GtkTreeModel one would do the following: <example> <title>Requesting the width of a handful of GtkTreeModel rows</title> <programlisting> GtkTreeIter iter; gint minimum_width; gint natural_width; valid = gtk_tree_model_get_iter_first (model, &iter); while (valid) { gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE); gtk_cell_area_get_preferred_width (area, context, widget, NULL, NULL); valid = gtk_tree_model_iter_next (model, &iter); } gtk_cell_area_context_get_preferred_width (context, &minimum_width, &natural_width); </programlisting> </example> Note that in this example it's not important to observe the returned minimum and natural width of the area for each row unless the cell-layouting object is actually interested in the widths of individual rows. The overall width is however stored in the accompanying #GtkCellAreaContext object and can be consulted at any time. This can be useful since #GtkCellLayout widgets usually have to support requesting and rendering rows in treemodels with an exceedingly large amount of rows. The #GtkCellLayout widget in that case would calculate the required width of the rows in an idle or timeout source (see g_timeout_add()) and when the widget is requested its actual width in #GtkWidgetClass.get_preferred_width() it can simply consult the width accumulated so far in the #GtkCellAreaContext object. A simple example where rows are rendered from top to bottom and take up the full width of the layouting widget would look like: <example> <title>A typical get_preferred_width() implementation</title> <programlisting> static void foo_get_preferred_width (GtkWidget *widget, gint *minimum_size, gint *natural_size) { Foo *foo = FOO (widget); FooPrivate *priv = foo->priv; foo_ensure_at_least_one_handfull_of_rows_have_been_requested (foo); gtk_cell_area_context_get_preferred_width (priv->context, minimum_size, natural_size); } </programlisting> </example> In the above example the Foo widget has to make sure that some row sizes have been calculated (the amount of rows that Foo judged was appropriate to request space for in a single timeout iteration) before simply returning the amount of space required by the area via the #GtkCellAreaContext. Requesting the height for width (or width for height) of an area is a similar task except in this case the #GtkCellAreaContext does not store the data (actually, it does not know how much space the layouting widget plans to allocate it for every row. It's up to the layouting widget to render each row of data with the appropriate height and width which was requested by the #GtkCellArea). In order to request the height for width of all the rows at the root level of a #GtkTreeModel one would do the following: <example> <title>Requesting the height for width of a handful of GtkTreeModel rows</title> <programlisting> GtkTreeIter iter; gint minimum_height; gint natural_height; gint full_minimum_height = 0; gint full_natural_height = 0; valid = gtk_tree_model_get_iter_first (model, &iter); while (valid) { gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE); gtk_cell_area_get_preferred_height_for_width (area, context, widget, width, &minimum_height, &natural_height); if (width_is_for_allocation) cache_row_height (&iter, minimum_height, natural_height); full_minimum_height += minimum_height; full_natural_height += natural_height; valid = gtk_tree_model_iter_next (model, &iter); } </programlisting> </example> Note that in the above example we would need to cache the heights returned for each row so that we would know what sizes to render the areas for each row. However we would only want to really cache the heights if the request is intended for the layouting widgets real allocation. In some cases the layouting widget is requested the height for an arbitrary for_width, this is a special case for layouting widgets who need to request size for tens of thousands of rows. For this case it's only important that the layouting widget calculate one reasonably sized chunk of rows and return that height synchronously. The reasoning here is that any layouting widget is at least capable of synchronously calculating enough height to fill the screen height (or scrolled window height) in response to a single call to #GtkWidgetClass.get_preferred_height_for_width(). Returning a perfect height for width that is larger than the screen area is inconsequential since after the layouting receives an allocation from a scrolled window it simply continues to drive the the scrollbar values while more and more height is required for the row heights that are calculated in the background. </para> </refsect2> <refsect2 id="cell-area-rendering"> <title>Rendering Areas</title> <para> Once area sizes have been aquired at least for the rows in the visible area of the layouting widget they can be rendered at #GtkWidgetClass.draw() time. A crude example of how to render all the rows at the root level runs as follows: <example> <title>Requesting the width of a handful of GtkTreeModel rows</title> <programlisting> GtkAllocation allocation; GdkRectangle cell_area = { 0, }; GtkTreeIter iter; gint minimum_width; gint natural_width; gtk_widget_get_allocation (widget, &allocation); cell_area.width = allocation.width; valid = gtk_tree_model_get_iter_first (model, &iter); while (valid) { cell_area.height = get_cached_height_for_row (&iter); gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE); gtk_cell_area_render (area, context, widget, cr, &cell_area, &cell_area, state_flags, FALSE); cell_area.y += cell_area.height; valid = gtk_tree_model_iter_next (model, &iter); } </programlisting> </example> Note that the cached height in this example really depends on how the layouting widget works. The layouting widget might decide to give every row its minimum or natural height or, if the model content is expected to fit inside the layouting widget without scrolling, it would make sense to calculate the allocation for each row at #GtkWidget::size-allocate time using gtk_distribute_natural_allocation(). </para> </refsect2> <refsect2 id="cell-area-events-and-focus"> <title>Handling Events and Driving Keyboard Focus</title> <para> Passing events to the area is as simple as handling events on any normal widget and then passing them to the gtk_cell_area_event() API as they come in. Usually #GtkCellArea is only interested in button events, however some customized derived areas can be implemented who are interested in handling other events. Handling an event can trigger the #GtkCellArea::focus-changed signal to fire; as well as #GtkCellArea::add-editable in the case that an editable cell was clicked and needs to start editing. You can call gtk_cell_area_stop_editing() at any time to cancel any cell editing that is currently in progress. The #GtkCellArea drives keyboard focus from cell to cell in a way similar to #GtkWidget. For layouting widgets that support giving focus to cells it's important to remember to pass %GTK_CELL_RENDERER_FOCUSED to the area functions for the row that has focus and to tell the area to paint the focus at render time. Layouting widgets that accept focus on cells should implement the #GtkWidgetClass.focus() virtual method. The layouting widget is always responsible for knowing where #GtkTreeModel rows are rendered inside the widget, so at #GtkWidgetClass.focus() time the layouting widget should use the #GtkCellArea methods to navigate focus inside the area and then observe the GtkDirectionType to pass the focus to adjacent rows and areas. A basic example of how the #GtkWidgetClass.focus() virtual method should be implemented: <example> <title>Implementing keyboard focus navigation</title> <programlisting> static gboolean foo_focus (GtkWidget *widget, GtkDirectionType direction) { Foo *foo = FOO (widget); FooPrivate *priv = foo->priv; gint focus_row; gboolean have_focus = FALSE; focus_row = priv->focus_row; if (!gtk_widget_has_focus (widget)) gtk_widget_grab_focus (widget); valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, priv->focus_row); while (valid) { gtk_cell_area_apply_attributes (priv->area, priv->model, &iter, FALSE, FALSE); if (gtk_cell_area_focus (priv->area, direction)) { priv->focus_row = focus_row; have_focus = TRUE; break; } else { if (direction == GTK_DIR_RIGHT || direction == GTK_DIR_LEFT) break; else if (direction == GTK_DIR_UP || direction == GTK_DIR_TAB_BACKWARD) { if (focus_row == 0) break; else { focus_row--; valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, focus_row); } } else { if (focus_row == last_row) break; else { focus_row++; valid = gtk_tree_model_iter_next (priv->model, &iter); } } } } return have_focus; } </programlisting> </example> Note that the layouting widget is responsible for matching the GtkDirectionType values to the way it lays out its cells. </para> </refsect2> <refsect2 id="cell-properties"> <title>Cell Properties</title> <para> The #GtkCellArea introduces <emphasis>cell properties</emphasis> for #GtkCellRenderers in very much the same way that #GtkContainer introduces <link linkend="child-properties">child properties</link> for #GtkWidgets. This provides some general interfaces for defining the relationship cell areas have with their cells. For instance in a #GtkCellAreaBox a cell might "expand" and receive extra space when the area is allocated more than its full natural request, or a cell might be configured to "align" with adjacent rows which were requested and rendered with the same #GtkCellAreaContext. Use gtk_cell_area_class_install_cell_property() to install cell properties for a cell area class and gtk_cell_area_class_find_cell_property() or gtk_cell_area_class_list_cell_properties() to get information about existing cell properties. To set the value of a cell property, use gtk_cell_area_cell_set_property(), gtk_cell_area_cell_set() or gtk_cell_area_cell_set_valist(). To obtain the value of a cell property, use gtk_cell_area_cell_get_property(), gtk_cell_area_cell_get() or gtk_cell_area_cell_get_valist(). </para> </refsect2>

Properties

Gtk.CellEditable"edit-widget"read-only

The widget currently editing the edited cell This property is read-only and only changes as a result of a call gtk_cell_area_activate_cell().

Gtk.CellRenderer"focus-cell"read/write

The cell in the area that currently has focus

Gtk.CellRenderer"edited-cell"read-only

The cell in the area that is currently edited This property is read-only and only changes as a result of a call gtk_cell_area_activate_cell().

Signals

void"add-editable"(self, cell_area, renderer, editable, cell_area, path)

Indicates that editing has started on @renderer and that @editable should be added to the owning cell-layouting widget at @cell_area.

void"apply-attributes"(self, cell_area, model, iter, is_expander, is_expanded)

This signal is emitted whenever applying attributes to @area from @model

void"focus-changed"(self, cell_area, renderer, path)

Indicates that focus changed on this @area. This signal is emitted either as a result of focus handling or event handling. It's possible that the signal is emitted even if the currently focused renderer did not change, this is because focus may change to the same renderer in the same cell area for a different row of data.

void"remove-editable"(self, cell_area, renderer, editable)

Indicates that editing finished on @renderer and that @editable should be removed from the owning cell-layouting widget.

Methods

boolactivate(context, widget, cell_area, flags, edit_only)

boolactivate_cell(widget, renderer, event, cell_area, flags)

voidadd(renderer)

voidadd_focus_sibling(renderer, sibling)

voidapply_attributes(tree_model, iter, is_expander, is_expanded)

voidattribute_connect(renderer, attribute, column)

voidattribute_disconnect(renderer, attribute)

voidcell_get_property(renderer, property_name, value)

voidcell_set_property(renderer, property_name, value)

Gtk.CellAreaContextcreate_context()

intevent(context, widget, event, cell_area, flags)

boolfocus(direction)

voidforeach(callback, callback_data)

voidforeach_alloc(context, widget, cell_area, background_area, callback, callback_data)

void, Gdk.Rectangleget_cell_allocation(context, widget, renderer, cell_area)

Gtk.CellRenderer, Gdk.Rectangleget_cell_at_position(context, widget, cell_area, x, y)

voidget_cell_property(renderer, property_id, value, pspec)

stringget_current_path_string()

Gtk.CellEditableget_edit_widget()

Gtk.CellRendererget_edited_cell()

Gtk.CellRendererget_focus_cell()

Gtk.CellRendererget_focus_from_sibling(renderer)

GLib.Listget_focus_siblings(renderer)

void, int, intget_preferred_height(context, widget)

void, int, intget_preferred_height_for_width(context, widget, width)

void, int, intget_preferred_width(context, widget)

void, int, intget_preferred_width_for_height(context, widget, height)

Gtk.SizeRequestModeget_request_mode()

boolhas_renderer(renderer)

void, Gdk.Rectangleinner_cell_area(widget, cell_area)

boolis_activatable()

boolis_focus_sibling(renderer, sibling)

voidremove(renderer)

voidremove_focus_sibling(renderer, sibling)

voidrender(context, widget, cr, background_area, cell_area, flags, paint_focus)

void, int, intrequest_renderer(renderer, orientation, widget, for_size)

voidset_cell_property(renderer, property_id, value, pspec)

voidset_focus_cell(renderer)

voidstop_editing(canceled)

Class: Gtk.CellAreaBox

Implements: Gtk.CellLayout, Gtk.Buildable, Gtk.Orientable

Subclass of: Gtk.CellArea

The #GtkCellAreaBox renders cell renderers into a row or a column depending on its #GtkOrientation. GtkCellAreaBox uses a notion of <emphasis>packing</emphasis>. Packing refers to adding cell renderers with reference to a particular position <emphasis>start</emphasis> and the <emphasis>end</emphasis> of the box. When the #GtkCellAreaBox is oriented in the %GTK_ORIENTATION_VERTICAL orientation, the start is defined as the top of the box and the end is defined as the bottom. In the %GTK_ORIENTATION_HORIZONTAL orientation start is defined as the left side and the end is defined as the right side. Alignments of #GtkCellRenderers rendered in adjacent rows can be configured by configuring the #GtkCellAreaBox:align child cell property with gtk_cell_area_cell_set_property() or by specifying the "align" argument to gtk_cell_area_box_pack_start() and gtk_cell_area_box_pack_end().

Properties

int"spacing"read/write

The amount of space to reserve between cells.

Methods

intget_spacing()

voidpack_end(renderer, expand, align, fixed)

voidpack_start(renderer, expand, align, fixed)

voidset_spacing(spacing)

Class: Gtk.CellAreaContext

Subclass of: GObject.Object

The #GtkCellAreaContext object is created by a given #GtkCellArea implementation via its #GtkCellAreaClass.create_context() virtual method and is used to store cell sizes and alignments for a series of #GtkTreeModel rows that are requested and rendered in the same context. #GtkCellLayout widgets can create any number of contexts in which to request and render groups of data rows. However its important that the same context which was used to request sizes for a given #GtkTreeModel row also be used for the same row when calling other #GtkCellArea APIs such as gtk_cell_area_render() and gtk_cell_area_event().

Properties

int"natural-width"read-only

The natural width for the #GtkCellArea in this context for all #GtkTreeModel rows that this context was requested for using gtk_cell_area_get_preferred_width().

int"minimum-height"read-only

The minimum height for the #GtkCellArea in this context for all #GtkTreeModel rows that this context was requested for using gtk_cell_area_get_preferred_height().

int"natural-height"read-only

The natural height for the #GtkCellArea in this context for all #GtkTreeModel rows that this context was requested for using gtk_cell_area_get_preferred_height().

int"minimum-width"read-only

The minimum width for the #GtkCellArea in this context for all #GtkTreeModel rows that this context was requested for using gtk_cell_area_get_preferred_width().

Gtk.CellArea"area"construct-only

The #GtkCellArea this context was created by

Methods

voidallocate(width, height)

void, int, intget_allocation()

Gtk.CellAreaget_area()

void, int, intget_preferred_height()

void, int, intget_preferred_height_for_width(width)

void, int, intget_preferred_width()

void, int, intget_preferred_width_for_height(height)

voidpush_preferred_height(minimum_height, natural_height)

voidpush_preferred_width(minimum_width, natural_width)

voidreset()

Interface: Gtk.CellEditable

Classes implementing Gtk.CellEditable: Gtk.SpinButton, Gtk.AppChooserButton, Gtk.ComboBox, Gtk.Entry, Gtk.ComboBoxText

The #GtkCellEditable interface must be implemented for widgets to be usable when editing the contents of a #GtkTreeView cell.

Properties

gboolean"editing-canceled"read/write

Indicates whether editing on the cell has been canceled.

Signals

none"remove-widget"(self, cell_editable)

This signal is meant to indicate that the cell is finished editing, and the widget may now be destroyed. Implementations of #GtkCellEditable are responsible for emitting this signal when they are done editing. It must be emitted after the #GtkCellEditable::editing-done signal, to give the cell renderer a chance to update the cell's value before the widget is removed. gtk_cell_editable_remove_widget() is a convenience method for emitting #GtkCellEditable::remove-widget.

none"editing-done"(self, cell_editable)

This signal is a sign for the cell renderer to update its value from the @cell_editable. Implementations of #GtkCellEditable are responsible for emitting this signal when they are done editing, e.g. #GtkEntry is emitting it when the user presses Enter. gtk_cell_editable_editing_done() is a convenience method for emitting #GtkCellEditable::editing-done.

Methods

voidediting_done()

voidremove_widget()

voidstart_editing(event)

Interface: Gtk.CellLayout

Classes implementing Gtk.CellLayout: Gtk.TreeViewColumn, Gtk.CellView, Gtk.CellArea, Gtk.EntryCompletion, Gtk.ComboBox, Gtk.IconView, Gtk.CellAreaBox, Gtk.AppChooserButton, Gtk.ComboBoxText

#GtkCellLayout is an interface to be implemented by all objects which want to provide a #GtkTreeViewColumn-like API for packing cells, setting attributes and data funcs. One of the notable features provided by implementations of GtkCellLayout are <emphasis>attributes</emphasis>. Attributes let you set the properties in flexible ways. They can just be set to constant values like regular properties. But they can also be mapped to a column of the underlying tree model with gtk_cell_layout_set_attributes(), which means that the value of the attribute can change from cell to cell as they are rendered by the cell renderer. Finally, it is possible to specify a function with gtk_cell_layout_set_cell_data_func() that is called to determine the value of the attribute for each cell that is rendered. <refsect2 id="GtkCellLayout-BUILDER-UI"> <title>GtkCellLayouts as GtkBuildable</title> <para> Implementations of GtkCellLayout which also implement the GtkBuildable interface (#GtkCellView, #GtkIconView, #GtkComboBox, #GtkComboBoxEntry, #GtkEntryCompletion, #GtkTreeViewColumn) accept GtkCellRenderer objects as &lt;child&gt; elements in UI definitions. They support a custom &lt;attributes&gt; element for their children, which can contain multiple &lt;attribute&gt; elements. Each &lt;attribute&gt; element has a name attribute which specifies a property of the cell renderer; the content of the element is the attribute value. <example> <title>A UI definition fragment specifying attributes</title> <programlisting><![CDATA[ <object class="GtkCellView"> <child> <object class="GtkCellRendererText"/> <attributes> <attribute name="text">0</attribute> </attributes> </child>" </object> ]]></programlisting> </example> Furthermore for implementations of GtkCellLayout that use a #GtkCellArea to lay out cells (all GtkCellLayouts in GTK+ use a GtkCellArea) <link linkend="cell-properties">cell properties</link> can also be defined in the format by specifying the custom &lt;cell-packing&gt; attribute which can contain multiple &lt;property&gt; elements defined in the normal way. <example> <title>A UI definition fragment specifying cell properties</title> <programlisting><![CDATA[ <object class="GtkTreeViewColumn"> <child> <object class="GtkCellRendererText"/> <cell-packing> <property name="align">True</property> <property name="expand">False</property> </cell-packing> </child>" </object> ]]></programlisting> </example> </para> </refsect2> <refsect2> <title>Subclassing GtkCellLayout implementations</title> <para> When subclassing a widget that implements #GtkCellLayout like #GtkIconView or #GtkComboBox, there are some considerations related to the fact that these widgets internally use a #GtkCellArea. The cell area is exposed as a construct-only property by these widgets. This means that it is possible to e.g. do <informalexample><programlisting> combo = g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", my_cell_area, NULL); </programlisting></informalexample> to use a custom cell area with a combo box. But construct properties are only initialized <emphasis>after</emphasis> instance init() functions have run, which means that using functions which rely on the existence of the cell area in your subclass' init() function will cause the default cell area to be instantiated. In this case, a provided construct property value will be ignored (with a warning, to alert you to the problem). <informalexample><programlisting> static void my_combo_box_init (MyComboBox *b) { GtkCellRenderer *cell; cell = gtk_cell_renderer_pixbuf_new (); /&ast; The following call causes the default cell area for combo boxes, &ast; a GtkCellAreaBox, to be instantiated &ast;/ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (b), cell, FALSE); ... } GtkWidget * my_combo_box_new (GtkCellArea *area) { /&ast; This call is going to cause a warning &ast; about area being ignored &ast;/ return g_object_new (MY_TYPE_COMBO_BOX, "cell-area", area, NULL); } </programlisting></informalexample> If supporting alternative cell areas with your derived widget is not important, then this does not have to concern you. If you want to support alternative cell areas, you can do so by moving the problematic calls out of init() and into a constructor() for your class. </para> </refsect2>

Methods

voidadd_attribute(cell, attribute, column)

voidclear()

voidclear_attributes(cell)

Gtk.CellAreaget_area()

GLib.Listget_cells()

voidpack_end(cell, expand)

voidpack_start(cell, expand)

voidreorder(cell, position)

voidset_cell_data_func(cell, func, func_data, destroy)

Abstract Class: Gtk.CellRenderer

Known subclasses: Gtk.CellRendererText, Gtk.CellRendererProgress, Gtk.CellRendererPixbuf, Gtk.CellRendererSpinner, Gtk.CellRendererToggle

Subclass of: GObject.InitiallyUnowned

The #GtkCellRenderer is a base class of a set of objects used for rendering a cell to a #cairo_t. These objects are used primarily by the #GtkTreeView widget, though they aren't tied to them in any specific way. It is worth noting that #GtkCellRenderer is not a #GtkWidget and cannot be treated as such. The primary use of a #GtkCellRenderer is for drawing a certain graphical elements on a #cairo_t. Typically, one cell renderer is used to draw many cells on the screen. To this extent, it isn't expected that a CellRenderer keep any permanent state around. Instead, any state is set just prior to use using #GObject<!-- -->s property system. Then, the cell is measured using gtk_cell_renderer_get_size(). Finally, the cell is rendered in the correct location using gtk_cell_renderer_render(). There are a number of rules that must be followed when writing a new #GtkCellRenderer. First and formost, its important that a certain set of properties will always yield a cell renderer of the same size, barring a #GtkStyle change. The #GtkCellRenderer also has a number of generic properties that are expected to be honored by all children. Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be <firstterm>activatable</firstterm> like #GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be <firstterm>editable</firstterm> like #GtkCellRendererText, which allows the user to edit the text using a #GtkEntry. To make a cell renderer activatable or editable, you have to implement the #GtkCellRendererClass.activate or #GtkCellRendererClass.start_editing virtual functions, respectively.

Properties

float"xalign"read/write

int"xpad"read/write

float"yalign"read/write

bool"is-expander"read/write

bool"sensitive"read/write

bool"visible"read/write

int"height"read/write

int"ypad"read/write

bool"is-expanded"read/write

int"width"read/write

Gtk.CellRendererMode"mode"read/write

bool"cell-background-set"read/write

string"cell-background"read/write

bool"editing"read-only

Gdk.RGBA"cell-background-rgba"read/write

Cell background as a #GdkRGBA

Gdk.Color"cell-background-gdk"read/write

Signals

void"editing-canceled"(self, cell_renderer)

This signal gets emitted when the user cancels the process of editing a cell. For example, an editable cell renderer could be written to cancel editing when the user presses Escape.

void"editing-started"(self, cell_renderer, editable, path)

This signal gets emitted when a cell starts to be edited. The intended use of this signal is to do special setup on @editable, e.g. adding a #GtkEntryCompletion or setting up additional columns in a #GtkComboBox. Note that GTK+ doesn't guarantee that cell renderers will continue to use the same kind of widget for editing in future releases, therefore you should check the type of @editable before doing any specific setup, as in the following example: |[ static void text_editing_started (GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data) { if (GTK_IS_ENTRY (editable)) { GtkEntry *entry = GTK_ENTRY (editable); /&ast; ... create a GtkEntryCompletion &ast;/ gtk_entry_set_completion (entry, completion); } } ]|

Methods

boolactivate(event, widget, path, background_area, cell_area, flags)

voidediting_canceled()

voidediting_started(editable, path)

void, Gdk.Rectangleget_aligned_area(widget, flags, cell_area)

void, float, floatget_alignment()

void, int, intget_fixed_size()

void, int, intget_padding()

void, int, intget_preferred_height(widget)

void, int, intget_preferred_height_for_width(widget, width)

void, Gtk.Requisition, Gtk.Requisitionget_preferred_size(widget)

void, int, intget_preferred_width(widget)

void, int, intget_preferred_width_for_height(widget, height)

Gtk.SizeRequestModeget_request_mode()

boolget_sensitive()

void, int, int, int, intget_size(widget, cell_area)

boolget_visible()

boolis_activatable()

voidrender(cr, widget, background_area, cell_area, flags)

voidset_alignment(xalign, yalign)

voidset_fixed_size(width, height)

voidset_padding(xpad, ypad)

voidset_sensitive(sensitive)

voidset_visible(visible)

Gtk.CellEditablestart_editing(event, widget, path, background_area, cell_area, flags)

voidstop_editing(canceled)

Class: Gtk.CellRendererAccel

Subclass of: Gtk.CellRendererText

Properties

Gtk.CellRendererAccelMode"accel-mode"read/write

Determines if the edited accelerators are GTK+ accelerators. If they are, consumed modifiers are suppressed, only accelerators accepted by GTK+ are allowed, and the accelerators are rendered in the same way as they are in menus.

int"accel-key"read/write

The keyval of the accelerator.

Gdk.ModifierType"accel-mods"read/write

The modifier mask of the accelerator.

int"keycode"read/write

The hardware keycode of the accelerator. Note that the hardware keycode is only relevant if the key does not have a keyval. Normally, the keyboard configuration should assign keyvals to all keys.

Signals

void"accel-edited"(self, cell_renderer_accel, path_string, accel_key, accel_mods, hardware_keycode)

Gets emitted when the user has selected a new accelerator.

void"accel-cleared"(self, cell_renderer_accel, path_string)

Gets emitted when the user has removed the accelerator.

Methods

voidaccel_cleared(path_string)

voidaccel_edited(path_string, accel_key, accel_mods, hardware_keycode)

Class: Gtk.CellRendererCombo

Subclass of: Gtk.CellRendererText

Properties

bool"has-entry"read/write

If %TRUE, the cell renderer will include an entry and allow to enter values other than the ones in the popup list.

Gtk.TreeModel"model"read/write

Holds a tree model containing the possible values for the combo box. Use the text_column property to specify the column holding the values.

int"text-column"read/write

Specifies the model column which holds the possible values for the combo box. Note that this refers to the model specified in the model property, <emphasis>not</emphasis> the model backing the tree view to which this cell renderer is attached. #GtkCellRendererCombo automatically adds a text cell renderer for this column to its combo box.

Signals

void"changed"(self, cell_renderer_combo, path_string, new_iter)

This signal is emitted each time after the user selected an item in the combo box, either by using the mouse or the arrow keys. Contrary to GtkComboBox, GtkCellRendererCombo::changed is not emitted for changes made to a selected item in the entry. The argument @new_iter corresponds to the newly selected item in the combo box and it is relative to the GtkTreeModel set via the model property on GtkCellRendererCombo. Note that as soon as you change the model displayed in the tree view, the tree view will immediately cease the editing operating. This means that you most probably want to refrain from changing the model until the combo cell renderer emits the edited or editing_canceled signal.

Class: Gtk.CellRendererPixbuf

Subclass of: Gtk.CellRenderer

Properties

int"stock-size"read/write

GdkPixbuf.Pixbuf"pixbuf-expander-open"read/write

string"stock-detail"read/write

GdkPixbuf.Pixbuf"pixbuf-expander-closed"read/write

string"stock-id"read/write

string"icon-name"read/write

The name of the themed icon to display. This property only has an effect if not overridden by "stock_id" or "pixbuf" properties.

bool"follow-state"read/write

Specifies whether the rendered pixbuf should be colorized according to the #GtkCellRendererState.

GdkPixbuf.Pixbuf"pixbuf"read/write

Gio.Icon"gicon"read/write

The GIcon representing the icon to display. If the icon theme is changed, the image will be updated automatically.

Class: Gtk.CellRendererProgress

Implements: Gtk.Orientable

Subclass of: Gtk.CellRenderer

Properties

float"text-yalign"read/write

The "text-yalign" property controls the vertical alignment of the text in the progress bar. Valid values range from 0 (top) to 1 (bottom).

string"text"read/write

The "text" property determines the label which will be drawn over the progress bar. Setting this property to %NULL causes the default label to be displayed. Setting this property to an empty string causes no label to be displayed.

float"text-xalign"read/write

The "text-xalign" property controls the horizontal alignment of the text in the progress bar. Valid values range from 0 (left) to 1 (right). Reserved for RTL layouts.

int"value"read/write

The "value" property determines the percentage to which the progress bar will be "filled in".

bool"inverted"read/write

int"pulse"read/write

Setting this to a non-negative value causes the cell renderer to enter "activity mode", where a block bounces back and forth to indicate that some progress is made, without specifying exactly how much. Each increment of the property causes the block to move by a little bit. To indicate that the activity has not started yet, set the property to zero. To indicate completion, set the property to %G_MAXINT.

Class: Gtk.CellRendererSpin

Subclass of: Gtk.CellRendererText

Properties

int"digits"read/write

The number of decimal places to display.

Gtk.Adjustment"adjustment"read/write

The adjustment that holds the value of the spinbutton. This must be non-%NULL for the cell renderer to be editable.

float"climb-rate"read/write

The acceleration rate when you hold down a button.

Class: Gtk.CellRendererSpinner

Subclass of: Gtk.CellRenderer

GtkCellRendererSpinner renders a spinning animation in a cell, very similar to #GtkSpinner. It can often be used as an alternative to a #GtkCellRendererProgress for displaying indefinite activity, instead of actual progress. To start the animation in a cell, set the #GtkCellRendererSpinner:active property to %TRUE and increment the #GtkCellRendererSpinner:pulse property at regular intervals. The usual way to set the cell renderer properties for each cell is to bind them to columns in your tree model using e.g. gtk_tree_view_column_add_attribute().

Properties

bool"active"read/write

int"pulse"read/write

Pulse of the spinner. Increment this value to draw the next frame of the spinner animation. Usually, you would update this value in a timeout. By default, the #GtkSpinner widget draws one full cycle of the animation, consisting of 12 frames, in 750 milliseconds.

Gtk.IconSize"size"read/write

The #GtkIconSize value that specifies the size of the rendered spinner.

Class: Gtk.CellRendererText

Known subclasses: Gtk.CellRendererCombo, Gtk.CellRendererAccel, Gtk.CellRendererSpin

Subclass of: Gtk.CellRenderer

A #GtkCellRendererText renders a given text in its cell, using the font, color and style information provided by its properties. The text will be ellipsized if it is too long and the #GtkCellRendererText:ellipsize property allows it. If the #GtkCellRenderer:mode is %GTK_CELL_RENDERER_MODE_EDITABLE, the #GtkCellRendererText allows to edit its text using an entry.

Properties

float"size-points"read/write

string"family"read/write

bool"style-set"read/write

bool"rise-set"read/write

Gdk.RGBA"foreground-rgba"read/write

Foreground color as a #GdkRGBA

bool"strikethrough"read/write

Pango.Style"style"read/write

Pango.WrapMode"wrap-mode"read/write

Specifies how to break the string into multiple lines, if the cell renderer does not have enough room to display the entire string. This property has no effect unless the wrap-width property is set.

bool"underline-set"read/write

bool"foreground-set"read/write

string"font"read/write

Gdk.RGBA"background-rgba"read/write

Background color as a #GdkRGBA

Pango.Underline"underline"read/write

Pango.Alignment"alignment"read/write

Specifies how to align the lines of text with respect to each other. Note that this property describes how to align the lines of text in case there are several of them. The "xalign" property of #GtkCellRenderer, on the other hand, sets the horizontal alignment of the whole text.

int"size"read/write

Pango.FontDescription"font-desc"read/write

float"scale"read/write

Gdk.Color"background-gdk"read/write

Pango.Stretch"stretch"read/write

bool"align-set"read/write

bool"size-set"read/write

string"text"read/write

bool"variant-set"read/write

bool"background-set"read/write

string"foreground"read/write

int"width-chars"read/write

The desired width of the cell, in characters. If this property is set to -1, the width will be calculated automatically, otherwise the cell will request either 3 characters or the property value, whichever is greater.

Pango.EllipsizeMode"ellipsize"read/write

Specifies the preferred place to ellipsize the string, if the cell renderer does not have enough room to display the entire string. Setting it to %PANGO_ELLIPSIZE_NONE turns off ellipsizing. See the wrap-width property for another way of making the text fit into a given width.

int"wrap-width"read/write

Specifies the minimum width at which the text is wrapped. The wrap-mode property can be used to influence at what character positions the line breaks can be placed. Setting wrap-width to -1 turns wrapping off.

bool"editable-set"read/write

Pango.Variant"variant"read/write

int"rise"read/write

bool"editable"read/write

int"max-width-chars"read/write

The desired maximum width of the cell, in characters. If this property is set to -1, the width will be calculated automatically. For cell renderers that ellipsize or wrap text; this property controls the maximum reported width of the cell. The cell should not receive any greater allocation unless it is set to expand in its #GtkCellLayout and all of the cell's siblings have received their natural width.

int"weight"read/write

bool"strikethrough-set"read/write

bool"family-set"read/write

string"background"read/write

bool"single-paragraph-mode"read/write

bool"language-set"read/write

bool"ellipsize-set"read/write

Gdk.Color"foreground-gdk"read/write

string"language"read/write

string"markup"read/write

bool"stretch-set"read/write

bool"scale-set"read/write

Pango.AttrList"attributes"read/write

bool"weight-set"read/write

Signals

void"edited"(self, cell_renderer_text, path, new_text)

This signal is emitted after @renderer has been edited. It is the responsibility of the application to update the model and store @new_text at the position indicated by @path.

Methods

voidedited(path, new_text)

voidset_fixed_height_from_font(number_of_rows)

Class: Gtk.CellRendererToggle

Subclass of: Gtk.CellRenderer

Properties

bool"active"read/write

int"indicator-size"read/write

bool"radio"read/write

bool"activatable"read/write

bool"inconsistent"read/write

Signals

void"toggled"(self, cell_renderer_toggle, path)

The ::toggled signal is emitted when the cell is toggled.

Methods

boolget_activatable()

boolget_active()

boolget_radio()

voidset_activatable(setting)

voidset_active(setting)

voidset_radio(radio)

voidtoggled(path)

Class: Gtk.CellView

Implements: Gtk.CellLayout, Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Widget

A #GtkCellView displays a single row of a #GtkTreeModel using a #GtkCellArea and #GtkCellAreaContext. A #GtkCellAreaContext can be provided to the #GtkCellView at construction time in order to keep the cellview in context of a group of cell views, this ensures that the renderers displayed will be properly aligned with eachother (like the aligned cells in the menus of #GtkComboBox). #GtkCellView is #GtkOrientable in order to decide in which orientation the underlying #GtkCellAreaContext should be allocated. Taking the #GtkComboBox menu as an example, cellviews should be oriented horizontally if the menus are listed top-to-bottom and thus all share the same width but may have separate individual heights (left-to-right menus should be allocated vertically since they all share the same height but may have variable widths).

Properties

Gdk.Color"background-gdk"read/write

bool"fit-model"read/write

Whether the view should request enough space to always fit the size of every row in the model (used by the combo box to ensure the combo box size doesnt change when different items are selected). since 3.0

Gtk.CellAreaContext"cell-area-context"construct-only

The #GtkCellAreaContext used to compute the geometry of the cell view. A group of cell views can be assigned the same context in order to ensure the sizes and cell alignments match across all the views with the same context. #GtkComboBox menus uses this to assign the same context to all cell views in the menu items for a single menu (each submenu creates its own context since the size of each submenu does not depend on parent or sibling menus). since 3.0

Gtk.CellArea"cell-area"construct-only

The #GtkCellArea rendering cells If no area is specified when creating the cell view with gtk_cell_view_new_with_context() a horizontally oriented #GtkCellAreaBox will be used. since 3.0

string"background"read/write

Gtk.TreeModel"model"read/write

The model for cell view since 2.10

Gdk.RGBA"background-rgba"read/write

The background color as a #GdkRGBA

bool"background-set"read/write

bool"draw-sensitive"read/write

Whether all cells should be draw as sensitive for this view regardless of the actual cell properties (used to make menus with submenus appear sensitive when the items in submenus might be insensitive). since 3.0

Methods

Gtk.TreePathget_displayed_row()

boolget_draw_sensitive()

boolget_fit_model()

Gtk.TreeModelget_model()

bool, Gtk.Requisitionget_size_of_row(path)

voidset_background_color(color)

voidset_background_rgba(rgba)

voidset_displayed_row(path)

voidset_draw_sensitive(draw_sensitive)

voidset_fit_model(fit_model)

voidset_model(model)

Class: Gtk.CheckButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.RadioButton

Subclass of: Gtk.ToggleButton

Methods

voiddraw_indicator(cr)

Class: Gtk.CheckMenuItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.RadioMenuItem

Subclass of: Gtk.MenuItem

Properties

bool"active"read/write

bool"draw-as-radio"read/write

bool"inconsistent"read/write

Signals

void"toggled"(self, check_menu_item)

Methods

voiddraw_indicator(cr)

boolget_active()

boolget_draw_as_radio()

boolget_inconsistent()

voidset_active(is_active)

voidset_draw_as_radio(draw_as_radio)

voidset_inconsistent(setting)

voidtoggled()

Class: Gtk.Clipboard

Subclass of: GObject.Object

Signals

void"owner-change"(self, clipboard, event)

The ::owner-change signal is emitted when GTK+ receives an event that indicates that the ownership of the selection associated with @clipboard has changed.

Methods

voidclear()

Gtk.Clipboardget(selection)(static method)

Gdk.Displayget_display()

Gtk.Clipboardget_for_display(display, selection)(static method)

GObject.Objectget_owner()

voidrequest_contents(target, callback, user_data)

voidrequest_image(callback, user_data)

voidrequest_rich_text(buffer, callback, user_data)

voidrequest_targets(callback, user_data)

voidrequest_text(callback, user_data)

voidrequest_uris(callback, user_data)

voidset_can_store(targets, n_targets)

voidset_image(pixbuf)

voidset_text(text, len)

voidstore()

Gtk.SelectionDatawait_for_contents(target)

GdkPixbuf.Pixbufwait_for_image()

Array, Gdk.Atom, Gtk.gsizewait_for_rich_text(buffer)

bool, Array, intwait_for_targets()

stringwait_for_text()

Arraywait_for_uris()

boolwait_is_image_available()

boolwait_is_rich_text_available(buffer)

boolwait_is_target_available(target)

boolwait_is_text_available()

boolwait_is_uris_available()

Class: Gtk.ColorButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Button

The #GtkColorButton is a button which displays the currently selected color an allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.

Properties

Gdk.Color"color"read/write

The selected color.

int"alpha"read/write

The selected opacity value (0 fully transparent, 65535 fully opaque).

bool"use-alpha"read/write

If this property is set to %TRUE, the color swatch on the button is rendered against a checkerboard background to show its opacity and the opacity slider is displayed in the color selection dialog.

Gdk.RGBA"rgba"read/write

The RGBA color.

string"title"read/write

The title of the color selection dialog

Signals

void"color-set"(self, color_button)

The ::color-set signal is emitted when the user selects a color. When handling this signal, use gtk_color_button_get_color() and gtk_color_button_get_alpha() (or gtk_color_button_get_rgba()) to find out which color was just selected. Note that this signal is only emitted when the <emphasis>user</emphasis> changes the color. If you need to react to programmatic color changes as well, use the notify::color signal.

Methods

voidcolor_set()

intget_alpha()

void, Gdk.Colorget_color()

void, Gdk.RGBAget_rgba()

stringget_title()

boolget_use_alpha()

voidset_alpha(alpha)

voidset_color(color)

voidset_rgba(rgba)

voidset_title(title)

voidset_use_alpha(use_alpha)

Class: Gtk.ColorSelection

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.VBox

Properties

Gdk.Color"current-color"read/write

int"current-alpha"read/write

bool"has-palette"read/write

Gdk.RGBA"current-rgba"read/write

The current RGBA color.

bool"has-opacity-control"read/write

Signals

void"color-changed"(self, color_selection)

This signal is emitted when the color changes in the #GtkColorSelection according to its update policy.

Methods

voidcolor_changed()

intget_current_alpha()

void, Gdk.Colorget_current_color()

void, Gdk.RGBAget_current_rgba()

boolget_has_opacity_control()

boolget_has_palette()

intget_previous_alpha()

void, Gdk.Colorget_previous_color()

void, Gdk.RGBAget_previous_rgba()

boolis_adjusting()

bool, Array, intpalette_from_string(str)(static method)

stringpalette_to_string(colors, n_colors)(static method)

voidset_current_alpha(alpha)

voidset_current_color(color)

voidset_current_rgba(rgba)

voidset_has_opacity_control(has_opacity)

voidset_has_palette(has_palette)

voidset_previous_alpha(alpha)

voidset_previous_color(color)

voidset_previous_rgba(rgba)

Class: Gtk.ColorSelectionDialog

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Dialog

Properties

Gtk.Widget"ok-button"read-only

Gtk.Widget"help-button"read-only

Gtk.Widget"cancel-button"read-only

Gtk.Widget"color-selection"read-only

Methods

Gtk.Widgetget_color_selection()

Class: Gtk.ComboBox

Implements: Gtk.CellLayout, Gtk.Buildable, Gtk.CellEditable, Atk.ImplementorIface

Known subclasses: Gtk.AppChooserButton, Gtk.ComboBoxText

Subclass of: Gtk.Bin

A GtkComboBox is a widget that allows the user to choose from a list of valid choices. The GtkComboBox displays the selected choice. When activated, the GtkComboBox displays a popup which allows the user to make a new choice. The style in which the selected value is displayed, and the style of the popup is determined by the current theme. It may be similar to a Windows-style combo box. The GtkComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since GtkComboBox implements the #GtkCellLayout interface. The tree model holding the valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree structure. To allow the user to enter values not in the model, the 'has-entry' property allows the GtkComboBox to contain a #GtkEntry. This entry can be accessed by calling gtk_bin_get_child() on the combo box. For a simple list of textual choices, the model-view API of GtkComboBox can be a bit overwhelming. In this case, #GtkComboBoxText offers a simple alternative. Both GtkComboBox and #GtkComboBoxText can contain an entry.

Properties

Gtk.SensitivityType"button-sensitivity"read/write

Whether the dropdown button is sensitive when the model is empty.

int"row-span-column"read/write

If this is set to a non-negative value, it must be the index of a column of type %G_TYPE_INT in the model. The values of that column are used to determine how many rows a value in the list will span. Therefore, the values in the model column pointed to by this property must be greater than zero and not larger than wrap-width.

bool"has-frame"read/write

The has-frame property controls whether a frame is drawn around the entry.

bool"popup-shown"read-only

Whether the combo boxes dropdown is popped up. Note that this property is mainly useful, because it allows you to connect to notify::popup-shown.

string"active-id"read/write

The value of the ID column of the active row.

bool"has-entry"construct-only

Whether the combo box has an entry.

bool"focus-on-click"read/write

string"tearoff-title"read/write

A title that may be displayed by the window manager when the popup is torn-off.

int"column-span-column"read/write

If this is set to a non-negative value, it must be the index of a column of type %G_TYPE_INT in the model. The values of that column are used to determine how many columns a value in the list will span.

bool"popup-fixed-width"read/write

Whether the popup's width should be a fixed width matching the allocated width of the combo box.

int"entry-text-column"read/write

The column in the combo box's model to associate with strings from the entry if the combo was created with #GtkComboBox:has-entry = %TRUE.

Gtk.CellArea"cell-area"construct-only

The #GtkCellArea used to layout cell renderers for this combo box. If no area is specified when creating the combo box with gtk_combo_box_new_with_area() a horizontally oriented #GtkCellAreaBox will be used.

int"id-column"read/write

The column in the combo box's model that provides string IDs for the values in the model, if != -1.

int"active"read/write

The item which is currently active. If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this property has the value <literal>gtk_tree_path_get_indices (path)[0]</literal>, where <literal>path</literal> is the #GtkTreePath of the active item.

bool"add-tearoffs"read/write

The add-tearoffs property controls whether generated menus have tearoff menu items. Note that this only affects menu style combo boxes.

Gtk.TreeModel"model"read/write

The model from which the combo box takes the values shown in the list.

int"wrap-width"read/write

If wrap-width is set to a positive value, the list will be displayed in multiple columns, the number of columns is determined by wrap-width.

Signals

void"changed"(self, combo_box)

The changed signal is emitted when the active item is changed. The can be due to the user selecting a different item from the list, or due to a call to gtk_combo_box_set_active_iter(). It will also be emitted while typing into the entry of a combo box with an entry.

void"popup"(self, combo_box)

The ::popup signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to popup the combo box list. The default binding for this signal is Alt+Down.

void"move-active"(self, combo_box, scroll_type)

The ::move-active signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to move the active selection.

bool"popdown"(self, combo_box)

The ::popdown signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to popdown the combo box list. The default bindings for this signal are Alt+Up and Escape.

Methods

voidchanged()

intget_active()

stringget_active_id()

bool, Gtk.TreeIterget_active_iter()

boolget_add_tearoffs()

Gtk.SensitivityTypeget_button_sensitivity()

intget_column_span_column()

intget_entry_text_column()

boolget_focus_on_click()

boolget_has_entry()

intget_id_column()

Gtk.TreeModelget_model()

Atk.Objectget_popup_accessible()

boolget_popup_fixed_width()

intget_row_span_column()

stringget_title()

intget_wrap_width()

voidpopdown()

voidpopup()

voidpopup_for_device(device)

voidset_active(index_)

voidset_active_id(active_id)

voidset_active_iter(iter)

voidset_add_tearoffs(add_tearoffs)

voidset_button_sensitivity(sensitivity)

voidset_column_span_column(column_span)

voidset_entry_text_column(text_column)

voidset_focus_on_click(focus_on_click)

voidset_id_column(id_column)

voidset_model(model)

voidset_popup_fixed_width(fixed)

voidset_row_separator_func(func, data, destroy)

voidset_row_span_column(row_span)

voidset_title(title)

voidset_wrap_width(width)

Class: Gtk.ComboBoxText

Implements: Gtk.CellLayout, Gtk.Buildable, Gtk.CellEditable, Atk.ImplementorIface

Subclass of: Gtk.ComboBox

A GtkComboBoxText is a simple variant of #GtkComboBox that hides the model-view complexity for simple text-only use cases. To create a GtkComboBoxText, use gtk_combo_box_text_new() or gtk_combo_box_text_new_with_entry(). You can add items to a GtkComboBoxText with gtk_combo_box_text_append_text(), gtk_combo_box_text_insert_text() or gtk_combo_box_text_prepend_text() and remove options with gtk_combo_box_text_remove(). If the GtkComboBoxText contains an entry (via the 'has-entry' property), its contents can be retrieved using gtk_combo_box_text_get_active_text(). The entry itself can be accessed by calling gtk_bin_get_child() on the combo box. <refsect2 id="GtkComboBoxText-BUILDER-UI"> <title>GtkComboBoxText as GtkBuildable</title> <para> The GtkComboBoxText implementation of the GtkBuildable interface supports adding items directly using the &lt;items&gt element and specifying &lt;item&gt elements for each item. Each &lt;item&gt element supports the regular translation attributes "translatable", "context" and "comments". <example> <title>A UI definition fragment specifying GtkComboBoxText items</title> <programlisting><![CDATA[ <object class="GtkComboBoxText"> <items> <item translatable="yes">Factory</item> <item translatable="yes">Home</item> <item translatable="yes">Subway</item> </items> </object> ]]></programlisting> </example> </para> </refsect2>

Methods

voidappend(id, text)

voidappend_text(text)

stringget_active_text()

voidinsert(position, id, text)

voidinsert_text(position, text)

voidprepend(id, text)

voidprepend_text(text)

voidremove(position)

voidremove_all()

Abstract Class: Gtk.Container

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.Notebook, Gtk.ToolPalette, Gtk.ToolItemGroup, Gtk.TextView, Gtk.Toolbar, Gtk.Box, Gtk.MenuShell, Gtk.Layout, Gtk.IconView, Gtk.Fixed, Gtk.Bin, Gtk.TreeView, Gtk.Table, Gtk.Socket, Gtk.Grid, Gtk.Paned

Subclass of: Gtk.Widget

A GTK+ user interface is constructed by nesting widgets inside widgets. Container widgets are the inner nodes in the resulting tree of widgets: they contain other widgets. So, for example, you might have a #GtkWindow containing a #GtkFrame containing a #GtkLabel. If you wanted an image instead of a textual label inside the frame, you might replace the #GtkLabel widget with a #GtkImage widget. There are two major kinds of container widgets in GTK+. Both are subclasses of the abstract GtkContainer base class. The first type of container widget has a single child widget and derives from #GtkBin. These containers are <emphasis>decorators</emphasis>, which add some kind of functionality to the child. For example, a #GtkButton makes its child into a clickable button; a #GtkFrame draws a frame around its child and a #GtkWindow places its child widget inside a top-level window. The second type of container can have more than one child; its purpose is to manage <emphasis>layout</emphasis>. This means that these containers assign sizes and positions to their children. For example, a #GtkHBox arranges its children in a horizontal row, and a #GtkTable arranges the widgets it contains in a two-dimensional grid. <refsect2 id="container-geometry-management"> <title>Height for width geometry management</title> <para> GTK+ uses a height-for-width (and width-for-height) geometry management system. Height-for-width means that a widget can change how much vertical space it needs, depending on the amount of horizontal space that it is given (and similar for width-for-height). There are some things to keep in mind when implementing container widgets that make use of GTK+'s height for width geometry management system. First, it's important to note that a container must prioritize one of its dimensions, that is to say that a widget or container can only have a #GtkSizeRequestMode that is %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT. However, every widget and container must be able to respond to the APIs for both dimensions, i.e. even if a widget has a request mode that is height-for-width, it is possible that its parent will request its sizes using the width-for-height APIs. To ensure that everything works properly, here are some guidelines to follow when implementing height-for-width (or width-for-height) containers. Each request mode involves 2 virtual methods. Height-for-width apis run through gtk_widget_get_preferred_width() and then through gtk_widget_get_preferred_height_for_width(). When handling requests in the opposite #GtkSizeRequestMode it is important that every widget request at least enough space to display all of its content at all times. When gtk_widget_get_preferred_height() is called on a container that is height-for-width, the container must return the height for its minimum width. This is easily achieved by simply calling the reverse apis implemented for itself as follows: <programlisting><![CDATA[ static void foo_container_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height) { if (i_am_in_height_for_width_mode) { gint min_width; GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, min_height, nat_height); } else { ... many containers support both request modes, execute the real width-for-height request here by returning the collective heights of all widgets that are stacked vertically (or whatever is appropriate for this container) ... } } ]]></programlisting> Similarly, when gtk_widget_get_preferred_width_for_height() is called for a container or widget that is height-for-width, it then only needs to return the base minimum width like so: <programlisting><![CDATA[ static void foo_container_get_preferred_width_for_height (GtkWidget *widget, gint for_height, gint *min_width, gint *nat_width) { if (i_am_in_height_for_width_mode) { GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, min_width, nat_width); } else { ... execute the real width-for-height request here based on the required width of the children collectively if the container were to be allocated the said height ... } } ]]></programlisting> Height for width requests are generally implemented in terms of a virtual allocation of widgets in the input orientation. Assuming an height-for-width request mode, a container would implement the <function>get_preferred_height_for_width()</function> virtual function by first calling gtk_widget_get_preferred_width() for each of its children. For each potential group of children that are lined up horizontally, the values returned by gtk_widget_get_preferred_width() should be collected in an array of #GtkRequestedSize structures. Any child spacing should be removed from the input @for_width and then the collective size should be allocated using the gtk_distribute_natural_allocation() convenience function. The container will then move on to request the preferred height for each child by using gtk_widget_get_preferred_height_for_width() and using the sizes stored in the #GtkRequestedSize array. To allocate a height-for-width container, it's again important to consider that a container must prioritize one dimension over the other. So if a container is a height-for-width container it must first allocate all widgets horizontally using a #GtkRequestedSize array and gtk_distribute_natural_allocation() and then add any extra space (if and where appropriate) for the widget to expand. After adding all the expand space, the container assumes it was allocated sufficient height to fit all of its content. At this time, the container must use the total horizontal sizes of each widget to request the height-for-width of each of its children and store the requests in a #GtkRequestedSize array for any widgets that stack vertically (for tabular containers this can be generalized into the heights and widths of rows and columns). The vertical space must then again be distributed using gtk_distribute_natural_allocation() while this time considering the allocated height of the widget minus any vertical spacing that the container adds. Then vertical expand space should be added where appropriate and available and the container should go on to actually allocating the child widgets. See <link linkend="geometry-management">GtkWidget's geometry management section</link> to learn more about implementing height-for-width geometry management for widgets. </para> </refsect2> <refsect2 id="child-properties"> <title>Child properties</title> <para> GtkContainer introduces <emphasis>child properties</emphasis>. These are object properties that are not specific to either the container or the contained widget, but rather to their relation. Typical examples of child properties are the position or pack-type of a widget which is contained in a #GtkBox. Use gtk_container_class_install_child_property() to install child properties for a container class and gtk_container_class_find_child_property() or gtk_container_class_list_child_properties() to get information about existing child properties. To set the value of a child property, use gtk_container_child_set_property(), gtk_container_child_set() or gtk_container_child_set_valist(). To obtain the value of a child property, use gtk_container_child_get_property(), gtk_container_child_get() or gtk_container_child_get_valist(). To emit notification about child property changes, use gtk_widget_child_notify(). </para> </refsect2> <refsect2 id="GtkContainer-BUILDER-UI"> <title>GtkContainer as GtkBuildable</title> <para> The GtkContainer implementation of the GtkBuildable interface supports a &lt;packing&gt; element for children, which can contain multiple &lt;property&gt; elements that specify child properties for the child. <example> <title>Child properties in UI definitions</title> <programlisting><![CDATA[ <object class="GtkVBox"> <child> <object class="GtkLabel"/> <packing> <property name="pack-type">start</property> </packing> </child> </object> ]]></programlisting> </example> Since 2.16, child properties can also be marked as translatable using the same "translatable", "comments" and "context" attributes that are used for regular properties. </para> </refsect2>

Properties

Gtk.ResizeMode"resize-mode"read/write

int"border-width"read/write

Gtk.Widget"child"read/write

Signals

void"check-resize"(self, container)

void"add"(self, container, object)

void"remove"(self, container, object)

void"set-focus-child"(self, container, object)

Methods

voidadd(widget)

voidcheck_resize()

voidchild_get_property(child, property_name, value)

voidchild_set_property(child, property_name, value)

GTypechild_type()

stringcomposite_name(child)

voidforeach(callback, callback_data)

intget_border_width()

voidget_child_property(child, property_id, value, pspec)

GLib.Listget_children()

bool, GLib.Listget_focus_chain()

Gtk.Widgetget_focus_child()

Gtk.Adjustmentget_focus_hadjustment()

Gtk.Adjustmentget_focus_vadjustment()

Gtk.WidgetPathget_path_for_child(child)

Gtk.ResizeModeget_resize_mode()

voidpropagate_draw(child, cr)

voidremove(widget)

voidresize_children()

voidset_border_width(border_width)

voidset_child_property(child, property_id, value, pspec)

voidset_focus_chain(focusable_widgets)

voidset_focus_child(child)

voidset_focus_hadjustment(adjustment)

voidset_focus_vadjustment(adjustment)

voidset_reallocate_redraws(needs_redraws)

voidset_resize_mode(resize_mode)

voidunset_focus_chain()

Class: Gtk.CssProvider

Implements: Gtk.StyleProvider

Subclass of: GObject.Object

GtkCssProvider is an object implementing the #GtkStyleProvider interface. It is able to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like input in order to style widgets. <refsect2 id="gtkcssprovider-files"> <title>Default files</title> <para> An application can cause GTK+ to parse a specific CSS style sheet by calling gtk_css_provider_load_from_file() and adding the provider with gtk_style_context_add_provider() or gtk_style_context_add_provider_for_screen(). In addition, certain files will be read when GTK+ is initialized. First, the file <filename><envar>$XDG_CONFIG_HOME</envar>/gtk-3.0/gtk.css</filename> is loaded if it exists. Then, GTK+ tries to load <filename><envar>$HOME</envar>/.themes/<replaceable>theme-name</replaceable>/gtk-3.0/gtk.css</filename>, falling back to <filename><replaceable>datadir</replaceable>/share/themes/<replaceable>theme-name</replaceable>/gtk-3.0/gtk.css</filename>, where <replaceable>theme-name</replaceable> is the name of the current theme (see the #GtkSettings:gtk-theme-name setting) and <replaceable>datadir</replaceable> is the prefix configured when GTK+ was compiled, unless overridden by the <envar>GTK_DATA_PREFIX</envar> environment variable. </para> </refsect2> <refsect2 id="gtkcssprovider-stylesheets"> <title>Style sheets</title> <para> The basic structure of the style sheets understood by this provider is a series of statements, which are either rule sets or '@-rules', separated by whitespace. </para> <para> A rule set consists of a selector and a declaration block, which is a series of declarations enclosed in curly braces ({ and }). The declarations are separated by semicolons (;). Multiple selectors can share the same declaration block, by putting all the separators in front of the block, separated by commas. </para> <example><title>A rule set with two selectors</title> <programlisting language="text"> GtkButton, GtkEntry { } </programlisting> </example> </refsect2> <refsect2 id="gtkcssprovider-selectors"> <title>Selectors</title> <para> Selectors work very similar to the way they do in CSS, with widget class names taking the role of element names, and widget names taking the role of IDs. When used in a selector, widget names must be prefixed with a '&num;' character. The '*' character represents the so-called universal selector, which matches any widget. </para> <para> To express more complicated situations, selectors can be combined in various ways: <itemizedlist> <listitem><para>To require that a widget satisfies several conditions, combine several selectors into one by concatenating them. E.g. <literal>GtkButton&num;button1</literal> matches a GtkButton widget with the name button1.</para></listitem> <listitem><para>To only match a widget when it occurs inside some other widget, write the two selectors after each other, separated by whitespace. E.g. <literal>GtkToolBar GtkButton</literal> matches GtkButton widgets that occur inside a GtkToolBar.</para></listitem> <listitem><para>In the previous example, the GtkButton is matched even if it occurs deeply nested inside the toolbar. To restrict the match to direct children of the parent widget, insert a '>' character between the two selectors. E.g. <literal>GtkNotebook > GtkLabel</literal> matches GtkLabel widgets that are direct children of a GtkNotebook.</para></listitem> </itemizedlist> </para> <example> <title>Widget classes and names in selectors</title> <programlisting language="text"> /&ast; Theme labels that are descendants of a window &ast;/ GtkWindow GtkLabel { } /&ast; Theme notebooks, and anything that's within these &ast;/ GtkNotebook { } /&ast; Theme combo boxes, and entries that are direct children of a notebook &ast;/ GtkComboBox, GtkNotebook > GtkEntry { } /&ast; Theme any widget within a GtkBin &ast;/ GtkBin * { } /&ast; Theme a label named title-label &ast;/ GtkLabel&num;title-label { } /&ast; Theme any widget named main-entry &ast;/ &num;main-entry { } </programlisting> </example> <para> Widgets may also define style classes, which can be used for matching. When used in a selector, style classes must be prefixed with a '.' character. </para> <para> Refer to the documentation of individual widgets to learn which style classes they define and see <xref linkend="gtkstylecontext-classes"/> for a list of all style classes used by GTK+ widgets. </para> <para> Note that there is some ambiguity in the selector syntax when it comes to differentiation widget class names from regions. GTK+ currently treats a string as a widget class name if it contains any uppercase characters (which should work for more widgets with names like GtkLabel). </para> <example> <title>Style classes in selectors</title> <programlisting language="text"> /&ast; Theme all widgets defining the class entry &ast;/ .entry { } /&ast; Theme spinbuttons' entry &ast;/ GtkSpinButton.entry { } </programlisting> </example> <para> In complicated widgets like e.g. a GtkNotebook, it may be desirable to style different parts of the widget differently. To make this possible, container widgets may define regions, whose names may be used for matching in selectors. </para> <para> Some containers allow to further differentiate between regions by applying so-called pseudo-classes to the region. For example, the tab region in GtkNotebook allows to single out the first or last tab by using the :first-child or :last-child pseudo-class. When used in selectors, pseudo-classes must be prefixed with a ':' character. </para> <para> Refer to the documentation of individual widgets to learn which regions and pseudo-classes they define and see <xref linkend="gtkstylecontext-classes"/> for a list of all regions used by GTK+ widgets. </para> <example> <title>Regions in selectors</title> <programlisting language="text"> /&ast; Theme any label within a notebook &ast;/ GtkNotebook GtkLabel { } /&ast; Theme labels within notebook tabs &ast;/ GtkNotebook tab GtkLabel { } /&ast; Theme labels in the any first notebook tab, both selectors are equivalent &ast;/ GtkNotebook tab:nth-child(first) GtkLabel, GtkNotebook tab:first-child GtkLabel { } </programlisting> </example> <para> Another use of pseudo-classes is to match widgets depending on their state. This is conceptually similar to the :hover, :active or :focus pseudo-classes in CSS. The available pseudo-classes for widget states are :active, :prelight (or :hover), :insensitive, :selected, :focused and :inconsistent. </para> <example> <title>Styling specific widget states</title> <programlisting language="text"> /&ast; Theme active (pressed) buttons &ast;/ GtkButton:active { } /&ast; Theme buttons with the mouse pointer on it, both are equivalent &ast;/ GtkButton:hover, GtkButton:prelight { } /&ast; Theme insensitive widgets, both are equivalent &ast;/ :insensitive, *:insensitive { } /&ast; Theme selection colors in entries &ast;/ GtkEntry:selected { } /&ast; Theme focused labels &ast;/ GtkLabel:focused { } /&ast; Theme inconsistent checkbuttons &ast;/ GtkCheckButton:inconsistent { } </programlisting> </example> <para> Widget state pseudoclasses may only apply to the last element in a selector. </para> <para> To determine the effective style for a widget, all the matching rule sets are merged. As in CSS, rules apply by specificity, so the rules whose selectors more closely match a widget path will take precedence over the others. </para> </refsect2> <refsect2 id="gtkcssprovider-rules"> <title>&commat; Rules</title> <para> GTK+'s CSS supports the &commat;import rule, in order to load another CSS style sheet in addition to the currently parsed one. </para> <example> <title>Using the &commat;import rule</title> <programlisting language="text"> &commat;import url ("path/to/common.css"); </programlisting> </example> <para id="css-binding-set"> In order to extend key bindings affecting different widgets, GTK+ supports the &commat;binding-set rule to parse a set of bind/unbind directives, see #GtkBindingSet for the supported syntax. Note that the binding sets defined in this way must be associated with rule sets by setting the gtk-key-bindings style property. </para> <para> Customized key bindings are typically defined in a separate <filename>gtk-keys.css</filename> CSS file and GTK+ loads this file according to the current key theme, which is defined by the #GtkSettings:gtk-key-theme-name setting. </para> <example> <title>Using the &commat;binding rule</title> <programlisting language="text"> &commat;binding-set binding-set1 { bind "&lt;alt&gt;Left" { "move-cursor" (visual-positions, -3, 0) }; unbind "End"; }; &commat;binding-set binding-set2 { bind "&lt;alt&gt;Right" { "move-cursor" (visual-positions, 3, 0) }; bind "&lt;alt&gt;KP_space" { "delete-from-cursor" (whitespace, 1) "insert-at-cursor" (" ") }; }; GtkEntry { } </programlisting> </example> <para> GTK+ also supports an additional &commat;define-color rule, in order to define a color name which may be used instead of color numeric representations. Also see the #GtkSettings:gtk-color-scheme setting for a way to override the values of these named colors. </para> <example> <title>Defining colors</title> <programlisting language="text"> &commat;define-color bg_color &num;f9a039; &ast; { } </programlisting> </example> </refsect2> <refsect2 id="gtkcssprovider-symbolic-colors"> <title>Symbolic colors</title> <para> Besides being able to define color names, the CSS parser is also able to read different color expressions, which can also be nested, providing a rich language to define colors which are derived from a set of base colors. </para> <example> <title>Using symbolic colors</title> <programlisting language="text"> &commat;define-color entry-color shade (&commat;bg_color, 0.7); GtkEntry { } GtkEntry:focused { shade (&num;fff, 0.5), 0.8); } </programlisting> </example> <para> The various ways to express colors in GTK+ CSS are: </para> <informaltable> <tgroup cols="3"> <thead> <row> <entry>Syntax</entry> <entry>Explanation</entry> <entry>Examples</entry> </row> </thead> <tbody> <row> <entry>rgb(@r, @g, @b)</entry> <entry>An opaque color; @r, @g, @b can be either integers between 0 and 255 or percentages</entry> <entry><literallayout>rgb(128, 10, 54) rgb(20%, 30%, 0%)</literallayout></entry> </row> <row> <entry>rgba(@r, @g, @b, @a)</entry> <entry>A translucent color; @r, @g, @b are as in the previous row, <entry><literallayout>rgba(255, 255, 0, 0.5)</literallayout></entry> </row> <row> <entry>&num;@xxyyzz</entry> <entry>An opaque color; @xx, @yy, @zz are hexadecimal numbers specifying @r, @g, @b variants with between 1 and 4 hexadecimal digits per component are allowed</entry> <entry><literallayout>&num;ff12ab &num;f0c</literallayout></entry> </row> <row> <entry>&commat;name</entry> <entry>Reference to a color that has been defined with &commat;define-color </entry> <entry>&commat;bg_color</entry> </row> <row> <entry>mix(@color1, @color2, @f)</entry> <entry>A linear combination of @color1 and @color2. @f is a floating point number between 0 and 1.</entry> <entry><literallayout>mix(&num;ff1e0a, &commat;bg_color, 0.8)</literallayout></entry> </row> <row> <entry>shade(@color, @f)</entry> <entry>A lighter or darker variant of @color. @f is a floating point number. </entry> <entry>shade(&commat;fg_color, 0.5)</entry> </row> <row> <entry>lighter(@color)</entry> <entry>A lighter variant of @color</entry> </row> <row> <entry>darker(@color)</entry> <entry>A darker variant of @color</entry> </row> </tbody> </tgroup> </informaltable> </refsect2> <refsect2 id="gtkcssprovider-gradients"> <title>Gradients</title> <para> Linear or radial Gradients can be used as background images. </para> <para> A linear gradient along the line from (@start_x, @start_y) to (@end_x, @end_y) is specified using the syntax <literallayout>-gtk-gradient (linear, color-stop (@position, @color), ...)</literallayout> where @start_x and @end_x can be either a floating point number between 0 and 1 or one of the special values 'left', 'right' or 'center', @start_y and @end_y can be either a floating point number between 0 and 1 or one of the special values 'top', 'bottom' or 'center', @position is a floating point number between 0 and 1 and @color is a color expression (see above). The color-stop can be repeated multiple times to add more than one color stop. 'from (@color)' and 'to (@color)' can be used as abbreviations for color stops with position 0 and 1, respectively. </para> <example> <title>A linear gradient</title> <inlinegraphic fileref="gradient1.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (linear, left top, right bottom, from(&commat;yellow), to(&commat;blue))</literallayout></para> </example> <example> <title>Another linear gradient</title> <inlinegraphic fileref="gradient2.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (linear, 0 0, 0 1, color-stop(0, &commat;yellow), color-stop(0.2, &commat;blue), color-stop(1, &num;0f0))</literallayout></para> </example> <para> A radial gradient along the two circles defined by (@start_x, @start_y, syntax <literallayout>-gtk-gradient (radial, color-stop (@position, @color), ...)</literallayout> where @start_radius and @end_radius are floating point numbers and the other parameters are as before. </para> <example> <title>A radial gradient</title> <inlinegraphic fileref="gradient3.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (radial, center center, 0, center center, 1, from(&commat;yellow), to(&commat;green))</literallayout></para> </example> <example> <title>Another radial gradient</title> <inlinegraphic fileref="gradient4.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (radial, 0.4 0.4, 0.1, 0.6 0.6, 0.7, color-stop (0, &num;f00), color-stop (0.1, &num;a0f), color-stop (0.2, &commat;yellow), color-stop (1, &commat;green))</literallayout></para> </example> </refsect2> <refsect2 id="gtkcssprovider-slices"> <title>Border images</title> <para> Images can be used in 'slices' for the purpose of creating scalable borders. </para> <inlinegraphic fileref="slices.png" format="PNG"/> <para> The syntax for specifying border images of this kind is: <literallayout>url(@path) @top @right @bottom @left [repeat|stretch]? [repeat|stretch]?</literallayout> The sizes of the 'cut off' portions are specified with the @top, @right, @bottom and @left parameters. The 'middle' sections can be repeated or stretched to create the desired effect, by adding the 'repeat' or 'stretch' options after the dimensions. If two options are specified, the first one affects the horizontal behaviour and the second one the vertical behaviour. If only one option is specified, it affects both. </para> <example> <title>A border image</title> <inlinegraphic fileref="border1.png" format="PNG"/> <para>This border image was specified with <literallayout>url("gradient1.png") 10 10 10 10</literallayout> </para> </example> <example> <title>A repeating border image</title> <inlinegraphic fileref="border2.png" format="PNG"/> <para>This border image was specified with <literallayout>url("gradient1.png") 10 10 10 10 repeat</literallayout> </para> </example> <example> <title>A stretched border image</title> <inlinegraphic fileref="border3.png" format="PNG"/> <para>This border image was specified with <literallayout>url("gradient1.png") 10 10 10 10 stretch</literallayout> </para> </example> </refsect2> <refsect2 id="gtkcssprovider-transitions"> <para>Styles can specify transitions that will be used to create a gradual change in the appearance when a widget state changes. The following syntax is used to specify transitions: <literallayout>@duration [s|ms] [linear|ease|ease-in|ease-out|ease-in-out] [loop]?</literallayout> The @duration is the amount of time that the animation will take for a complete cycle from start to end. If the loop option is given, the animation will be repated until the state changes again. The option after the duration determines the transition function from a small set of predefined functions. <figure><title>Linear transition</title> <graphic fileref="linear.png" format="PNG"/> </figure> <figure><title>Ease transition</title> <graphic fileref="ease.png" format="PNG"/> </figure> <figure><title>Ease-in-out transition</title> <graphic fileref="ease-in-out.png" format="PNG"/> </figure> <figure><title>Ease-in transition</title> <graphic fileref="ease-in.png" format="PNG"/> </figure> <figure><title>Ease-out transition</title> <graphic fileref="ease-out.png" format="PNG"/> </figure> </para> </refsect2> <refsect2 id="gtkcssprovider-properties"> <title>Supported properties</title> <para> Properties are the part that differ the most to common CSS, not all properties are supported (some are planned to be supported eventually, some others are meaningless or don't map intuitively in a widget based environment). </para> <para> There is also a difference in shorthand properties, for example in common CSS it is fine to define a font through the different @font-family, @font-style, @font-size properties, meanwhile in GTK+'s CSS only the canonical </para> <para> The currently supported properties are: </para> <informaltable> <tgroup cols="4"> <thead> <row> <entry>Property name</entry> <entry>Syntax</entry> <entry>Maps to</entry> <entry>Examples</entry> </row> </thead> <tbody> <row> <entry>engine</entry> <entry>engine-name</entry> <entry>#GtkThemingEngine</entry> <entry>engine: clearlooks; </row> <row> <entry>background-color</entry> <entry morerows="2">color (see above)</entry> <entry morerows="2">#GdkRGBA</entry> <entry morerows="2"><literallayout>background-color: &num;fff; </entry> </row> <row> <entry>color</entry> </row> <row> <entry>border-color</entry> </row> <row> <entry>font</entry> <entry>@family [@style] [@size]</entry> <entry>#PangoFontDescription</entry> <entry>font: Sans 15;</entry> </row> <row> <entry>margin</entry> <entry morerows="1"><literallayout>@width </entry> <entry morerows="1">#GtkBorder</entry> <entry morerows="1"><literallayout>margin: 5; </entry> </row> <row> <entry>padding</entry> </row> <row> <entry>background-image</entry> <entry><literallayout>gradient (see above) or url(@path)</literallayout></entry> <entry>#cairo_pattern_t</entry> <entry><literallayout>-gtk-gradient (linear, left top, right top, from (&num;fff), to (&num;000)); -gtk-gradient (linear, 0.0 0.5, 0.5 1.0, from (&num;fff), color-stop (0.5, &num;f00), to (&num;000)); -gtk-gradient (radial, center center, 0.2, center center, 0.8, color-stop (0.0, &num;fff), color-stop (1.0, &num;000)); url ('background.png');</literallayout> </entry> </row> <row> <entry>border-width</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-width: 5;</entry> </row> <row> <entry>border-radius</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-radius: 5;</entry> </row> <row> <entry>border-style</entry> <entry>[none|solid|inset|outset]</entry> <entry>#GtkBorderStyle</entry> <entry>border-style: solid;</entry> </row> <row> <entry>border-image</entry> <entry><literallayout>border image (see above)</literallayout></entry> <entry>internal use only</entry> <entry><literallayout>border-image: url("/path/to/image.png") 3 4 3 4 stretch; </entry> </row> <row> <entry>transition</entry> <entry>transition (see above)</entry> <entry>internal use only</entry> <entry><literallayout>transition: 150ms ease-in-out; </entry> </row> <row> <entry>gtk-key-bindings</entry> <entry>binding set name list</entry> <entry>internal use only</entry> <entry><literallayout>gtk-bindings: binding1, binding2, ...;</literallayout> </entry> </row> </tbody> </tgroup> </informaltable> <para> GtkThemingEngines can register their own, engine-specific style properties with the function gtk_theming_engine_register_property(). These properties can be set in CSS like other properties, using a name of the form <literallayout>-<replaceable>namespace</replaceable>-<replaceable>name</replaceable></literallayout>, where <replaceable>namespace</replaceable> is typically the name of the theming engine, and <replaceable>name</replaceable> is the name of the property. Style properties that have been registered by widgets using gtk_widget_class_install_style_property() can also be set in this way, using the widget class name for <replaceable>namespace</replaceable>. </para> <example> <title>Using engine-specific style properties</title> <programlisting> * { -GtkPaned-handle-size: 6; -clearlooks-colorize-scrollbar: false; } </programlisting> </example> </refsect2>

Methods

Gtk.CssProviderget_default()(static method)

Gtk.CssProviderget_named(name, variant)(static method)

boolload_from_data(data, length)

boolload_from_file(file)

boolload_from_path(path)

Class: Gtk.Dialog

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.RecentChooserDialog, Gtk.ColorSelectionDialog, Gtk.AboutDialog, Gtk.FontSelectionDialog, Gtk.MessageDialog, Gtk.FileChooserDialog, Gtk.AppChooserDialog

Subclass of: Gtk.Window

Dialog boxes are a convenient way to prompt the user for a small amount of input, e.g. to display a message, ask a question, or anything else that does not require extensive effort on the user's part. GTK+ treats a dialog as a window split vertically. The top section is a #GtkVBox, and is where widgets such as a #GtkLabel or a #GtkEntry should be packed. The bottom area is known as the <structfield>action_area</structfield>. This is generally used for packing buttons into the dialog which may perform functions such as cancel, ok, or apply. #GtkDialog boxes are created with a call to gtk_dialog_new() or gtk_dialog_new_with_buttons(). gtk_dialog_new_with_buttons() is recommended; it allows you to set the dialog title, some convenient flags, and add simple buttons. If 'dialog' is a newly created dialog, the two primary areas of the window can be accessed through gtk_dialog_get_content_area() and gtk_dialog_get_action_area(), as can be seen from the example below. A 'modal' dialog (that is, one which freezes the rest of the application from user input), can be created by calling gtk_window_set_modal() on the dialog. Use the GTK_WINDOW() macro to cast the widget returned from gtk_dialog_new() into a #GtkWindow. When using gtk_dialog_new_with_buttons() you can also pass the #GTK_DIALOG_MODAL flag to make a dialog modal. If you add buttons to #GtkDialog using gtk_dialog_new_with_buttons(), gtk_dialog_add_button(), gtk_dialog_add_buttons(), or gtk_dialog_add_action_widget(), clicking the button will emit a signal called #GtkDialog::response with a response ID that you specified. GTK+ will never assign a meaning to positive response IDs; these are entirely user-defined. But for convenience, you can use the response IDs in the #GtkResponseType enumeration (these all have values less than zero). If a dialog receives a delete event, the #GtkDialog::response signal will be emitted with a response ID of #GTK_RESPONSE_DELETE_EVENT. If you want to block waiting for a dialog to return before returning control flow to your code, you can call gtk_dialog_run(). This function enters a recursive main loop and waits for the user to respond to the dialog, returning the response ID corresponding to the button the user clicked. For the simple dialog in the following example, in reality you'd probably use #GtkMessageDialog to save yourself some effort. But you'd need to create the dialog contents manually if you had more than a simple message in the dialog. <example> <title>Simple GtkDialog usage</title> <programlisting> /&ast; Function to open a dialog box displaying the message provided. &ast;/ void quick_message (gchar *message) { GtkWidget *dialog, *label, *content_area; /&ast; Create the widgets &ast;/ dialog = gtk_dialog_new_with_buttons ("Message", main_application_window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_NONE, NULL); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); label = gtk_label_new (message); /&ast; Ensure that the dialog box is destroyed when the user responds &ast;/ g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); /&ast; Add the label, and show everything we've added to the dialog &ast;/ gtk_container_add (GTK_CONTAINER (content_area), label); gtk_widget_show_all (dialog); } </programlisting> </example> <refsect2 id="GtkDialog-BUILDER-UI"><title>GtkDialog as GtkBuildable</title> <para> The GtkDialog implementation of the #GtkBuildable interface exposes the "action_area". </para> <para> GtkDialog supports a custom &lt;action-widgets&gt; element, which can contain multiple &lt;action-widget&gt; elements. The "response" attribute specifies a numeric response, and the content of the element is the id of widget (which should be a child of the dialogs @action_area). </para> <example> <title>A <structname>GtkDialog</structname> UI definition fragment.</title> <programlisting><![CDATA[ <object class="GtkDialog" id="dialog1"> <child internal-child="vbox">" <object class="GtkVBox" id="vbox"> <child internal-child="action_area"> <object class="GtkHButtonBox" id="button_box"> <child> <object class="GtkButton" id="button_cancel"/> </child> <child> <object class="GtkButton" id="button_ok"/> </child> </object> </child> </object> </child> <action-widgets> <action-widget response="3">button_ok</action-widget> <action-widget response="-5">button_cancel</action-widget> </action-widgets> </object> ]]></programlisting> </example> </refsect2>

Signals

void"close"(self, dialog)

The ::close signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user uses a keybinding to close the dialog. The default binding for this signal is the Escape key.

void"response"(self, dialog, response_id)

Emitted when an action widget is clicked, the dialog receives a delete event, or the application programmer calls gtk_dialog_response(). On a delete event, the response ID is #GTK_RESPONSE_DELETE_EVENT. Otherwise, it depends on which action widget was clicked.

Methods

voidadd_action_widget(child, response_id)

Gtk.Widgetadd_button(button_text, response_id)

voidclose()

Gtk.Widgetget_action_area()

Gtk.Widgetget_content_area()

intget_response_for_widget(widget)

Gtk.Widgetget_widget_for_response(response_id)

voidresponse(response_id)

intrun()

voidset_alternative_button_order_from_array(n_params, new_order)

voidset_default_response(response_id)

voidset_response_sensitive(response_id, setting)

Class: Gtk.DrawingArea

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Widget

The #GtkDrawingArea widget is used for creating custom user interface elements. It's essentially a blank widget; you can draw on it. After creating a drawing area, the application may want to connect to: <itemizedlist> <listitem> <para> Mouse and button press signals to respond to input from the user. (Use gtk_widget_add_events() to enable events you wish to receive.) </para> </listitem> <listitem> <para> The #GtkWidget::realize signal to take any necessary actions when the widget is instantiated on a particular display. (Create GDK resources in response to this signal.) </para> </listitem> <listitem> <para> The #GtkWidget::configure-event signal to take any necessary actions when the widget changes size. </para> </listitem> <listitem> <para> The #GtkWidget::draw signal to handle redrawing the contents of the widget. </para> </listitem> </itemizedlist> The following code portion demonstrates using a drawing area to display a circle in the normal widget foreground color. Note that GDK automatically clears the exposed area to the background color before sending the expose event, and that drawing is implicitly clipped to the exposed area. <example> <title>Simple GtkDrawingArea usage</title> <programlisting> gboolean draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data) { guint width, height; GdkRGBA color; width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); cairo_arc (cr, width / 2.0, height / 2.0, MIN (width, height) / 2.0, 0, 2 * G_PI); gtk_style_context_get_color (gtk_widget_get_style_context (widget), 0, &amp;color); gdk_cairo_set_source_rgba (cr, &amp;color); cairo_fill (cr); return FALSE; } [...] GtkWidget &ast;drawing_area = gtk_drawing_area_new (<!-- -->); gtk_widget_set_size_request (drawing_area, 100, 100); g_signal_connect (G_OBJECT (drawing_area), "draw", G_CALLBACK (draw_callback), NULL); </programlisting> </example> Draw signals are normally delivered when a drawing area first comes onscreen, or when it's covered by another window and then uncovered. You can also force an expose event by adding to the "damage region" of the drawing area's window; gtk_widget_queue_draw_area() and gdk_window_invalidate_rect() are equally good ways to do this. You'll then get a draw signal for the invalid region. The available routines for drawing are documented on the <link linkend="gdk3-Cairo-Interaction">GDK Drawing Primitives</link> page and the cairo documentation. To receive mouse events on a drawing area, you will need to enable them with gtk_widget_add_events(). To receive keyboard events, you will need to set the "can-focus" property on the drawing area, and you should probably draw some user-visible indication that the drawing area is focused. Use gtk_widget_has_focus() in your expose event handler to decide whether to draw the focus indicator. See gtk_render_focus() for one way to draw focus.

Interface: Gtk.Editable

Classes implementing Gtk.Editable: Gtk.Entry, Gtk.SpinButton

The #GtkEditable interface is an interface which should be implemented by text editing widgets, such as #GtkEntry and #GtkText. It contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget. As an example of the latter usage, by connecting the following handler to "insert_text", an application can convert all entry into a widget into uppercase. <example> <title>Forcing entry to uppercase.</title> <programlisting> #include &lt;ctype.h&gt; void insert_text_handler (GtkEditable &ast;editable, const gchar &ast;text, gint length, gint &ast;position, gpointer data) { int i; gchar &ast;result = g_utf8_strup (text, length); g_signal_handlers_block_by_func (editable, (gpointer) insert_text_handler, data); gtk_editable_insert_text (editable, result, length, position); g_signal_handlers_unblock_by_func (editable, (gpointer) insert_text_handler, data); g_signal_stop_emission_by_name (editable, "insert_text"); g_free (result); } </programlisting> </example>

Signals

none"delete-text"(self, editable, start_pos, end_pos)

This signal is emitted when text is deleted from the widget by the user. The default handler for this signal will normally be responsible for deleting the text, so by connecting to this signal and then stopping the signal with g_signal_stop_emission(), it is possible to modify the range of deleted text, or prevent it from being deleted entirely. The @start_pos and @end_pos parameters are interpreted as for gtk_editable_delete_text().

none"changed"(self, editable)

The ::changed signal is emitted at the end of a single user-visible operation on the contents of the #GtkEditable. E.g., a paste operation that replaces the contents of the selection will cause only one signal emission (even though it is implemented by first deleting the selection, then inserting the new content, and may cause multiple ::notify::text signals to be emitted).

none"insert-text"(self, editable, new_text, new_text_length, position)

This signal is emitted when text is inserted into the widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with g_signal_stop_emission(), it is possible to modify the inserted text, or prevent it from being inserted entirely.

Methods

voidchanged()

voidcopy_clipboard()

voidcut_clipboard()

voiddelete_selection()

voiddelete_text(start_pos, end_pos)

voiddo_delete_text(start_pos, end_pos)

voiddo_insert_text(new_text, new_text_length, position)

stringget_chars(start_pos, end_pos)

boolget_editable()

intget_position()

bool, int, intget_selection_bounds()

voidinsert_text(new_text, new_text_length, position)

voidpaste_clipboard()

voidselect_region(start_pos, end_pos)

voidset_editable(is_editable)

voidset_position(position)

voidset_selection_bounds(start_pos, end_pos)

Class: Gtk.Entry

Implements: Gtk.Buildable, Gtk.Editable, Gtk.CellEditable, Atk.ImplementorIface

Known subclasses: Gtk.SpinButton

Subclass of: Gtk.Widget

The #GtkEntry widget is a single line text entry widget. A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible. When using an entry for passwords and other sensitive information, it can be put into "password mode" using gtk_entry_set_visibility(). In this mode, entered text is displayed using a 'invisible' character. By default, GTK+ picks the best invisible character that is available in the current font, but it can be changed with gtk_entry_set_invisible_char(). Since 2.16, GTK+ displays a warning when Caps Lock or input methods might interfere with entering text in a password entry. The warning can be turned off with the #GtkEntry:caps-lock-warning property. Since 2.16, GtkEntry has the ability to display progress or activity information behind the text. To make an entry display such information, use gtk_entry_set_progress_fraction() or gtk_entry_set_progress_pulse_step(). Additionally, GtkEntry can show icons at either side of the entry. These icons can be activatable by clicking, can be set up as drag source and can have tooltips. To add an icon, use gtk_entry_set_icon_from_gicon() or one of the various other functions that set an icon from a stock id, an icon name or a pixbuf. To trigger an action when the user clicks an icon, connect to the #GtkEntry::icon-press signal. To allow DND operations from an icon, use gtk_entry_set_icon_drag_source(). To set a tooltip on an icon, use gtk_entry_set_icon_tooltip_text() or the corresponding function for markup. Note that functionality or information that is only available by clicking on an icon in an entry may not be accessible at all to users which are not able to use a mouse or other pointing device. It is therefore recommended that any such functionality should also be available by other means, e.g. via the context menu of the entry.

Properties

float"progress-pulse-step"read/write

The fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse().

int"invisible-char"read/write

The invisible character is used when masking entry contents (in \"password mode\")"). When it is not explicitly set with the #GtkEntry::invisible-char property, GTK+ determines the character to use from a list of possible candidates, depending on availability in the current font. This style property allows the theme to prepend a character to the list of candidates.

string"secondary-icon-stock"read/write

The stock id to use for the secondary icon for the entry.

bool"activates-default"read/write

string"text"read/write

bool"caps-lock-warning"read/write

Whether password entries will show a warning when Caps Lock is on. Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.

float"progress-fraction"read/write

The current fraction of the task that's been completed.

bool"overwrite-mode"read/write

If text is overwritten when typing in the #GtkEntry.

string"im-module"read/write

Which IM (input method) module should be used for this entry. See #GtkIMContext. Setting this to a non-%NULL value overrides the system-wide IM module setting. See the GtkSettings #GtkSettings:gtk-im-module property.

int"max-length"read/write

string"primary-icon-tooltip-text"read/write

The contents of the tooltip on the primary icon. Also see gtk_entry_set_icon_tooltip_text().

bool"has-frame"read/write

string"secondary-icon-tooltip-markup"read/write

The contents of the tooltip on the secondary icon, which is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>. Also see gtk_entry_set_icon_tooltip_markup().

string"secondary-icon-name"read/write

The icon name to use for the secondary icon for the entry.

bool"primary-icon-activatable"read/write

Whether the primary icon is activatable. GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release signals only on sensitive, activatable icons. Sensitive, but non-activatable icons can be used for purely informational purposes.

string"primary-icon-name"read/write

The icon name to use for the primary icon for the entry.

string"secondary-icon-tooltip-text"read/write

The contents of the tooltip on the secondary icon. Also see gtk_entry_set_icon_tooltip_text().

Gtk.Border"inner-border"read/write

Sets the text area's border between the text and the frame.

int"scroll-offset"read-only

string"primary-icon-stock"read/write

The stock id to use for the primary icon for the entry.

int"selection-bound"read-only

int"width-chars"read/write

bool"secondary-icon-activatable"read/write

Whether the secondary icon is activatable. GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release signals only on sensitive, activatable icons. Sensitive, but non-activatable icons can be used for purely informational purposes.

Gtk.EntryBuffer"buffer"construct-only

GdkPixbuf.Pixbuf"primary-icon-pixbuf"read/write

A pixbuf to use as the primary icon for the entry.

Gio.Icon"secondary-icon-gicon"read/write

The #GIcon to use for the secondary icon for the entry.

bool"editable"read/write

bool"visibility"read/write

bool"truncate-multiline"read/write

When %TRUE, pasted multi-line text is truncated to the first line.

Gtk.ImageType"primary-icon-storage-type"read-only

The representation which is used for the primary icon of the entry.

bool"secondary-icon-sensitive"read/write

Whether the secondary icon is sensitive. An insensitive icon appears grayed out. GTK+ does not emit the #GtkEntry::icon-press and #GtkEntry::icon-release signals and does not allow DND from insensitive icons. An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Gtk.ShadowType"shadow-type"read/write

Which kind of shadow to draw around the entry when #GtkEntry:has-frame is set to %TRUE.

GdkPixbuf.Pixbuf"secondary-icon-pixbuf"read/write

An pixbuf to use as the secondary icon for the entry.

Gio.Icon"primary-icon-gicon"read/write

The #GIcon to use for the primary icon for the entry.

float"xalign"read/write

The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.

bool"primary-icon-sensitive"read/write

Whether the primary icon is sensitive. An insensitive icon appears grayed out. GTK+ does not emit the #GtkEntry::icon-press and #GtkEntry::icon-release signals and does not allow DND from insensitive icons. An icon should be set insensitive if the action that would trigger when clicked is currently not available.

int"cursor-position"read-only

string"primary-icon-tooltip-markup"read/write

The contents of the tooltip on the primary icon, which is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>. Also see gtk_entry_set_icon_tooltip_markup().

int"text-length"read-only

The length of the text in the #GtkEntry.

bool"invisible-char-set"read/write

Whether the invisible char has been set for the #GtkEntry.

Gtk.ImageType"secondary-icon-storage-type"read-only

The representation which is used for the secondary icon of the entry.

Signals

void"activate"(self, entry)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user activates the entry. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control activation programmatically. The default bindings for this signal are all forms of the Enter key.

void"copy-clipboard"(self, entry)

The ::copy-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to copy the selection to the clipboard. The default bindings for this signal are Ctrl-c and Ctrl-Insert.

void"insert-at-cursor"(self, entry, string)

The ::insert-at-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates the insertion of a fixed string at the cursor. This signal has no default bindings.

void"cut-clipboard"(self, entry)

The ::cut-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to cut the selection to the clipboard. The default bindings for this signal are Ctrl-x and Shift-Delete.

void"delete-from-cursor"(self, entry, type, count)

The ::delete-from-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates a text deletion. If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters. The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for deleting a word.

void"icon-release"(self, entry, icon_pos, event)

The ::icon-release signal is emitted on the button release from a mouse click over an activatable icon.

void"populate-popup"(self, entry, menu)

The ::populate-popup signal gets emitted before showing the context menu of the entry. If you need to add items to the context menu, connect to this signal and append your menuitems to the @menu.

void"icon-press"(self, entry, icon_pos, event)

The ::icon-press signal is emitted when an activatable icon is clicked.

void"backspace"(self, entry)

The ::backspace signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user asks for it. The default bindings for this signal are Backspace and Shift-Backspace.

void"toggle-overwrite"(self, entry)

The ::toggle-overwrite signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to toggle the overwrite mode of the entry. The default bindings for this signal is Insert.

void"paste-clipboard"(self, entry)

The ::paste-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to paste the contents of the clipboard into the text view. The default bindings for this signal are Ctrl-v and Shift-Insert.

void"preedit-changed"(self, entry, preedit)

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.

void"move-cursor"(self, entry, step, count, extend_selection)

The ::move-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates a cursor movement. If the cursor is not visible in @entry, this signal causes the viewport to be moved instead. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically. The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here. <itemizedlist> <listitem>Arrow keys move by individual characters/lines</listitem> <listitem>Ctrl-arrow key combinations move by words/paragraphs</listitem> <listitem>Home/End keys move to the ends of the buffer</listitem> </itemizedlist>

Methods

voidactivate()

voidbackspace()

voidcopy_clipboard()

voidcut_clipboard()

voiddelete_from_cursor(type, count)

boolget_activates_default()

floatget_alignment()

Gtk.EntryBufferget_buffer()

Gtk.EntryCompletionget_completion()

intget_current_icon_drag_source()

Gtk.Adjustmentget_cursor_hadjustment()

boolget_has_frame()

boolget_icon_activatable(icon_pos)

void, Gdk.Rectangleget_icon_area(icon_pos)

intget_icon_at_pos(x, y)

Gio.Iconget_icon_gicon(icon_pos)

stringget_icon_name(icon_pos)

GdkPixbuf.Pixbufget_icon_pixbuf(icon_pos)

boolget_icon_sensitive(icon_pos)

stringget_icon_stock(icon_pos)

Gtk.ImageTypeget_icon_storage_type(icon_pos)

stringget_icon_tooltip_markup(icon_pos)

stringget_icon_tooltip_text(icon_pos)

Gtk.Borderget_inner_border()

Gtk.gunicharget_invisible_char()

Pango.Layoutget_layout()

void, int, intget_layout_offsets()

intget_max_length()

boolget_overwrite_mode()

floatget_progress_fraction()

floatget_progress_pulse_step()

stringget_text()

void, Gdk.Rectangleget_text_area()

voidget_text_area_size(x, y, width, height)

intget_text_length()

boolget_visibility()

intget_width_chars()

boolim_context_filter_keypress(event)

voidinsert_at_cursor(str)

intlayout_index_to_text_index(layout_index)

voidmove_cursor(step, count, extend_selection)

voidpaste_clipboard()

voidpopulate_popup(menu)

voidprogress_pulse()

voidreset_im_context()

voidset_activates_default(setting)

voidset_alignment(xalign)

voidset_buffer(buffer)

voidset_completion(completion)

voidset_cursor_hadjustment(adjustment)

voidset_has_frame(setting)

voidset_icon_activatable(icon_pos, activatable)

voidset_icon_drag_source(icon_pos, target_list, actions)

voidset_icon_from_gicon(icon_pos, icon)

voidset_icon_from_icon_name(icon_pos, icon_name)

voidset_icon_from_pixbuf(icon_pos, pixbuf)

voidset_icon_from_stock(icon_pos, stock_id)

voidset_icon_sensitive(icon_pos, sensitive)

voidset_icon_tooltip_markup(icon_pos, tooltip)

voidset_icon_tooltip_text(icon_pos, tooltip)

voidset_inner_border(border)

voidset_invisible_char(ch)

voidset_max_length(max)

voidset_overwrite_mode(overwrite)

voidset_progress_fraction(fraction)

voidset_progress_pulse_step(fraction)

voidset_text(text)

voidset_visibility(visible)

voidset_width_chars(n_chars)

inttext_index_to_layout_index(text_index)

voidtoggle_overwrite()

voidunset_invisible_char()

Class: Gtk.EntryBuffer

Subclass of: GObject.Object

The #GtkEntryBuffer class contains the actual text displayed in a #GtkEntry widget. A single #GtkEntryBuffer object can be shared by multiple #GtkEntry widgets which will then share the same text content, but not the cursor position, visibility attributes, icon etc. #GtkEntryBuffer may be derived from. Such a derived class might allow text to be stored in an alternate location, such as non-pageable memory, useful in the case of important passwords. Or a derived class could integrate with an application's concept of undo/redo.

Properties

int"max-length"read/write

The maximum length (in characters) of the text in the buffer.

int"length"read-only

The length (in characters) of the text in buffer.

string"text"read/write

The contents of the buffer.

Signals

void"deleted-text"(self, entry_buffer, position, n_chars)

This signal is emitted after text is deleted from the buffer.

void"inserted-text"(self, entry_buffer, position, chars, n_chars)

This signal is emitted after text is inserted into the buffer.

Methods

intdelete_text(position, n_chars)

voiddeleted_text(position, n_chars)

voidemit_deleted_text(position, n_chars)

voidemit_inserted_text(position, chars, n_chars)

Gtk.gsizeget_bytes()

intget_length()

intget_max_length()

stringget_text(n_bytes)

intinsert_text(position, chars, n_chars)

voidinserted_text(position, chars, n_chars)

voidset_max_length(max_length)

voidset_text(chars, n_chars)

Class: Gtk.EntryCompletion

Implements: Gtk.CellLayout, Gtk.Buildable

Subclass of: GObject.Object

#GtkEntryCompletion is an auxiliary object to be used in conjunction with #GtkEntry to provide the completion functionality. It implements the #GtkCellLayout interface, to allow the user to add extra cells to the #GtkTreeView with completion matches. "Completion functionality" means that when the user modifies the text in the entry, #GtkEntryCompletion checks which rows in the model match the current content of the entry, and displays a list of matches. By default, the matching is done by comparing the entry text case-insensitively against the text column of the model (see gtk_entry_completion_set_text_column()), but this can be overridden with a custom match function (see gtk_entry_completion_set_match_func()). When the user selects a completion, the content of the entry is updated. By default, the content of the entry is replaced by the text column of the model, but this can be overridden by connecting to the #GtkEntryCompletion::match-selected signal and updating the entry in the signal handler. Note that you should return %TRUE from the signal handler to suppress the default behaviour. To add completion functionality to an entry, use gtk_entry_set_completion(). In addition to regular completion matches, which will be inserted into the entry when they are selected, #GtkEntryCompletion also allows to display "actions" in the popup window. Their appearance is similar to menuitems, to differentiate them clearly from completion strings. When an action is selected, the #GtkEntryCompletion::action-activated signal is emitted. GtkEntryCompletion uses a #GtkTreeModelFilter model to represent the subset of the entire model that is currently matching. While the GtkEntryCompletion signals #GtkEntryCompletion::match-selected and #GtkEntryCompletion::cursor-on-match take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as #GtkCellLayoutDataFuncs or #GtkCellArea::apply-attributes) will generally take the filter model as argument. As long as you are only calling gtk_tree_model_get(), this will make no difference to you. If for some reason, you need the original model, use gtk_tree_model_filter_get_model(). Don't forget to use gtk_tree_model_filter_convert_iter_to_child_iter() to obtain a matching iter.

Properties

bool"popup-set-width"read/write

Determines whether the completions popup window will be resized to the width of the entry.

bool"inline-selection"read/write

Determines whether the possible completions on the popup will appear in the entry as you navigate through them.

bool"inline-completion"read/write

Determines whether the common prefix of the possible completions should be inserted automatically in the entry. Note that this requires text-column to be set, even if you are using a custom match function.

Gtk.CellArea"cell-area"construct-only

The #GtkCellArea used to layout cell renderers in the treeview column. If no area is specified when creating the entry completion with gtk_entry_completion_new_with_area() a horizontally oriented #GtkCellAreaBox will be used.

int"minimum-key-length"read/write

int"text-column"read/write

The column of the model containing the strings. Note that the strings must be UTF-8.

Gtk.TreeModel"model"read/write

bool"popup-single-match"read/write

Determines whether the completions popup window will shown for a single possible completion. You probably want to set this to %FALSE if you are using <link linkend="GtkEntryCompletion--inline-completion">inline completion</link>.

bool"popup-completion"read/write

Determines whether the possible completions should be shown in a popup window.

Signals

bool"insert-prefix"(self, entry_completion, prefix)

Gets emitted when the inline autocompletion is triggered. The default behaviour is to make the entry display the whole prefix and select the newly inserted part. Applications may connect to this signal in order to insert only a smaller part of the @prefix into the entry - e.g. the entry used in the #GtkFileChooser inserts only the part of the prefix up to the next '/'.

void"action-activated"(self, entry_completion, index)

Gets emitted when an action is activated.

bool"match-selected"(self, entry_completion, model, iter)

Gets emitted when a match from the list is selected. The default behaviour is to replace the contents of the entry with the contents of the text column in the row pointed to by @iter. Note that @model is the model that was passed to gtk_entry_completion_set_model().

bool"cursor-on-match"(self, entry_completion, model, iter)

Gets emitted when a match from the cursor is on a match of the list. The default behaviour is to replace the contents of the entry with the contents of the text column in the row pointed to by @iter. Note that @model is the model that was passed to gtk_entry_completion_set_model().

Methods

voidaction_activated(index_)

voidcomplete()

boolcursor_on_match(model, iter)

voiddelete_action(index_)

stringget_completion_prefix()

Gtk.Widgetget_entry()

boolget_inline_completion()

boolget_inline_selection()

intget_minimum_key_length()

Gtk.TreeModelget_model()

boolget_popup_completion()

boolget_popup_set_width()

boolget_popup_single_match()

intget_text_column()

voidinsert_action_markup(index_, markup)

voidinsert_action_text(index_, text)

boolinsert_prefix(prefix)

boolmatch_selected(model, iter)

voidset_inline_completion(inline_completion)

voidset_inline_selection(inline_selection)

voidset_match_func(func, func_data, func_notify)

voidset_minimum_key_length(length)

voidset_model(model)

voidset_popup_completion(popup_completion)

voidset_popup_set_width(popup_set_width)

voidset_popup_single_match(popup_single_match)

voidset_text_column(column)

Class: Gtk.EventBox

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Bin

The #GtkEventBox widget is a subclass of #GtkBin which also has its own window. It is useful since it allows you to catch events for widgets which do not have their own window.

Properties

bool"visible-window"read/write

bool"above-child"read/write

Methods

boolget_above_child()

boolget_visible_window()

voidset_above_child(above_child)

voidset_visible_window(visible_window)

Class: Gtk.Expander

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Bin

A #GtkExpander allows the user to hide or show its child by clicking on an expander triangle similar to the triangles used in a #GtkTreeView. Normally you use an expander as you would use any other descendant of #GtkBin; you create the child widget and use gtk_container_add() to add it to the expander. When the expander is toggled, it will take care of showing and hiding the child automatically. <refsect2 id="expander-special-usage"> <title>Special Usage</title> <para> There are situations in which you may prefer to show and hide the expanded widget yourself, such as when you want to actually create the widget at expansion time. In this case, create a #GtkExpander but do not add a child to it. The expander widget has an #GtkExpander:expanded property which can be used to monitor its expansion state. You should watch this property with a signal connection as follows: </para> <informalexample> <programlisting id="expander-callback-example"> expander = gtk_expander_new_with_mnemonic ("_More Options"); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_callback), NULL); ... static void expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data) { GtkExpander *expander; expander = GTK_EXPANDER (object); if (gtk_expander_get_expanded (expander)) { /&ast; Show or create widgets &ast;/ } else { /&ast; Hide or destroy widgets &ast;/ } } </programlisting> </informalexample> </refsect2> <refsect2 id="GtkExpander-BUILDER-UI"> <title>GtkExpander as GtkBuildable</title> <para> The GtkExpander implementation of the GtkBuildable interface supports placing a child in the label position by specifying "label" as the "type" attribute of a &lt;child&gt; element. A normal content child can be specified without specifying a &lt;child&gt; type attribute. </para> <example> <title>A UI definition fragment with GtkExpander</title> <programlisting><![CDATA[ <object class="GtkExpander"> <child type="label"> <object class="GtkLabel" id="expander-label"/> </child> <child> <object class="GtkEntry" id="expander-content"/> </child> </object> ]]></programlisting> </example> </refsect2>

Properties

bool"expanded"construct-only

int"spacing"read/write

string"label"construct-only

bool"use-underline"construct-only

bool"label-fill"construct-only

Gtk.Widget"label-widget"read/write

bool"use-markup"construct-only

Signals

void"activate"(self, expander)

Methods

voidactivate()

boolget_expanded()

stringget_label()

boolget_label_fill()

Gtk.Widgetget_label_widget()

intget_spacing()

boolget_use_markup()

boolget_use_underline()

voidset_expanded(expanded)

voidset_label(label)

voidset_label_fill(label_fill)

voidset_label_widget(label_widget)

voidset_spacing(spacing)

voidset_use_markup(use_markup)

voidset_use_underline(use_underline)

Interface: Gtk.FileChooser

Classes implementing Gtk.FileChooser: Gtk.FileChooserButton, Gtk.FileChooserWidget, Gtk.FileChooserDialog

#GtkFileChooser is an interface that can be implemented by file selection widgets. In GTK+, the main objects that implement this interface are #GtkFileChooserWidget, #GtkFileChooserDialog, and #GtkFileChooserButton. You do not need to write an object that implements the #GtkFileChooser interface unless you are trying to adapt an existing file selector to expose a standard programming interface. #GtkFileChooser allows for shortcuts to various places in the filesystem. In the default implementation these are displayed in the left pane. It may be a bit confusing at first that these shortcuts come from various sources and in various flavours, so lets explain the terminology here: <variablelist> <varlistentry> <term>Bookmarks</term> <listitem> are created by the user, by dragging folders from the right pane to the left pane, or by using the "Add". Bookmarks can be renamed and deleted by the user. </listitem> </varlistentry> <varlistentry> <term>Shortcuts</term> <listitem> can be provided by the application or by the underlying filesystem abstraction (e.g. both the gnome-vfs and the Windows filesystems provide "Desktop" shortcuts). Shortcuts cannot be modified by the user. </listitem> </varlistentry> <varlistentry> <term>Volumes</term> <listitem> are provided by the underlying filesystem abstraction. They are the "roots" of the filesystem. </listitem> </varlistentry> </variablelist> <refsect2 id="gtkfilechooser-encodings"> <title>File Names and Encodings</title> When the user is finished selecting files in a #GtkFileChooser, your program can get the selected names either as filenames or as URIs. For URIs, the normal escaping rules are applied if the URI contains non-ASCII characters. However, filenames are <emphasis>always</emphasis> returned in the character set specified by the <envar>G_FILENAME_ENCODING</envar> environment variable. Please see the Glib documentation for more details about this variable. <note> This means that while you can pass the result of gtk_file_chooser_get_filename() to <function>open(2)</function> or <function>fopen(3)</function>, you may not be able to directly set it as the text of a #GtkLabel widget unless you convert it first to UTF-8, which all GTK+ widgets expect. You should use g_filename_to_utf8() to convert filenames into strings that can be passed to GTK+ widgets. </note> </refsect2> <refsect2 id="gtkfilechooser-preview"> <title>Adding a Preview Widget</title> <para> You can add a custom preview widget to a file chooser and then get notification about when the preview needs to be updated. To install a preview widget, use gtk_file_chooser_set_preview_widget(). Then, connect to the #GtkFileChooser::update-preview signal to get notified when you need to update the contents of the preview. </para> <para> Your callback should use gtk_file_chooser_get_preview_filename() to see what needs previewing. Once you have generated the preview for the corresponding file, you must call gtk_file_chooser_set_preview_widget_active() with a boolean flag that indicates whether your callback could successfully generate a preview. </para> <example id="example-gtkfilechooser-preview"> <title>Sample Usage</title> <programlisting> { GtkImage *preview; ... preview = gtk_image_new (<!-- -->); gtk_file_chooser_set_preview_widget (my_file_chooser, preview); g_signal_connect (my_file_chooser, "update-preview", G_CALLBACK (update_preview_cb), preview); } static void update_preview_cb (GtkFileChooser *file_chooser, gpointer data) { GtkWidget *preview; char *filename; GdkPixbuf *pixbuf; gboolean have_preview; preview = GTK_WIDGET (data); filename = gtk_file_chooser_get_preview_filename (file_chooser); pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL); have_preview = (pixbuf != NULL); g_free (filename); gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf); if (pixbuf) g_object_unref (pixbuf); gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview); } </programlisting> </example> </refsect2> <refsect2 id="gtkfilechooser-extra"> <title>Adding Extra Widgets</title> <para> You can add extra widgets to a file chooser to provide options that are not present in the default design. For example, you can add a toggle button to give the user the option to open a file in read-only mode. You can use gtk_file_chooser_set_extra_widget() to insert additional widgets in a file chooser. </para> <example id="example-gtkfilechooser-extra"> <title>Sample Usage</title> <programlisting> GtkWidget *toggle; ... toggle = gtk_check_button_new_with_label ("Open file read-only"); gtk_widget_show (toggle); gtk_file_chooser_set_extra_widget (my_file_chooser, toggle); } </programlisting> </example> <note> If you want to set more than one extra widget in the file chooser, you can a container such as a #GtkVBox or a #GtkTable and include your widgets in it. Then, set the container as the whole extra widget. </note> </refsect2> <refsect2 id="gtkfilechooser-key-bindings"> <title>Key Bindings</title> <para> Internally, GTK+ implements a file chooser's graphical user interface with the private <classname>GtkFileChooserDefaultClass</classname>. This widget has several <link linkend="gtk-Bindings">key bindings</link> and their associated signals. This section describes the available key binding signals. </para> <example id="gtkfilechooser-key-binding-example"> <title>GtkFileChooser key binding example</title> <para> The default keys that activate the key-binding signals in <classname>GtkFileChooserDefaultClass</classname> are as follows: </para> <informaltable> <tgroup cols="2"> <tbody> <row> <entry>Signal name</entry> <entry>Default key combinations</entry> </row> <row> <entry>location-popup</entry> <entry> <keycombo><keycap>Control</keycap><keycap>L</keycap></keycombo> (empty path); <keycap>/</keycap> (path of "/") <footnote> Both the individual <keycap>/</keycap> key and the numeric keypad's "divide" key are supported. </footnote>; <keycap>~</keycap> (path of "~") </entry> </row> <row> <entry>up-folder</entry> <entry> <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo>; <keycombo><keycap>Alt</keycap><keycap>Shift</keycap><keycap>Up</keycap></keycombo> <footnote> Both the individual Up key and the numeric keypad's Up key are supported. </footnote>; <keycap>Backspace</keycap> </entry> </row> <row> <entry>down-folder</entry> <entry> <keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo>; <keycombo><keycap>Alt</keycap><keycap>Shift</keycap><keycap>Down</keycap></keycombo> <footnote> Both the individual Down key and the numeric keypad's Down key are supported. </footnote> </entry> </row> <row> <entry>home-folder</entry> <entry><keycombo><keycap>Alt</keycap><keycap>Home</keycap></keycombo></entry> </row> <row> <entry>desktop-folder</entry> <entry><keycombo><keycap>Alt</keycap><keycap>D</keycap></keycombo></entry> </row> <row> <entry>quick-bookmark</entry> <entry><keycombo><keycap>Alt</keycap><keycap>1</keycap></keycombo> through <keycombo><keycap>Alt</keycap><keycap>0</keycap></keycombo></entry> </row> </tbody> </tgroup> </informaltable> <para> You can change these defaults to something else. For example, to add a <keycap>Shift</keycap> modifier to a few of the default bindings, you can include the following fragment in your <filename>.gtkrc-3.0</filename> file: </para> <programlisting> binding "my-own-gtkfilechooser-bindings" { bind "&lt;Alt&gt;&lt;Shift&gt;Up" { "up-folder" () } bind "&lt;Alt&gt;&lt;Shift&gt;Down" { "down-folder" () } bind "&lt;Alt&gt;&lt;Shift&gt;Home" { "home-folder" () } } class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings" </programlisting> </example> <refsect3 id="GtkFileChooserDefault-location-popup"> <title>The &quot;GtkFileChooserDefault::location-popup&quot; signal</title> <programlisting> void user_function (GtkFileChooserDefault *chooser, const char *path, <link linkend="gpointer">gpointer</link> user_data); </programlisting> <para> This is used to make the file chooser show a "Location" dialog which the user can use to manually type the name of the file he wishes to select. The <parameter>path</parameter> argument is a string that gets put in the text entry for the file name. By default this is bound to <keycombo><keycap>Control</keycap><keycap>L</keycap></keycombo> with a <parameter>path</parameter> string of "" (the empty string). It is also bound to <keycap>/</keycap> with a <parameter>path</parameter> string of "<literal>/</literal>" (a slash): this lets you type <keycap>/</keycap> and immediately type a path name. On Unix systems, this is bound to <keycap>~</keycap> (tilde) with a <parameter>path</parameter> string of "~" itself for access to home directories. </para> <variablelist role="params"> <varlistentry> <term><parameter>chooser</parameter>&nbsp;:</term> <listitem> <simpara> the object which received the signal. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>path</parameter>&nbsp;:</term> <listitem> <simpara> default contents for the text entry for the file name </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>user_data</parameter>&nbsp;:</term> <listitem> <simpara> user data set when the signal handler was connected. </simpara> </listitem> </varlistentry> </variablelist> <note> You can create your own bindings for the #GtkFileChooserDefault::location-popup signal with custom <parameter>path</parameter> strings, and have a crude form of easily-to-type bookmarks. For example, say you access the path <filename>/home/username/misc</filename> very frequently. You could then create an <keycombo> <keycap>Alt</keycap> <keycap>M</keycap> </keycombo> shortcut by including the following in your <filename>.gtkrc-3.0</filename>: <programlisting> binding "misc-shortcut" { bind "&lt;Alt&gt;M" { "location-popup" ("/home/username/misc") } } class "GtkFileChooserDefault" binding "misc-shortcut" </programlisting> </note> </refsect3> <refsect3 id="GtkFileChooserDefault-up-folder"> <title>The &quot;GtkFileChooserDefault::up-folder&quot; signal</title> <programlisting> void user_function (GtkFileChooserDefault *chooser, <link linkend="gpointer">gpointer</link> user_data); </programlisting> <para> This is used to make the file chooser go to the parent of the current folder in the file hierarchy. By default this is bound to <keycap>Backspace</keycap> and <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo> (the Up key in the numeric keypad also works). </para> <variablelist role="params"> <varlistentry> <term><parameter>chooser</parameter>&nbsp;:</term> <listitem> <simpara> the object which received the signal. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>user_data</parameter>&nbsp;:</term> <listitem> <simpara> user data set when the signal handler was connected. </simpara> </listitem> </varlistentry> </variablelist> </refsect3> <refsect3 id="GtkFileChooserDefault-down-folder"> <title>The &quot;GtkFileChooserDefault::down-folder&quot; signal</title> <programlisting> void user_function (GtkFileChooserDefault *chooser, <link linkend="gpointer">gpointer</link> user_data); </programlisting> <para> This is used to make the file chooser go to a child of the current folder in the file hierarchy. The subfolder that will be used is displayed in the path bar widget of the file chooser. For example, if the path bar is showing "/foo/<emphasis>bar/</emphasis>baz", then this will cause the file chooser to switch to the "baz" subfolder. By default this is bound to <keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo> (the Down key in the numeric keypad also works). </para> <variablelist role="params"> <varlistentry> <term><parameter>chooser</parameter>&nbsp;:</term> <listitem> <simpara> the object which received the signal. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>user_data</parameter>&nbsp;:</term> <listitem> <simpara> user data set when the signal handler was connected. </simpara> </listitem> </varlistentry> </variablelist> </refsect3> <refsect3 id="GtkFileChooserDefault-home-folder"> <title>The &quot;GtkFileChooserDefault::home-folder&quot; signal</title> <programlisting> void user_function (GtkFileChooserDefault *chooser, <link linkend="gpointer">gpointer</link> user_data); </programlisting> <para> This is used to make the file chooser show the user's home folder in the file list. By default this is bound to <keycombo><keycap>Alt</keycap><keycap>Home</keycap></keycombo> (the Home key in the numeric keypad also works). </para> <variablelist role="params"> <varlistentry> <term><parameter>chooser</parameter>&nbsp;:</term> <listitem> <simpara> the object which received the signal. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>user_data</parameter>&nbsp;:</term> <listitem> <simpara> user data set when the signal handler was connected. </simpara> </listitem> </varlistentry> </variablelist> </refsect3> <refsect3 id="GtkFileChooserDefault-desktop-folder"> <title>The &quot;GtkFileChooserDefault::desktop-folder&quot; signal</title> <programlisting> void user_function (GtkFileChooserDefault *chooser, <link linkend="gpointer">gpointer</link> user_data); </programlisting> <para> This is used to make the file chooser show the user's Desktop folder in the file list. By default this is bound to <keycombo><keycap>Alt</keycap><keycap>D</keycap></keycombo>. </para> <variablelist role="params"> <varlistentry> <term><parameter>chooser</parameter>&nbsp;:</term> <listitem> <simpara> the object which received the signal. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>user_data</parameter>&nbsp;:</term> <listitem> <simpara> user data set when the signal handler was connected. </simpara> </listitem> </varlistentry> </variablelist> </refsect3> <refsect3 id="GtkFileChooserDefault-quick-bookmark"> <title>The &quot;GtkFileChooserDefault::quick-bookmark&quot; signal</title> <programlisting> void user_function (GtkFileChooserDefault *chooser, gint bookmark_index, <link linkend="gpointer">gpointer</link> user_data); </programlisting> <para> This is used to make the file chooser switch to the bookmark specified in the <parameter>bookmark_index</parameter> parameter. For example, if you have three bookmarks, you can pass 0, 1, 2 to this signal to switch to each of them, respectively. By default this is bound to <keycombo><keycap>Alt</keycap><keycap>1</keycap></keycombo>, <keycombo><keycap>Alt</keycap><keycap>2</keycap></keycombo>, etc. until <keycombo><keycap>Alt</keycap><keycap>0</keycap></keycombo>. Note that in the default binding, that <keycombo><keycap>Alt</keycap><keycap>1</keycap></keycombo> is actually defined to switch to the bookmark at index 0, and so on successively; <keycombo><keycap>Alt</keycap><keycap>0</keycap></keycombo> is defined to switch to the bookmark at index 10. </para> <variablelist role="params"> <varlistentry> <term><parameter>chooser</parameter>&nbsp;:</term> <listitem> <simpara> the object which received the signal. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>bookmark_indes</parameter>&nbsp;:</term> <listitem> <simpara> index of the bookmark to switch to; the indices start at 0. </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>user_data</parameter>&nbsp;:</term> <listitem> <simpara> user data set when the signal handler was connected. </simpara> </listitem> </varlistentry> </variablelist> </refsect3> </refsect2>

Properties

gboolean"use-preview-label"read/write

gboolean"local-only"read/write

Gtk.Widget"preview-widget"read/write

gboolean"preview-widget-active"read/write

gboolean"do-overwrite-confirmation"read/write

Whether a file chooser in %GTK_FILE_CHOOSER_ACTION_SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists.

Gtk.Widget"extra-widget"read/write

Gtk.FileFilter"filter"read/write

gboolean"create-folders"read/write

Whether a file chooser not in %GTK_FILE_CHOOSER_ACTION_OPEN mode will offer the user to create new folders.

gboolean"select-multiple"read/write

Gtk.FileChooserAction"action"read/write

gboolean"show-hidden"read/write

Signals

none"update-preview"(self, file_chooser)

This signal is emitted when the preview in a file chooser should be regenerated. For example, this can happen when the currently selected file changes. You should use this signal if you want your file chooser to have a preview widget. Once you have installed a preview widget with gtk_file_chooser_set_preview_widget(), you should update it when this signal is emitted. You can use the functions gtk_file_chooser_get_preview_filename() or gtk_file_chooser_get_preview_uri() to get the name of the file to preview. Your widget may not be able to preview all kinds of files; your callback must call gtk_file_chooser_set_preview_widget_active() to inform the file chooser about whether the preview was generated successfully or not. Please see the example code in <xref linkend="gtkfilechooser-preview"/>. gtk_file_chooser_set_preview_widget_active(), gtk_file_chooser_set_use_preview_label(), gtk_file_chooser_get_preview_filename(), gtk_file_chooser_get_preview_uri().

none"selection-changed"(self, file_chooser)

This signal is emitted when there is a change in the set of selected files in a #GtkFileChooser. This can happen when the user modifies the selection with the mouse or the keyboard, or when explicitly calling functions to change the selection. Normally you do not need to connect to this signal, as it is easier to wait for the file chooser to finish running, and then to get the list of selected files using the functions mentioned below. gtk_file_chooser_unselect_filename(), gtk_file_chooser_get_filename(), gtk_file_chooser_get_filenames(), gtk_file_chooser_select_uri(), gtk_file_chooser_unselect_uri(), gtk_file_chooser_get_uri(), gtk_file_chooser_get_uris().

Gtk.FileChooserConfirmation"confirm-overwrite"(self, file_chooser)

This signal gets emitted whenever it is appropriate to present a confirmation dialog when the user has selected a file name that already exists. The signal only gets emitted when the file chooser is in %GTK_FILE_CHOOSER_ACTION_SAVE mode. Most applications just need to turn on the #GtkFileChooser:do-overwrite-confirmation property (or call the gtk_file_chooser_set_do_overwrite_confirmation() function), and they will automatically get a stock confirmation dialog. Applications which need to customize this behavior should do that, and also connect to the #GtkFileChooser::confirm-overwrite signal. A signal handler for this signal must return a #GtkFileChooserConfirmation value, which indicates the action to take. If the handler determines that the user wants to select a different filename, it should return %GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN. If it determines that the user is satisfied with his choice of file name, it should return %GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME. On the other hand, if it determines that the stock confirmation dialog should be used, it should return %GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example illustrates this. <example id="gtkfilechooser-confirmation"> <title>Custom confirmation</title> <programlisting> static GtkFileChooserConfirmation confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data) { char *uri; uri = gtk_file_chooser_get_uri (chooser); if (is_uri_read_only (uri)) { if (user_wants_to_replace_read_only_file (uri)) return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME; else return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN; } else return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM; // fall back to the default dialog } ... chooser = gtk_file_chooser_dialog_new (...); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); g_signal_connect (chooser, "confirm-overwrite", G_CALLBACK (confirm_overwrite_callback), NULL); if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT) save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); gtk_widget_destroy (chooser); </programlisting> </example> action to take after emitting the signal.

none"file-activated"(self, file_chooser)

This signal is emitted when the user "activates" a file in the file chooser. This can happen by double-clicking on a file in the file list, or by pressing <keycap>Enter</keycap>. Normally you do not need to connect to this signal. It is used internally by #GtkFileChooserDialog to know when to activate the default button in the dialog. gtk_file_chooser_get_filenames(), gtk_file_chooser_get_uri(), gtk_file_chooser_get_uris().

none"current-folder-changed"(self, file_chooser)

This signal is emitted when the current folder in a #GtkFileChooser changes. This can happen due to the user performing some action that changes folders, such as selecting a bookmark or visiting a folder on the file list. It can also happen as a result of calling a function to explicitly change the current folder in a file chooser. Normally you do not need to connect to this signal, unless you need to keep track of which folder a file chooser is showing. gtk_file_chooser_get_current_folder(), gtk_file_chooser_set_current_folder_uri(), gtk_file_chooser_get_current_folder_uri().

Methods

voidadd_filter(filter)

booladd_shortcut_folder(folder)

booladd_shortcut_folder_uri(uri)

Gtk.FileChooserActionget_action()

boolget_create_folders()

bytearrayget_current_folder()

Gio.Fileget_current_folder_file()

stringget_current_folder_uri()

boolget_do_overwrite_confirmation()

Gtk.Widgetget_extra_widget()

Gio.Fileget_file()

bytearrayget_filename()

GLib.SListget_filenames()

GLib.SListget_files()

Gtk.FileFilterget_filter()

boolget_local_only()

Gio.Fileget_preview_file()

bytearrayget_preview_filename()

stringget_preview_uri()

Gtk.Widgetget_preview_widget()

boolget_preview_widget_active()

boolget_select_multiple()

boolget_show_hidden()

stringget_uri()

GLib.SListget_uris()

boolget_use_preview_label()

GLib.SListlist_filters()

GLib.SListlist_shortcut_folder_uris()

GLib.SListlist_shortcut_folders()

voidremove_filter(filter)

boolremove_shortcut_folder(folder)

boolremove_shortcut_folder_uri(uri)

voidselect_all()

boolselect_file(file)

boolselect_filename(filename)

boolselect_uri(uri)

voidset_action(action)

voidset_create_folders(create_folders)

boolset_current_folder(filename)

boolset_current_folder_file(file)

boolset_current_folder_uri(uri)

voidset_current_name(name)

voidset_do_overwrite_confirmation(do_overwrite_confirmation)

voidset_extra_widget(extra_widget)

boolset_file(file)

boolset_filename(filename)

voidset_filter(filter)

voidset_local_only(local_only)

voidset_preview_widget(preview_widget)

voidset_preview_widget_active(active)

voidset_select_multiple(select_multiple)

voidset_show_hidden(show_hidden)

boolset_uri(uri)

voidset_use_preview_label(use_label)

voidunselect_all()

voidunselect_file(file)

voidunselect_filename(filename)

voidunselect_uri(uri)

Class: Gtk.FileChooserButton

Implements: Gtk.Orientable, Gtk.Buildable, Gtk.FileChooser, Atk.ImplementorIface

Subclass of: Gtk.HBox

Properties

int"width-chars"read/write

The width of the entry and label inside the button, in characters.

bool"focus-on-click"read/write

Whether the #GtkFileChooserButton button grabs focus when it is clicked with the mouse.

Gtk.FileChooser"dialog"construct-only

Instance of the #GtkFileChooserDialog associated with the button.

string"title"read/write

Title to put on the #GtkFileChooserDialog associated with the button.

Signals

void"file-set"(self, file_chooser_button)

The ::file-set signal is emitted when the user selects a file. Note that this signal is only emitted when the <emphasis>user</emphasis> changes the file.

Methods

voidfile_set()

boolget_focus_on_click()

stringget_title()

intget_width_chars()

voidset_focus_on_click(focus_on_click)

voidset_title(title)

voidset_width_chars(n_chars)

Class: Gtk.FileChooserDialog

Implements: Gtk.Buildable, Gtk.FileChooser, Atk.ImplementorIface

Subclass of: Gtk.Dialog

Class: Gtk.FileChooserWidget

Implements: Gtk.Orientable, Gtk.Buildable, Gtk.FileChooser, Atk.ImplementorIface

Subclass of: Gtk.VBox

Class: Gtk.FileFilter

Implements: Gtk.Buildable

Subclass of: GObject.InitiallyUnowned

A GtkFileFilter can be used to restrict the files being shown in a #GtkFileChooser. Files can be filtered based on their name (with gtk_file_filter_add_pattern()), on their mime type (with gtk_file_filter_add_mime_type()), or by a custom filter function (with gtk_file_filter_add_custom()). Filtering by mime types handles aliasing and subclassing of mime types; e.g. a filter for text/plain also matches a file with mime type application/rtf, since application/rtf is a subclass of text/plain. Note that #GtkFileFilter allows wildcards for the subtype of a mime type, so you can e.g. filter for image/&ast;. Normally, filters are used by adding them to a #GtkFileChooser, see gtk_file_chooser_add_filter(), but it is also possible to manually use a filter on a file with gtk_file_filter_filter(). <refsect2 id="GtkFileFilter-BUILDER-UI"> <title>GtkFileFilter as GtkBuildable</title> <para> The GtkFileFilter implementation of the GtkBuildable interface supports adding rules using the &lt;mime-types&gt, &lt;patterns&gt and &lt;applications&gt elements and listing the rules within. Specifying a &lt;mime-type&gt or &lt;pattern&gt is the same as calling gtk_recent_filter_add_mime_type() or gtk_recent_filter_add_pattern() <example> <title>A UI definition fragment specifying GtkFileFilter rules</title> <programlisting><![CDATA[ <object class="GtkFileFilter"> <mime-types> <mime-type>text/plain</mime-type> <mime-type>image/&ast;</mime-type> </mime-types> <patterns> <pattern>*.txt</pattern> <pattern>*.png</pattern> </patterns> </object> ]]></programlisting> </example> </para> </refsect2>

Methods

voidadd_custom(needed, func, data, notify)

voidadd_mime_type(mime_type)

voidadd_pattern(pattern)

voidadd_pixbuf_formats()

boolfilter(filter_info)

stringget_name()

Gtk.FileFilterFlagsget_needed()

voidset_name(name)

Class: Gtk.Fixed

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

The #GtkFixed widget is a container which can place child widgets at fixed positions and with fixed sizes, given in pixels. #GtkFixed performs no automatic layout management. For most applications, you should not use this container! It keeps you from having to learn about the other GTK+ containers, but it results in broken applications. With #GtkFixed, the following things will result in truncated text, overlapping widgets, and other display bugs: <itemizedlist> <listitem><para> Themes, which may change widget sizes. </para></listitem> <listitem><para> Fonts other than the one you used to write the app will of course change the size of widgets containing text; keep in mind that users may use a larger font because of difficulty reading the default, or they may be using Windows or the framebuffer port of GTK+, where different fonts are available. </para></listitem> <listitem><para> Translation of text into other languages changes its size. Also, display of non-English text will use a different font in many cases. </para></listitem> </itemizedlist> In addition, the fixed widget can't properly be mirrored in right-to-left languages such as Hebrew and Arabic. i.e. normally GTK+ will flip the interface to put labels to the right of the thing they label, but it can't do that with #GtkFixed. So your application will not be usable in right-to-left languages. Finally, fixed positioning makes it kind of annoying to add/remove GUI elements, since you have to reposition all the other elements. This is a long-term maintenance problem for your application. If you know none of these things are an issue for your application, and prefer the simplicity of #GtkFixed, by all means use the widget. But you should be aware of the tradeoffs.

Methods

voidmove(widget, x, y)

voidput(widget, x, y)

Class: Gtk.FontButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Button

Properties

bool"use-font"read/write

If this property is set to %TRUE, the label will be drawn in the selected font.

string"title"read/write

The title of the font selection dialog.

bool"show-style"read/write

If this property is set to %TRUE, the name of the selected font style will be shown in the label. For a more WYSIWYG way to show the selected style, see the ::use-font property.

string"font-name"read/write

The name of the currently selected font.

bool"use-size"read/write

If this property is set to %TRUE, the label will be drawn with the selected font size.

bool"show-size"read/write

If this property is set to %TRUE, the selected font size will be shown in the label. For a more WYSIWYG way to show the selected size, see the ::use-size property.

Signals

void"font-set"(self, font_button)

The ::font-set signal is emitted when the user selects a font. When handling this signal, use gtk_font_button_get_font_name() to find out which font was just selected. Note that this signal is only emitted when the <emphasis>user</emphasis> changes the font. If you need to react to programmatic font changes as well, use the notify::font-name signal.

Methods

voidfont_set()

stringget_font_name()

boolget_show_size()

boolget_show_style()

stringget_title()

boolget_use_font()

boolget_use_size()

boolset_font_name(fontname)

voidset_show_size(show_size)

voidset_show_style(show_style)

voidset_title(title)

voidset_use_font(use_font)

voidset_use_size(use_size)

Class: Gtk.FontSelection

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.VBox

Properties

string"font-name"read/write

string"preview-text"read/write

Methods

Pango.FontFaceget_face()

Gtk.Widgetget_face_list()

Pango.FontFamilyget_family()

Gtk.Widgetget_family_list()

stringget_font_name()

Gtk.Widgetget_preview_entry()

stringget_preview_text()

intget_size()

Gtk.Widgetget_size_entry()

Gtk.Widgetget_size_list()

boolset_font_name(fontname)

voidset_preview_text(text)

Class: Gtk.FontSelectionDialog

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Dialog

Methods

Gtk.Widgetget_cancel_button()

stringget_font_name()

Gtk.Widgetget_font_selection()

Gtk.Widgetget_ok_button()

stringget_preview_text()

boolset_font_name(fontname)

voidset_preview_text(text)

Class: Gtk.Frame

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.AspectFrame

Subclass of: Gtk.Bin

Properties

Gtk.ShadowType"shadow-type"read/write

Gtk.Widget"label-widget"read/write

float"label-xalign"read/write

float"label-yalign"read/write

string"label"read/write

Methods

voidcompute_child_allocation(allocation)

stringget_label()

void, float, floatget_label_align()

Gtk.Widgetget_label_widget()

Gtk.ShadowTypeget_shadow_type()

voidset_label(label)

voidset_label_align(xalign, yalign)

voidset_label_widget(label_widget)

voidset_shadow_type(type)

Class: Gtk.Grid

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Container

GtkGrid is a container which arranges its child widgets in rows and columns. It is a very similar to #GtkTable and #GtkBox, but it consistently uses #GtkWidget's #GtkWidget:margin and #GtkWidget:expand properties instead of custom child properties, and it fully supports <link linkend="geometry-management">height-for-width geometry management</link>. Children are added using gtk_grid_attach(). They can span multiple rows or columns. It is also possible to add a child next to an existing child, using gtk_grid_attach_next_to(). GtkGrid can be used like a #GtkBox by just using gtk_container_add(), which will place children next to each other in the direction determined by the #GtkOrientable:orientation property.

Properties

bool"column-homogeneous"read/write

int"row-spacing"read/write

int"column-spacing"read/write

bool"row-homogeneous"read/write

Methods

voidattach(child, left, top, width, height)

voidattach_next_to(child, sibling, side, width, height)

boolget_column_homogeneous()

intget_column_spacing()

boolget_row_homogeneous()

intget_row_spacing()

voidset_column_homogeneous(homogeneous)

voidset_column_spacing(spacing)

voidset_row_homogeneous(homogeneous)

voidset_row_spacing(spacing)

Class: Gtk.HBox

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.Statusbar, Gtk.FileChooserButton, Gtk.InfoBar

Subclass of: Gtk.Box

#GtkHBox is a container that organizes child widgets into a single row. Use the #GtkBox packing interface to determine the arrangement, spacing, width, and alignment of #GtkHBox children. All children are allocated the same height.

Class: Gtk.HButtonBox

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.ButtonBox

Class: Gtk.HPaned

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Paned

Class: Gtk.HSV

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Widget

Signals

void"move"(self, hsv, object)

void"changed"(self, hsv)

Methods

voidchanged()

void, float, float, floatget_color()

void, int, intget_metrics()

boolis_adjusting()

voidmove(type)

voidset_color(h, s, v)

voidset_metrics(size, ring_width)

void, float, float, floatto_rgb(h, s, v)(static method)

Class: Gtk.HScale

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Scale

Class: Gtk.HScrollbar

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Scrollbar

Class: Gtk.HSeparator

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Separator

Class: Gtk.HandleBox

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Bin

Properties

Gtk.PositionType"snap-edge"read/write

bool"snap-edge-set"read/write

Gtk.ShadowType"shadow-type"read/write

bool"child-detached"read-only

Gtk.PositionType"handle-position"read/write

Signals

void"child-detached"(self, handle_box, object)

void"child-attached"(self, handle_box, object)

Methods

voidchild_attached(child)

voidchild_detached(child)

boolget_child_detached()

Gtk.PositionTypeget_handle_position()

Gtk.ShadowTypeget_shadow_type()

Gtk.PositionTypeget_snap_edge()

voidset_handle_position(position)

voidset_shadow_type(type)

voidset_snap_edge(edge)

Abstract Class: Gtk.IMContext

Known subclasses: Gtk.IMContextSimple, Gtk.IMMulticontext

Subclass of: GObject.Object

#GtkIMContext defines the interface for GTK+ input methods. An input method is used by GTK+ text input widgets like #GtkEntry to map from key events to Unicode character strings. The user may change the current input method via a context menu, unless the #GtkSettings:gtk-show-input-method-menu GtkSettings property is set to FALSE. The default input method can be set programmatically via the #GtkSettings:gtk-im-module GtkSettings property. Alternatively, you may set the GTK_IM_MODULE environment variable as documented in #gtk-running. The #GtkEntry #GtkEntry:im-module and #GtkTextView #GtkTextView:im-module properties may also be used to set input methods for specific widget instances. For instance, a certain entry widget might be expected to contain certain characters which would be easier to input with a certain input method. An input method may consume multiple key events in sequence and finally output the composed result. This is called preediting, and an input method may provide feedback about this process by displaying the intermediate composition states as preedit text. For instance, the default GTK+ input method implements the input of arbitrary Unicode code points by holding down the Control and Shift keys and then typing "U" followed by the hexadecimal digits of the code point. When releasing the Control and Shift keys, preediting ends and the character is inserted as text. Ctrl+Shift+u20AC for example results in the € sign. Additional input methods can be made available for use by GTK+ widgets as loadable modules. An input method module is a small shared library which implements a subclass of #GtkIMContext or #GtkIMContextSimple and exports these four functions: <informalexample><programlisting> void im_module_init(#GTypeModule *module); </programlisting></informalexample> This function should register the #GType of the #GtkIMContext subclass which implements the input method by means of g_type_module_register_type(). Note that g_type_register_static() cannot be used as the type needs to be registered dynamically. <informalexample><programlisting> void im_module_exit(void); </programlisting></informalexample> Here goes any cleanup code your input method might require on module unload. <informalexample><programlisting> void im_module_list(const #GtkIMContextInfo ***contexts, int *n_contexts) { *contexts = info_list; *n_contexts = G_N_ELEMENTS (info_list); } </programlisting></informalexample> This function returns the list of input methods provided by the module. The example implementation above shows a common solution and simply returns a pointer to statically defined array of #GtkIMContextInfo items for each provided input method. <informalexample><programlisting> #GtkIMContext * im_module_create(const #gchar *context_id); </programlisting></informalexample> This function should return a pointer to a newly created instance of the #GtkIMContext subclass identified by @context_id. The context ID is the same as specified in the #GtkIMContextInfo array returned by im_module_list(). After a new loadable input method module has been installed on the system, the configuration file <filename>gtk.immodules</filename> needs to be regenerated by <link linkend="gtk-query-immodules-3.0">gtk-query-immodules-3.0</link>, in order for the new input method to become available to GTK+ applications.

Signals

bool"delete-surrounding"(self, imcontext, offset, n_chars)

The ::delete-surrounding signal is emitted when the input method needs to delete all or part of the context surrounding the cursor.

void"preedit-changed"(self, imcontext)

The ::preedit-changed signal is emitted whenever the preedit sequence currently being entered has changed. It is also emitted at the end of a preedit sequence, in which case gtk_im_context_get_preedit_string() returns the empty string.

bool"retrieve-surrounding"(self, imcontext)

The ::retrieve-surrounding signal is emitted when the input method requires the context surrounding the cursor. The callback should set the input method surrounding context by calling the gtk_im_context_set_surrounding() method.

void"preedit-end"(self, imcontext)

The ::preedit-end signal is emitted when a preediting sequence has been completed or canceled.

void"preedit-start"(self, imcontext)

The ::preedit-start signal is emitted when a new preediting sequence starts.

void"commit"(self, imcontext, str)

The ::commit signal is emitted when a complete input sequence has been entered by the user. This can be a single character immediately after a key press or the final result of preediting.

Methods

voidcommit(str)

booldelete_surrounding(offset, n_chars)

boolfilter_keypress(event)

voidfocus_in()

voidfocus_out()

void, string, Pango.AttrList, intget_preedit_string()

bool, stringget_surrounding(cursor_index)

voidpreedit_changed()

voidpreedit_end()

voidpreedit_start()

voidreset()

boolretrieve_surrounding()

voidset_client_window(window)

voidset_cursor_location(area)

voidset_surrounding(text, len, cursor_index)

voidset_use_preedit(use_preedit)

Class: Gtk.IMContextSimple

Subclass of: Gtk.IMContext

Methods

Class: Gtk.IMMulticontext

Subclass of: Gtk.IMContext

Methods

voidappend_menuitems(menushell)

stringget_context_id()

voidset_context_id(context_id)

Class: Gtk.IconFactory

Implements: Gtk.Buildable

Subclass of: GObject.Object

Methods

voidadd(stock_id, icon_set)

voidadd_default()

Gtk.IconSetlookup(stock_id)

Gtk.IconSetlookup_default(stock_id)(static method)

voidremove_default()

Class: Gtk.IconTheme

Subclass of: GObject.Object

Signals

void"changed"(self, icon_theme)

Emitted when the current icon theme is switched or GTK+ detects that a change has occurred in the contents of the current icon theme.

Methods

voidadd_builtin_icon(icon_name, size, pixbuf)(static method)

voidappend_search_path(path)

voidchanged()

Gtk.IconInfochoose_icon(icon_names, size, flags)

Gtk.IconThemeget_default()(static method)

stringget_example_icon_name()

Gtk.IconThemeget_for_screen(screen)(static method)

Arrayget_icon_sizes(icon_name)

void, Array, intget_search_path()

boolhas_icon(icon_name)

GLib.Listlist_contexts()

GLib.Listlist_icons(context)

GdkPixbuf.Pixbufload_icon(icon_name, size, flags)

Gtk.IconInfolookup_by_gicon(icon, size, flags)

Gtk.IconInfolookup_icon(icon_name, size, flags)

voidprepend_search_path(path)

boolrescan_if_needed()

voidset_custom_theme(theme_name)

voidset_screen(screen)

voidset_search_path(path, n_elements)

Class: Gtk.IconView

Implements: Gtk.CellLayout, Gtk.Scrollable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

#GtkIconView provides an alternative view on a #GtkTreeModel. It displays the model as a grid of icons with labels. Like #GtkTreeView, it allows to select one or multiple items (depending on the selection mode, see gtk_icon_view_set_selection_mode()). In addition to selection with the arrow keys, #GtkIconView supports rubberband selection, which is controlled by dragging the pointer. Note that if the tree model is backed by an actual tree store (as opposed to a flat list where the mapping to icons is obvious), #GtkIconView will only display the first level of the tree and ignore the tree's branches.

Properties

Gtk.SelectionMode"selection-mode"read/write

The ::selection-mode property specifies the selection mode of icon view. If the mode is #GTK_SELECTION_MULTIPLE, rubberband selection is enabled, for the other modes, only keyboard selection is possible.

int"column-spacing"read/write

The column-spacing property specifies the space which is inserted between the columns of the icon view.

bool"reorderable"read/write

The reorderable property specifies if the items can be reordered by DND.

int"markup-column"read/write

The ::markup-column property contains the number of the model column containing markup information to be displayed. The markup column must be of type #G_TYPE_STRING. If this property and the :text-column property are both set to column numbers, it overrides the text column. If both are set to -1, no texts are displayed.

Gtk.Orientation"item-orientation"read/write

The item-orientation property specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other.

int"pixbuf-column"read/write

The ::pixbuf-column property contains the number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type #GDK_TYPE_PIXBUF. Setting this property to -1 turns off the display of pixbufs.

int"row-spacing"read/write

The row-spacing property specifies the space which is inserted between the rows of the icon view.

int"item-width"read/write

The item-width property specifies the width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size.

int"item-padding"read/write

The item-padding property specifies the padding around each of the icon view's item.

Gtk.CellArea"cell-area"construct-only

The #GtkCellArea used to layout cell renderers for this view. If no area is specified when creating the icon view with gtk_icon_view_new_with_area() a #GtkCellAreaBox will be used.

int"spacing"read/write

The spacing property specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.

int"tooltip-column"read/write

int"text-column"read/write

The ::text-column property contains the number of the model column containing the texts which are displayed. The text column must be of type #G_TYPE_STRING. If this property and the :markup-column property are both set to -1, no texts are displayed.

Gtk.TreeModel"model"read/write

int"margin"read/write

The margin property specifies the space which is inserted at the edges of the icon view.

int"columns"read/write

The columns property contains the number of the columns in which the items should be displayed. If it is -1, the number of columns will be chosen automatically to fill the available area.

Signals

void"select-cursor-item"(self, icon_view)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user selects the item that is currently focused. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control selection programmatically. There is no default binding for this signal.

bool"activate-cursor-item"(self, icon_view)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user activates the currently focused item. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control activation programmatically. The default bindings for this signal are Space, Return and Enter.

void"unselect-all"(self, icon_view)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user unselects all items. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control selection programmatically. The default binding for this signal is Ctrl-Shift-a.

bool"move-cursor"(self, icon_view, step, count)

The ::move-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates a cursor movement. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically. The default bindings for this signal include <itemizedlist> <listitem>Arrow keys which move by individual steps</listitem> <listitem>Home/End keys which move to the first/last item</listitem> <listitem>PageUp/PageDown which move by "pages"</listitem> </itemizedlist> All of these will extend the selection when combined with the Shift modifier.

void"select-all"(self, icon_view)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user selects all items. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control selection programmatically. The default binding for this signal is Ctrl-a.

void"toggle-cursor-item"(self, icon_view)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user toggles whether the currently focused item is selected or not. The exact effect of this depend on the selection mode. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control selection programmatically. There is no default binding for this signal is Ctrl-Space.

void"selection-changed"(self, icon_view)

The ::selection-changed signal is emitted when the selection (i.e. the set of selected items) changes.

void"item-activated"(self, icon_view, path)

The ::item-activated signal is emitted when the method gtk_icon_view_item_activated() is called or the user double clicks an item. It is also emitted when a non-editable item pressed.

Methods

boolactivate_cursor_item()

void, int, intconvert_widget_to_bin_window_coords(wx, wy)

cairo.Surfacecreate_drag_icon(path)

voidenable_model_drag_dest(targets, n_targets, actions)

voidenable_model_drag_source(start_button_mask, targets, n_targets, actions)

intget_column_spacing()

intget_columns()

bool, Gtk.TreePath, Gtk.CellRendererget_cursor()

bool, Gtk.TreePath, Gtk.IconViewDropPositionget_dest_item_at_pos(drag_x, drag_y)

void, Gtk.TreePath, Gtk.IconViewDropPositionget_drag_dest_item()

bool, Gtk.TreePath, Gtk.CellRendererget_item_at_pos(x, y)

intget_item_column(path)

Gtk.Orientationget_item_orientation()

intget_item_padding()

intget_item_row(path)

intget_item_width()

intget_margin()

intget_markup_column()

Gtk.TreeModelget_model()

Gtk.TreePathget_path_at_pos(x, y)

intget_pixbuf_column()

boolget_reorderable()

intget_row_spacing()

GLib.Listget_selected_items()

Gtk.SelectionModeget_selection_mode()

intget_spacing()

intget_text_column()

intget_tooltip_column()

bool, Gtk.TreeModel, Gtk.TreePath, Gtk.TreeIterget_tooltip_context(x, y, keyboard_tip)

bool, Gtk.TreePath, Gtk.TreePathget_visible_range()

voiditem_activated(path)

boolmove_cursor(step, count)

boolpath_is_selected(path)

voidscroll_to_path(path, use_align, row_align, col_align)

voidselect_all()

voidselect_cursor_item()

voidselect_path(path)

voidselected_foreach(func, data)

voidselection_changed()

voidset_column_spacing(column_spacing)

voidset_columns(columns)

voidset_cursor(path, cell, start_editing)

voidset_drag_dest_item(path, pos)

voidset_item_orientation(orientation)

voidset_item_padding(item_padding)

voidset_item_width(item_width)

voidset_margin(margin)

voidset_markup_column(column)

voidset_model(model)

voidset_pixbuf_column(column)

voidset_reorderable(reorderable)

voidset_row_spacing(row_spacing)

voidset_selection_mode(mode)

voidset_spacing(spacing)

voidset_text_column(column)

voidset_tooltip_cell(tooltip, path, cell)

voidset_tooltip_column(column)

voidset_tooltip_item(tooltip, path)

voidtoggle_cursor_item()

voidunselect_all()

voidunselect_path(path)

voidunset_model_drag_dest()

voidunset_model_drag_source()

Class: Gtk.Image

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Misc

The #GtkImage widget displays an image. Various kinds of object can be displayed as an image; most typically, you would load a #GdkPixbuf ("pixel buffer") from a file, and then display that. There's a convenience function to do this, gtk_image_new_from_file(), used as follows: <informalexample><programlisting> GtkWidget *image; image = gtk_image_new_from_file ("myfile.png"); </programlisting></informalexample> If the file isn't loaded successfully, the image will contain a "broken image" icon similar to that used in many web browsers. If you want to handle errors in loading the file yourself, for example by displaying an error message, then load the image with gdk_pixbuf_new_from_file(), then create the #GtkImage with gtk_image_new_from_pixbuf(). The image file may contain an animation, if so the #GtkImage will display an animation (#GdkPixbufAnimation) instead of a static image. #GtkImage is a subclass of #GtkMisc, which implies that you can align it (center, left, right) and add padding to it, using #GtkMisc methods. #GtkImage is a "no window" widget (has no #GdkWindow of its own), so by default does not receive events. If you want to receive events on the image, such as button clicks, place the image inside a #GtkEventBox, then connect to the event signals on the event box. <example> <title>Handling button press events on a <structname>GtkImage</structname>.</title> <programlisting> static gboolean button_press_callback (GtkWidget *event_box, GdkEventButton *event, gpointer data) { g_print ("Event box clicked at coordinates &percnt;f,&percnt;f\n", event->x, event->y); /<!---->* Returning TRUE means we handled the event, so the signal * emission should be stopped (don't call any further * callbacks that may be connected). Return FALSE * to continue invoking callbacks. *<!---->/ return TRUE; } static GtkWidget* create_image (void) { GtkWidget *image; GtkWidget *event_box; image = gtk_image_new_from_file ("myfile.png"); event_box = gtk_event_box_new (<!-- -->); gtk_container_add (GTK_CONTAINER (event_box), image); g_signal_connect (G_OBJECT (event_box), "button_press_event", G_CALLBACK (button_press_callback), image); return image; } </programlisting> </example> When handling events on the event box, keep in mind that coordinates in the image may be different from event box coordinates due to the alignment and padding settings on the image (see #GtkMisc). The simplest way to solve this is to set the alignment to 0.0 (left/top), and set the padding to zero. Then the origin of the image will be the same as the origin of the event box. Sometimes an application will want to avoid depending on external data files, such as image files. GTK+ comes with a program to avoid this, called <application>gdk-pixbuf-csource</application>. This program allows you to convert an image into a C variable declaration, which can then be loaded into a #GdkPixbuf using gdk_pixbuf_new_from_inline().

Properties

int"icon-size"read/write

int"pixel-size"read/write

The "pixel-size" property can be used to specify a fixed size overriding the #GtkImage:icon-size property for images of type %GTK_IMAGE_ICON_NAME.

Gtk.IconSet"icon-set"read/write

GdkPixbuf.Pixbuf"pixbuf"read/write

Gtk.ImageType"storage-type"read-only

string"icon-name"read/write

The name of the icon in the icon theme. If the icon theme is changed, the image will be updated automatically.

bool"use-fallback"read/write

Whether the icon displayed in the GtkImage will use standard icon names fallback. The value of this property is only relevant for images of type %GTK_IMAGE_ICON_NAME and %GTK_IMAGE_GICON.

Gio.Icon"gicon"read/write

The GIcon displayed in the GtkImage. For themed icons, If the icon theme is changed, the image will be updated automatically.

string"file"read/write

GdkPixbuf.PixbufAnimation"pixbuf-animation"read/write

string"stock"read/write

Methods

voidclear()

GdkPixbuf.PixbufAnimationget_animation()

void, Gio.Icon, intget_gicon()

void, string, intget_icon_name()

void, Gtk.IconSet, intget_icon_set()

GdkPixbuf.Pixbufget_pixbuf()

intget_pixel_size()

void, string, intget_stock()

Gtk.ImageTypeget_storage_type()

voidset_from_animation(animation)

voidset_from_file(filename)

voidset_from_gicon(icon, size)

voidset_from_icon_name(icon_name, size)

voidset_from_icon_set(icon_set, size)

voidset_from_pixbuf(pixbuf)

voidset_from_stock(stock_id, size)

voidset_pixel_size(pixel_size)

Class: Gtk.ImageMenuItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.MenuItem

Properties

Gtk.AccelGroup"accel-group"read/write

The Accel Group to use for stock accelerator keys

bool"always-show-image"construct-only

If %TRUE, the menu item will ignore the #GtkSettings:gtk-menu-images setting and always show the image, if available. Use this property if the menuitem would be useless or hard to use without the image.

Gtk.Widget"image"read/write

bool"use-stock"construct-only

If %TRUE, the label set in the menuitem is used as a stock id to select the stock item for the item.

Methods

boolget_always_show_image()

Gtk.Widgetget_image()

boolget_use_stock()

voidset_accel_group(accel_group)

voidset_always_show_image(always_show)

voidset_image(image)

voidset_use_stock(use_stock)

Class: Gtk.InfoBar

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.HBox

#GtkInfoBar is a widget that can be used to show messages to the user without showing a dialog. It is often temporarily shown at the top or bottom of a document. In contrast to #GtkDialog, which has a horizontal action area at the bottom, #GtkInfoBar has a vertical action area at the side. The API of #GtkInfoBar is very similar to #GtkDialog, allowing you to add buttons to the action area with gtk_info_bar_add_button() or gtk_info_bar_new_with_buttons(). The sensitivity of action widgets can be controlled with gtk_info_bar_set_response_sensitive(). To add widgets to the main content area of a #GtkInfoBar, use gtk_info_bar_get_content_area() and add your widgets to the container. Similar to #GtkMessageDialog, the contents of a #GtkInfoBar can by classified as error message, warning, informational message, etc, by using gtk_info_bar_set_message_type(). GTK+ uses the message type to determine the background color of the message area. <example> <title>Simple GtkInfoBar usage.</title> <programlisting> /&ast; set up info bar &ast;/ info_bar = gtk_info_bar_new (); gtk_widget_set_no_show_all (info_bar, TRUE); message_label = gtk_label_new (""); gtk_widget_show (message_label); content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar)); gtk_container_add (GTK_CONTAINER (content_area), message_label); gtk_info_bar_add_button (GTK_INFO_BAR (info_bar), GTK_STOCK_OK, GTK_RESPONSE_OK); g_signal_connect (info_bar, "response", G_CALLBACK (gtk_widget_hide), NULL); gtk_table_attach (GTK_TABLE (table), info_bar, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0); /&ast; ... &ast;/ /&ast; show an error message &ast;/ gtk_label_set_text (GTK_LABEL (message_label), error_message); gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR); gtk_widget_show (info_bar); </programlisting> </example> <refsect2 id="GtkInfoBar-BUILDER-UI"> <title>GtkInfoBar as GtkBuildable</title> <para> The GtkInfoBar implementation of the GtkBuildable interface exposes the content area and action area as internal children with the names "content_area" and "action_area". </para> <para> GtkInfoBar supports a custom &lt;action-widgets&gt; element, which can contain multiple &lt;action-widget&gt; elements. The "response" attribute specifies a numeric response, and the content of the element is the id of widget (which should be a child of the dialogs @action_area). </para> </refsect2>

Properties

Gtk.MessageType"message-type"construct-only

The type of the message. The type is used to determine the colors to use in the info bar. The following symbolic color names can by used to customize these colors: "info_fg_color", "info_bg_color", "warning_fg_color", "warning_bg_color", "question_fg_color", "question_bg_color", "error_fg_color", "error_bg_color". "other_fg_color", "other_bg_color". If the type is #GTK_MESSAGE_OTHER, no info bar is painted but the colors are still set.

Signals

void"close"(self, info_bar)

The ::close signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user uses a keybinding to dismiss the info bar. The default binding for this signal is the Escape key.

void"response"(self, info_bar, response_id)

Emitted when an action widget is clicked or the application programmer calls gtk_dialog_response(). The @response_id depends on which action widget was clicked.

Methods

voidadd_action_widget(child, response_id)

Gtk.Widgetadd_button(button_text, response_id)

voidclose()

Gtk.Widgetget_action_area()

Gtk.Widgetget_content_area()

Gtk.MessageTypeget_message_type()

voidresponse(response_id)

voidset_default_response(response_id)

voidset_message_type(message_type)

voidset_response_sensitive(response_id, setting)

Class: Gtk.Invisible

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Widget

Properties

Gdk.Screen"screen"read/write

Methods

Gdk.Screenget_screen()

voidset_screen(screen)

Class: Gtk.Label

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.AccelLabel

Subclass of: Gtk.Misc

Properties

int"mnemonic-keyval"read-only

int"max-width-chars"read/write

The desired maximum width of the label, in characters. If this property is set to -1, the width will be calculated automatically. See the section on <link linkend="label-text-layout">text layout</link> for details of how #GtkLabel:width-chars and #GtkLabel:max-width-chars determine the width of ellipsized and wrapped labels.

int"width-chars"read/write

The desired width of the label, in characters. If this property is set to -1, the width will be calculated automatically. See the section on <link linkend="label-text-layout">text layout</link> for details of how #GtkLabel:width-chars and #GtkLabel:max-width-chars determine the width of ellipsized and wrapped labels.

Pango.EllipsizeMode"ellipsize"read/write

The preferred place to ellipsize the string, if the label does not have enough room to display the entire string, specified as a #PangoEllisizeMode. Note that setting this property to a value other than %PANGO_ELLIPSIZE_NONE has the side-effect that the label requests only enough space to display the ellipsis "...". In particular, this means that ellipsizing labels do not work well in notebook tabs, unless the tab's #GtkNotebook:tab-expand property is set to %TRUE. Other ways to set a label's width are gtk_widget_set_size_request() and gtk_label_set_width_chars().

bool"single-line-mode"read/write

Whether the label is in single line mode. In single line mode, the height of the label does not depend on the actual text, it is always set to ascent + descent of the font. This can be an advantage in situations where resizing the label because of text changes would be distracting, e.g. in a statusbar.

int"cursor-position"read-only

bool"use-underline"read/write

int"selection-bound"read-only

bool"wrap"read/write

string"label"read/write

bool"track-visited-links"read/write

Set this property to %TRUE to make the label track which links have been clicked. It will then apply the ::visited-link-color color, instead of ::link-color.

Gtk.Widget"mnemonic-widget"read/write

Pango.WrapMode"wrap-mode"read/write

If line wrapping is on (see the #GtkLabel:wrap property) this controls how the line wrapping is done. The default is %PANGO_WRAP_WORD, which means wrap on word boundaries.

string"pattern"read/write

bool"use-markup"read/write

Pango.AttrList"attributes"read/write

bool"selectable"read/write

float"angle"read/write

The angle that the baseline of the label makes with the horizontal, in degrees, measured counterclockwise. An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom. Ignored if the label is selectable, wrapped, or ellipsized.

Gtk.Justification"justify"read/write

Signals

void"activate-current-link"(self, label)

A <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user activates a link in the label. Applications may also emit the signal with g_signal_emit_by_name() if they need to control activation of URIs programmatically. The default bindings for this signal are all forms of the Enter key.

void"populate-popup"(self, label, menu)

The ::populate-popup signal gets emitted before showing the context menu of the label. Note that only selectable labels have context menus. If you need to add items to the context menu, connect to this signal and append your menuitems to the @menu.

void"copy-clipboard"(self, label)

The ::copy-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to copy the selection to the clipboard. The default binding for this signal is Ctrl-c.

void"move-cursor"(self, label, step, count, extend_selection)

The ::move-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates a cursor movement. If the cursor is not visible in @entry, this signal causes the viewport to be moved instead. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically. The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here. <itemizedlist> <listitem>Arrow keys move by individual characters/lines</listitem> <listitem>Ctrl-arrow key combinations move by words/paragraphs</listitem> <listitem>Home/End keys move to the ends of the buffer</listitem> </itemizedlist>

bool"activate-link"(self, label, uri)

The signal which gets emitted to activate a URI. Applications may connect to it to override the default behaviour, which is to call gtk_show_uri().

Methods

boolactivate_link(uri)

voidcopy_clipboard()

floatget_angle()

Pango.AttrListget_attributes()

stringget_current_uri()

Pango.EllipsizeModeget_ellipsize()

Gtk.Justificationget_justify()

stringget_label()

Pango.Layoutget_layout()

void, int, intget_layout_offsets()

boolget_line_wrap()

Pango.WrapModeget_line_wrap_mode()

intget_max_width_chars()

intget_mnemonic_keyval()

Gtk.Widgetget_mnemonic_widget()

boolget_selectable()

bool, int, intget_selection_bounds()

boolget_single_line_mode()

stringget_text()

boolget_track_visited_links()

boolget_use_markup()

boolget_use_underline()

intget_width_chars()

voidmove_cursor(step, count, extend_selection)

voidpopulate_popup(menu)

voidselect_region(start_offset, end_offset)

voidset_angle(angle)

voidset_attributes(attrs)

voidset_ellipsize(mode)

voidset_justify(jtype)

voidset_label(str)

voidset_line_wrap(wrap)

voidset_line_wrap_mode(wrap_mode)

voidset_markup(str)

voidset_markup_with_mnemonic(str)

voidset_max_width_chars(n_chars)

voidset_mnemonic_widget(widget)

voidset_pattern(pattern)

voidset_selectable(setting)

voidset_single_line_mode(single_line_mode)

voidset_text(str)

voidset_text_with_mnemonic(str)

voidset_track_visited_links(track_links)

voidset_use_markup(setting)

voidset_use_underline(setting)

voidset_width_chars(n_chars)

Class: Gtk.Layout

Implements: Gtk.Scrollable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

#GtkLayout is similar to #GtkDrawingArea in that it's a "blank slate" and doesn't do anything but paint a blank background by default. It's different in that it supports scrolling natively (you can add it to a #GtkScrolledWindow), and it can contain child widgets, since it's a #GtkContainer. However if you're just going to draw, a #GtkDrawingArea is a better choice since it has lower overhead. When handling expose events on a #GtkLayout, you must draw to GTK_LAYOUT (layout)->bin_window, rather than to GTK_WIDGET (layout)->window, as you would for a drawing area.

Properties

int"width"read/write

int"height"read/write

Methods

Gdk.Windowget_bin_window()

Gtk.Adjustmentget_hadjustment()

void, int, intget_size()

Gtk.Adjustmentget_vadjustment()

voidmove(child_widget, x, y)

voidput(child_widget, x, y)

voidset_hadjustment(adjustment)

voidset_size(width, height)

voidset_vadjustment(adjustment)

Class: Gtk.LinkButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Button

A GtkLinkButton is a #GtkButton with a hyperlink, similar to the one used by web browsers, which triggers an action when clicked. It is useful to show quick links to resources. A link button is created by calling either gtk_link_button_new() or gtk_link_button_new_with_label(). If using the former, the URI you pass to the constructor is used as a label for the widget. The URI bound to a GtkLinkButton can be set specifically using gtk_link_button_set_uri(), and retrieved using gtk_link_button_get_uri(). By default, GtkLinkButton calls gtk_show_uri() when the button is clicked. This behaviour can be overridden by connecting to the #GtkLinkButton::activate-link signal and returning %TRUE from the signal handler.

Properties

bool"visited"read/write

The 'visited' state of this button. A visited link is drawn in a different color.

string"uri"read/write

The URI bound to this button.

Signals

bool"activate-link"(self, link_button)

The ::activate-link signal is emitted each time the #GtkLinkButton has been clicked. The default handler will call gtk_show_uri() with the URI stored inside the #GtkLinkButton:uri property. To override the default behavior, you can connect to the ::activate-link signal and stop the propagation of the signal by returning %TRUE from your handler.

Methods

boolactivate_link()

stringget_uri()

boolget_visited()

voidset_uri(uri)

voidset_visited(visited)

Class: Gtk.ListStore

Implements: Gtk.TreeModel, Gtk.TreeSortable, Gtk.Buildable, Gtk.TreeDragSource, Gtk.TreeDragDest

Subclass of: GObject.Object

Methods

void, Gtk.TreeIterappend()

voidclear()

void, Gtk.TreeIterinsert(position)

void, Gtk.TreeIterinsert_after(sibling)

void, Gtk.TreeIterinsert_before(sibling)

void, Gtk.TreeIterinsert_with_valuesv(position, columns, values, n_values)

booliter_is_valid(iter)

voidmove_after(iter, position)

voidmove_before(iter, position)

Gtk.ListStorenewv(n_columns, types)(static method)

void, Gtk.TreeIterprepend()

boolremove(iter)

voidset_column_types(n_columns, types)

voidset_value(iter, column, value)

voidset_valuesv(iter, columns, values, n_values)

voidswap(a, b)

Class: Gtk.Menu

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.RecentChooserMenu

Subclass of: Gtk.MenuShell

A #GtkMenu is a #GtkMenuShell that implements a drop down menu consisting of a list of #GtkMenuItem objects which can be navigated and activated by the user to perform application functions. A #GtkMenu is most commonly dropped down by activating a #GtkMenuItem in a #GtkMenuBar or popped up by activating a #GtkMenuItem in another #GtkMenu. A #GtkMenu can also be popped up by activating a #GtkOptionMenu. Other composite widgets such as the #GtkNotebook can pop up a #GtkMenu as well. Applications can display a #GtkMenu as a popup menu by calling the gtk_menu_popup() function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed. <example> <title>Connecting the popup signal handler.</title> <programlisting> /<!---->* connect our handler which will popup the menu *<!---->/ g_signal_connect_swapped (window, "button_press_event", G_CALLBACK (my_popup_handler), menu); </programlisting> </example> <example> <title>Signal handler which displays a popup menu.</title> <programlisting> static gint my_popup_handler (GtkWidget *widget, GdkEvent *event) { GtkMenu *menu; GdkEventButton *event_button; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_MENU (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); /<!---->* The "widget" is the menu that was supplied when * g_signal_connect_swapped() was called. *<!---->/ menu = GTK_MENU (widget); if (event->type == GDK_BUTTON_PRESS) { event_button = (GdkEventButton *) event; if (event_button->button == 3) { gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event_button->button, event_button->time); return TRUE; } } return FALSE; } </programlisting> </example>

Properties

string"tearoff-title"read/write

int"monitor"read/write

The monitor the menu will be popped up on.

bool"reserve-toggle-size"read/write

A boolean that indicates whether the menu reserves space for toggles and icons, regardless of their actual presence. This property should only be changed from its default value for special-purposes such as tabular menus. Regular menus that are connected to a menu bar or context menus should reserve toggle space for consistency.

Gtk.Widget"attach-widget"read/write

The widget the menu is attached to. Setting this property attaches the menu without a #GtkMenuDetachFunc. If you need to use a detacher, use gtk_menu_attach_to_widget() directly.

string"accel-path"read/write

An accel path used to conveniently construct accel paths of child items.

bool"tearoff-state"read/write

A boolean that indicates whether the menu is torn-off.

int"active"read/write

The index of the currently selected menu item, or -1 if no menu item is selected.

Gtk.AccelGroup"accel-group"read/write

The accel group holding accelerators for the menu.

Signals

void"move-scroll"(self, menu, scroll_type)

Methods

voidattach(child, left_attach, right_attach, top_attach, bottom_attach)

voidattach_to_widget(attach_widget, detacher)

voiddetach()

Gtk.AccelGroupget_accel_group()

stringget_accel_path()

Gtk.Widgetget_active()

Gtk.Widgetget_attach_widget()

GLib.Listget_for_attach_widget(widget)(static method)

intget_monitor()

boolget_reserve_toggle_size()

boolget_tearoff_state()

stringget_title()

voidpopdown()

voidpopup_for_device(device, parent_menu_shell, parent_menu_item, func, data, destroy, button, activate_time)

voidreorder_child(child, position)

voidreposition()

voidset_accel_group(accel_group)

voidset_accel_path(accel_path)

voidset_active(index)

voidset_monitor(monitor_num)

voidset_reserve_toggle_size(reserve_toggle_size)

voidset_screen(screen)

voidset_tearoff_state(torn_off)

voidset_title(title)

Class: Gtk.MenuBar

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.MenuShell

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.

Properties

Gtk.PackDirection"child-pack-direction"read/write

The child pack direction of the menubar. It determines how the widgets contained in child menuitems are arranged.

Gtk.PackDirection"pack-direction"read/write

The pack direction of the menubar. It determines how menuitems are arranged in the menubar.

Methods

Gtk.PackDirectionget_child_pack_direction()

Gtk.PackDirectionget_pack_direction()

voidset_child_pack_direction(child_pack_dir)

voidset_pack_direction(pack_dir)

Class: Gtk.MenuItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.SeparatorMenuItem, Gtk.ImageMenuItem, Gtk.CheckMenuItem, Gtk.TearoffMenuItem

Subclass of: Gtk.Bin

Properties

Gtk.Menu"submenu"read/write

The submenu attached to the menu item, or %NULL if it has none.

string"accel-path"read/write

Sets the accelerator path of the menu item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage.

bool"use-underline"read/write

%TRUE if underlines in the text indicate mnemonics.

bool"right-justified"read/write

Sets whether the menu item appears justified at the right side of a menu bar.

string"label"read/write

The text for the child label.

Signals

void"deselect"(self, menu_item)

void"activate"(self, menu_item)

void"toggle-size-allocate"(self, menu_item, object)

void"activate-item"(self, menu_item)

void"toggle-size-request"(self, menu_item, object)

void"select"(self, menu_item)

Methods

voidactivate()

voidactivate_item()

voiddeselect()

stringget_accel_path()

stringget_label()

boolget_reserve_indicator()

boolget_right_justified()

Gtk.Widgetget_submenu()

boolget_use_underline()

voidselect()

voidset_accel_path(accel_path)

voidset_label(label)

voidset_reserve_indicator(reserve)

voidset_right_justified(right_justified)

voidset_submenu(submenu)

voidset_use_underline(setting)

voidtoggle_size_allocate(allocation)

voidtoggle_size_request(requisition)

Abstract Class: Gtk.MenuShell

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.MenuBar, Gtk.Menu

Subclass of: Gtk.Container

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.

Properties

bool"take-focus"read/write

A boolean that determines whether the menu and its submenus grab the keyboard focus. See gtk_menu_shell_set_take_focus() and gtk_menu_shell_get_take_focus().

Signals

void"move-current"(self, menu_shell, direction)

An keybinding signal which moves the current menu item in the direction specified by @direction.

void"deactivate"(self, menu_shell)

This signal is emitted when a menu shell is deactivated.

bool"move-selected"(self, menu_shell, distance)

The ::move-selected signal is emitted to move the selection to another item.

void"cycle-focus"(self, menu_shell, direction)

A keybinding signal which moves the focus in the given @direction.

void"cancel"(self, menu_shell)

An action signal which cancels the selection within the menu shell. Causes the #GtkMenuShell::selection-done signal to be emitted.

void"selection-done"(self, menu_shell)

This signal is emitted when a selection has been completed within a menu shell.

void"activate-current"(self, menu_shell, force_hide)

An action signal that activates the current menu item within the menu shell.

Methods

voidactivate_current(force_hide)

voidactivate_item(menu_item, force_deactivate)

voidappend(child)

voidcancel()

voiddeactivate()

voiddeselect()

Gtk.Widgetget_parent_shell()

intget_popup_delay()

Gtk.Widgetget_selected_item()

boolget_take_focus()

voidinsert(child, position)

voidmove_current(direction)

boolmove_selected(distance)

voidprepend(child)

voidselect_first(search_sensitive)

voidselect_item(menu_item)

voidselection_done()

voidset_take_focus(take_focus)

Class: Gtk.MenuToolButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.ToolButton

Properties

Gtk.Menu"menu"read/write

Signals

void"show-menu"(self, menu_tool_button)

The ::show-menu signal is emitted before the menu is shown. It can be used to populate the menu on demand, using gtk_menu_tool_button_get_menu(). Note that even if you populate the menu dynamically in this way, you must set an empty menu on the #GtkMenuToolButton beforehand, since the arrow is made insensitive if the menu is not set.

Methods

Gtk.Widgetget_menu()

voidset_arrow_tooltip_markup(markup)

voidset_arrow_tooltip_text(text)

voidset_menu(menu)

voidshow_menu()

Class: Gtk.MessageDialog

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Dialog

#GtkMessageDialog presents a dialog with an image representing the type of message (Error, Question, etc.) alongside some message text. It's simply a convenience widget; you could construct the equivalent of #GtkMessageDialog from #GtkDialog without too much effort, but #GtkMessageDialog saves typing. The easiest way to do a modal message dialog is to use gtk_dialog_run(), though you can also pass in the %GTK_DIALOG_MODAL flag, gtk_dialog_run() automatically makes the dialog modal and waits for the user to respond to it. gtk_dialog_run() returns when any dialog button is clicked. <example> <title>A modal dialog.</title> <programlisting> dialog = gtk_message_dialog_new (main_application_window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error loading file '&percnt;s': &percnt;s", filename, g_strerror (errno)); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); </programlisting> </example> You might do a non-modal #GtkMessageDialog as follows: <example> <title>A non-modal dialog.</title> <programlisting> dialog = gtk_message_dialog_new (main_application_window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error loading file '&percnt;s': &percnt;s", filename, g_strerror (errno)); /&ast; Destroy the dialog when the user responds to it (e.g. clicks a button) &ast;/ g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); </programlisting> </example> <refsect2 id="GtkMessageDialog-BUILDER-UI"> <title>GtkMessageDialog as GtkBuildable</title> <para> The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name "message_area". </para> </refsect2>

Properties

Gtk.Widget"message-area"read-only

The #GtkVBox that corresponds to the message area of this dialog. See gtk_message_dialog_get_message_area() for a detailed description of this area.

string"text"read/write

The primary text of the message dialog. If the dialog has a secondary text, this will appear as the title.

Gtk.Widget"image"read/write

The image for this dialog.

string"secondary-text"read/write

The secondary text of the message dialog.

Gtk.ButtonsType"buttons"construct-only

Gtk.MessageType"message-type"construct-only

The type of the message. The type is used to determine the image that is shown in the dialog, unless the image is explicitly set by the ::image property.

bool"use-markup"read/write

%TRUE if the primary text of the dialog includes Pango markup. See pango_parse_markup().

bool"secondary-use-markup"read/write

%TRUE if the secondary text of the dialog includes Pango markup. See pango_parse_markup().

Methods

Gtk.Widgetget_image()

Gtk.Widgetget_message_area()

voidset_image(image)

voidset_markup(str)

Abstract Class: Gtk.Misc

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.Label, Gtk.Arrow, Gtk.Image

Subclass of: Gtk.Widget

Properties

int"ypad"read/write

float"xalign"read/write

int"xpad"read/write

float"yalign"read/write

Methods

void, float, floatget_alignment()

void, int, intget_padding()

voidset_alignment(xalign, yalign)

voidset_padding(xpad, ypad)

Class: Gtk.MountOperation

Subclass of: Gio.MountOperation

This should not be accessed directly. Use the accessor functions below.

Properties

bool"is-showing"read-only

Gdk.Screen"screen"read/write

Gtk.Window"parent"read/write

Methods

Gtk.Windowget_parent()

Gdk.Screenget_screen()

boolis_showing()

voidset_parent(parent)

voidset_screen(screen)

Class: Gtk.Notebook

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

The #GtkNotebook widget is a #GtkContainer whose children are pages that can be switched between using tab labels along one edge. There are many configuration options for GtkNotebook. Among other things, you can choose on which edge the tabs appear (see gtk_notebook_set_tab_pos()), whether, if there are too many tabs to fit the notebook should be made bigger or scrolling arrows added (see gtk_notebook_set_scrollable()), and whether there will be a popup menu allowing the users to switch pages. (see gtk_notebook_popup_enable(), gtk_notebook_popup_disable()) <refsect2 id="GtkNotebook-BUILDER-UI"> <title>GtkNotebook as GtkBuildable</title> <para> The GtkNotebook implementation of the #GtkBuildable interface supports placing children into tabs by specifying "tab" as the "type" attribute of a &lt;child&gt; element. Note that the content of the tab must be created before the tab can be filled. A tab child can be specified without specifying a &lt;child&gt; type attribute. To add a child widget in the notebooks action area, specify "action-start" or "action-end" as the "type" attribute of the &lt;child&gt; element. </para> <example> <title>A UI definition fragment with GtkNotebook</title> <programlisting><![CDATA[ <object class="GtkNotebook"> <child> <object class="GtkLabel" id="notebook-content"> <property name="label">Content</property> </object> </child> <child type="tab"> <object class="GtkLabel" id="notebook-tab"> <property name="label">Tab</property> </object> </child> </object> ]]></programlisting> </example> </refsect2>

Properties

bool"scrollable"read/write

Gtk.PositionType"tab-pos"read/write

bool"show-tabs"read/write

bool"enable-popup"read/write

bool"show-border"read/write

string"group-name"read/write

Group name for tab drag and drop.

int"page"read/write

Signals

void"page-reordered"(self, notebook, child, page_num)

the ::page-reordered signal is emitted in the notebook right after a page has been reordered.

bool"change-current-page"(self, notebook, object)

bool"focus-tab"(self, notebook, object)

Gtk.Notebook"create-window"(self, notebook, page, x, y)

The ::create-window signal is emitted when a detachable tab is dropped on the root window. A handler for this signal can create a window containing a notebook where the tab will be attached. It is also responsible for moving/resizing the window and adding the necessary properties to the notebook (e.g. the #GtkNotebook:group ). added to, or %NULL.

void"page-removed"(self, notebook, child, page_num)

the ::page-removed signal is emitted in the notebook right after a page is removed from the notebook.

bool"reorder-tab"(self, notebook, object, p0)

void"switch-page"(self, notebook, page, page_num)

Emitted when the user or a function changes the current page.

void"move-focus-out"(self, notebook, object)

bool"select-page"(self, notebook, object)

void"page-added"(self, notebook, child, page_num)

the ::page-added signal is emitted in the notebook right after a page is added to the notebook.

Methods

intappend_page(child, tab_label)

intappend_page_menu(child, tab_label, menu_label)

boolchange_current_page(offset)

boolfocus_tab(type)

Gtk.Widgetget_action_widget(pack_type)

intget_current_page()

stringget_group_name()

Gtk.Widgetget_menu_label(child)

stringget_menu_label_text(child)

intget_n_pages()

Gtk.Widgetget_nth_page(page_num)

boolget_scrollable()

boolget_show_border()

boolget_show_tabs()

boolget_tab_detachable(child)

intget_tab_hborder()

Gtk.Widgetget_tab_label(child)

stringget_tab_label_text(child)

Gtk.PositionTypeget_tab_pos()

boolget_tab_reorderable(child)

intget_tab_vborder()

intinsert_page(child, tab_label, menu_label, position)

intinsert_page_menu(child, tab_label, menu_label, position)

voidmove_focus_out(direction)

voidnext_page()

voidpage_added(child, page_num)

intpage_num(child)

voidpage_removed(child, page_num)

voidpage_reordered(child, page_num)

voidpopup_disable()

voidpopup_enable()

intprepend_page(child, tab_label)

intprepend_page_menu(child, tab_label, menu_label)

voidprev_page()

voidremove_page(page_num)

voidreorder_child(child, position)

boolreorder_tab(direction, move_to_last)

boolselect_page(move_focus)

voidset_action_widget(widget, pack_type)

voidset_current_page(page_num)

voidset_group_name(group_name)

voidset_menu_label(child, menu_label)

voidset_menu_label_text(child, menu_text)

voidset_scrollable(scrollable)

voidset_show_border(show_border)

voidset_show_tabs(show_tabs)

voidset_tab_detachable(child, detachable)

voidset_tab_label(child, tab_label)

voidset_tab_label_text(child, tab_text)

voidset_tab_pos(pos)

voidset_tab_reorderable(child, reorderable)

voidswitch_page(page, page_num)

Class: Gtk.NumerableIcon

Implements: Gio.Icon

Subclass of: Gio.EmblemedIcon

GtkNumerableIcon is a subclass of #GEmblemedIcon that can show a number or short string as an emblem. The number can be overlayed on top of another emblem, if desired. It supports theming by taking font and color information from a provided #GtkStyleContext; see gtk_numerable_icon_set_style_context(). <example> <title>Typical numerable icons</title> <inlinegraphic fileref="numerableicon.png" format="PNG"/> <inlinegraphic fileref="numerableicon2.png" format="PNG"/> </example>

Properties

int"count"read/write

Gio.Icon"background-icon"read/write

Gtk.StyleContext"style-context"read/write

string"background-icon-name"read/write

string"label"read/write

Methods

Gio.Iconget_background_gicon()

stringget_background_icon_name()

intget_count()

stringget_label()

Gtk.StyleContextget_style_context()

Gio.Iconnew(base_icon)(static method)

Gio.Iconnew_with_style_context(base_icon, context)(static method)

voidset_background_gicon(icon)

voidset_background_icon_name(icon_name)

voidset_count(count)

voidset_label(label)

voidset_style_context(style)

Class: Gtk.OffscreenWindow

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Window

GtkOffscreenWindow is strictly intended to be used for obtaining snapshots of widgets that are not part of a normal widget hierarchy. Since #GtkOffscreenWindow is a toplevel widget you cannot obtain snapshots of a full window with it since you cannot pack a toplevel widget in another toplevel. The idea is to take a widget and manually set the state of it, add it to a GtkOffscreenWindow and then retrieve the snapshot as a #cairo_surface_t or #GdkPixbuf. GtkOffscreenWindow derives from #GtkWindow only as an implementation detail. Applications should not use any API specific to #GtkWindow to operate on this object. It should be treated as a #GtkBin that has no parent widget. When contained offscreen widgets are redrawn, GtkOffscreenWindow will emit a #GtkWidget::damage-event signal.

Methods

GdkPixbuf.Pixbufget_pixbuf()

cairo.Surfaceget_surface()

Interface: Gtk.Orientable

Classes implementing Gtk.Orientable: Gtk.Toolbar, Gtk.VolumeButton, Gtk.HButtonBox, Gtk.CellAreaBox, Gtk.RecentChooserWidget, Gtk.HScrollbar, Gtk.ToolPalette, Gtk.VScrollbar, Gtk.ColorSelection, Gtk.CellView, Gtk.HPaned, Gtk.Paned, Gtk.VButtonBox, Gtk.InfoBar, Gtk.FileChooserButton, Gtk.Range, Gtk.Scrollbar, Gtk.Statusbar, Gtk.ButtonBox, Gtk.CellRendererProgress, Gtk.Separator, Gtk.VScale, Gtk.Box, Gtk.VPaned, Gtk.HScale, Gtk.VSeparator, Gtk.ScaleButton, Gtk.ProgressBar, Gtk.FontSelection, Gtk.Scale, Gtk.FileChooserWidget, Gtk.HBox, Gtk.AppChooserWidget, Gtk.HSeparator, Gtk.VBox, Gtk.Grid

The #GtkOrientable interface is implemented by all widgets that can be oriented horizontally or vertically. Historically, such widgets have been realized as subclasses of a common base class (e.g #GtkBox/#GtkHBox/#GtkVBox or #GtkScale/#GtkHScale/#GtkVScale). #GtkOrientable is more flexible in that it allows the orientation to be changed at runtime, allowing the widgets to 'flip'. #GtkOrientable was introduced in GTK+ 2.16.

Properties

Gtk.Orientation"orientation"read/write

The orientation of the orientable.

Methods

Gtk.Orientationget_orientation()

voidset_orientation(orientation)

Class: Gtk.PageSetup

Subclass of: GObject.Object

A GtkPageSetup object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to the #GtkPrintOperation when printing. The benefit of splitting this out of the #GtkPrintSettings is that these affect the actual layout of the page, and thus need to be set long before user prints. <para id="print-margins"> The margins specified in this object are the "print margins", i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the <emphasis>minimal</emphasis> size for the layout margins. </para> To obtain a #GtkPageSetup use gtk_page_setup_new() to get the defaults, or use gtk_print_run_page_setup_dialog() to show the page setup dialog and receive the resulting page setup. <example> <title>A page setup dialog</title> <programlisting> static GtkPrintSettings *settings = NULL; static GtkPageSetup *page_setup = NULL; static void do_page_setup (void) { GtkPageSetup *new_page_setup; if (settings == NULL) settings = gtk_print_settings_new (<!-- -->); new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), page_setup, settings); if (page_setup) g_object_unref (page_setup); page_setup = new_page_setup; } </programlisting> </example> Printing support was added in GTK+ 2.10.

Methods

floatget_bottom_margin(unit)

floatget_left_margin(unit)

Gtk.PageOrientationget_orientation()

floatget_page_height(unit)

floatget_page_width(unit)

floatget_paper_height(unit)

Gtk.PaperSizeget_paper_size()

floatget_paper_width(unit)

floatget_right_margin(unit)

floatget_top_margin(unit)

boolload_file(file_name)

boolload_key_file(key_file, group_name)

voidset_bottom_margin(margin, unit)

voidset_left_margin(margin, unit)

voidset_orientation(orientation)

voidset_paper_size(size)

voidset_paper_size_and_default_margins(size)

voidset_right_margin(margin, unit)

voidset_top_margin(margin, unit)

boolto_file(file_name)

voidto_key_file(key_file, group_name)

Class: Gtk.Paned

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.VPaned, Gtk.HPaned

Subclass of: Gtk.Container

#GtkPaned is the base class for widgets with two panes, arranged either horizontally (#GtkHPaned) or vertically (#GtkVPaned). Child widgets are added to the panes of the widget with gtk_paned_pack1() and gtk_paned_pack2(). The division between the two children is set by default from the size requests of the children, but it can be adjusted by the user. A paned widget draws a separator between the two child widgets and a small handle that the user can drag to adjust the division. It does not draw any relief around the children or around the separator. (The space in which the separator is called the gutter.) Often, it is useful to put each child inside a #GtkFrame with the shadow type set to %GTK_SHADOW_IN so that the gutter appears as a ridge. No separator is drawn if one of the children is missing. Each child has two options that can be set, @resize and @shrink. If expand or shrink along with the paned widget. If @shrink is true, then that child can be made smaller than its requisition by the user. Setting @shrink to %FALSE allows the application to set a minimum size. If @resize is false for both children, then this is treated as if The application can set the position of the slider as if it were set by the user, by calling gtk_paned_set_position(). <example> <title>Creating a paned widget with minimum sizes.</title> <programlisting> GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); GtkWidget *frame1 = gtk_frame_new (NULL); GtkWidget *frame2 = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN); gtk_widget_set_size_request (hpaned, 200, -1); gtk_paned_pack1 (GTK_PANED (hpaned), frame1, TRUE, FALSE); gtk_widget_set_size_request (frame1, 50, -1); gtk_paned_pack2 (GTK_PANED (hpaned), frame2, FALSE, FALSE); gtk_widget_set_size_request (frame2, 50, -1); </programlisting> </example>

Properties

int"position"read/write

bool"position-set"read/write

int"min-position"read-only

The smallest possible value for the position property. This property is derived from the size and shrinkability of the widget's children.

int"max-position"read-only

The largest possible value for the position property. This property is derived from the size and shrinkability of the widget's children.

Signals

bool"cycle-handle-focus"(self, paned, reversed)

The ::cycle-handle-focus signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to cycle whether the paned should grab focus to allow the user to change position of the handle by using key bindings. The default binding for this signal is f8.

bool"move-handle"(self, paned, scroll_type)

The ::move-handle signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to move the handle when the user is using key bindings to move it.

bool"accept-position"(self, paned)

The ::accept-position signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to accept the current position of the handle when moving it using key bindings. The default binding for this signal is Return or Space.

bool"cycle-child-focus"(self, paned, reversed)

The ::cycle-child-focus signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to cycle the focus between the children of the paned. The default binding is f6.

bool"cancel-position"(self, paned)

The ::cancel-position signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to cancel moving the position of the handle using key bindings. The position of the handle will be reset to the value prior to moving it. The default binding for this signal is Escape.

bool"toggle-handle-focus"(self, paned)

The ::toggle-handle-focus is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to accept the current position of the handle and then move focus to the next widget in the focus chain. The default binding is Tab.

Methods

boolaccept_position()

voidadd1(child)

voidadd2(child)

boolcancel_position()

boolcycle_child_focus(reverse)

boolcycle_handle_focus(reverse)

Gtk.Widgetget_child1()

Gtk.Widgetget_child2()

Gdk.Windowget_handle_window()

intget_position()

boolmove_handle(scroll)

voidpack1(child, resize, shrink)

voidpack2(child, resize, shrink)

voidset_position(position)

booltoggle_handle_focus()

Class: Gtk.Plug

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Window

Properties

Gdk.Window"socket-window"read-only

bool"embedded"read-only

Signals

void"embedded"(self, plug)

Methods

voidembedded()

boolget_embedded()

Class: Gtk.PrintContext

Subclass of: GObject.Object

Methods

Pango.Contextcreate_pango_context()

Pango.Layoutcreate_pango_layout()

cairo.Contextget_cairo_context()

floatget_dpi_x()

floatget_dpi_y()

bool, float, float, float, floatget_hard_margins()

floatget_height()

Gtk.PageSetupget_page_setup()

Pango.FontMapget_pango_fontmap()

floatget_width()

voidset_cairo_context(cr, dpi_x, dpi_y)

Class: Gtk.PrintOperation

Implements: Gtk.PrintOperationPreview

Subclass of: GObject.Object

GtkPrintOperation is the high-level, portable printing API. It looks a bit different than other GTK+ dialogs such as the #GtkFileChooser, since some platforms don't expose enough infrastructure to implement a good print dialog. On such platforms, GtkPrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see #GtkPrintUnixDialog. The typical way to use the high-level printing API is to create a GtkPrintOperation object with gtk_print_operation_new() when the user selects to print. Then you set some properties on it, e.g. the page size, any #GtkPrintSettings from previous print operations, the number of pages, the current page, etc. Then you start the print operation by calling gtk_print_operation_run(). It will then show a dialog, let the user select a printer and options. When the user finished the dialog various signals will be emitted on the #GtkPrintOperation, the main one being #GtkPrintOperation::draw-page, which you are supposed to catch and render the page on the provided #GtkPrintContext using Cairo. <example> <title>The high-level printing API</title> <programlisting> static GtkPrintSettings *settings = NULL; static void do_print (void) { GtkPrintOperation *print; GtkPrintOperationResult res; print = gtk_print_operation_new (); if (settings != NULL) gtk_print_operation_set_print_settings (print, settings); g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL); g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL); res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (main_window), NULL); if (res == GTK_PRINT_OPERATION_RESULT_APPLY) { if (settings != NULL) g_object_unref (settings); settings = g_object_ref (gtk_print_operation_get_print_settings (print)); } g_object_unref (print); } </programlisting> </example> By default GtkPrintOperation uses an external application to do print preview. To implement a custom print preview, an application must connect to the preview signal. The functions gtk_print_operation_print_preview_render_page(), gtk_print_operation_preview_end_preview() and gtk_print_operation_preview_is_selected() are useful when implementing a print preview.

Properties

Gtk.PrintStatus"status"read-only

The status of the print operation.

bool"track-print-status"read/write

If %TRUE, the print operation will try to continue report on the status of the print job in the printer queues and printer. This can allow your application to show things like "out of paper" issues, and when the print job actually reaches the printer. However, this is often implemented using polling, and should not be enabled unless needed.

string"job-name"read/write

A string used to identify the job (e.g. in monitoring applications like eggcups). If you don't set a job name, GTK+ picks a default one by numbering successive print jobs.

bool"has-selection"read/write

Determines whether there is a selection in your application. This can allow your application to print the selection. This is typically used to make a "Selection" button sensitive.

bool"embed-page-setup"read/write

If %TRUE, page size combo box and orientation combo box are embedded into page setup page.

string"custom-tab-label"read/write

Used as the label of the tab containing custom widgets. Note that this property may be ignored on some platforms. If this is %NULL, GTK+ uses a default label.

int"n-pages-to-print"read-only

The number of pages that will be printed. Note that this value is set during print preparation phase (%GTK_PRINT_STATUS_PREPARING), so this value should never be get before the data generation phase (%GTK_PRINT_STATUS_GENERATING_DATA). You can connect to the #GtkPrintOperation::status-changed signal and call gtk_print_operation_get_n_pages_to_print() when print status is %GTK_PRINT_STATUS_GENERATING_DATA. This is typically used to track the progress of print operation.

bool"use-full-page"read/write

If %TRUE, the transformation for the cairo context obtained from #GtkPrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet). Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).

Gtk.PrintSettings"print-settings"read/write

The #GtkPrintSettings used for initializing the dialog. Setting this property is typically used to re-establish print settings from a previous print operation, see gtk_print_operation_run().

int"current-page"read/write

The current page in the document. If this is set before gtk_print_operation_run(), the user will be able to select to print only the current page. Note that this only makes sense for pre-paginated documents.

bool"show-progress"read/write

Determines whether to show a progress dialog during the print operation.

int"n-pages"read/write

The number of pages in the document. This <emphasis>must</emphasis> be set to a positive number before the rendering starts. It may be set in a #GtkPrintOperation::begin-print signal hander. Note that the page numbers passed to the #GtkPrintOperation::request-page-setup and #GtkPrintOperation::draw-page signals are 0-based, i.e. if the user chooses to print all pages, the last ::draw-page signal will be for page @n_pages - 1.

string"export-filename"read/write

The name of a file to generate instead of showing the print dialog. Currently, PDF is the only supported format. The intended use of this property is for implementing "Export to PDF" actions. "Print to PDF" support is independent of this and is done by letting the user pick the "Print to PDF" item from the list of printers in the print dialog.

Gtk.PageSetup"default-page-setup"read/write

The #GtkPageSetup used by default. This page setup will be used by gtk_print_operation_run(), but it can be overridden on a per-page basis by connecting to the #GtkPrintOperation::request-page-setup signal.

bool"support-selection"read/write

If %TRUE, the print operation will support print of selection. This allows the print dialog to show a "Selection" button.

bool"allow-async"read/write

Determines whether the print operation may run asynchronously or not. Some systems don't support asynchronous printing, but those that do will return %GTK_PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and emit the #GtkPrintOperation::done signal when the operation is actually done. The Windows port does not support asynchronous operation at all (this is unlikely to change). On other platforms, all actions except for %GTK_PRINT_OPERATION_ACTION_EXPORT support asynchronous operation.

string"status-string"read-only

A string representation of the status of the print operation. The string is translated and suitable for displaying the print status e.g. in a #GtkStatusbar. See the #GtkPrintOperation:status property for a status value that is suitable for programmatic use.

Gtk.Unit"unit"read/write

The transformation for the cairo context obtained from #GtkPrintContext is set up in such a way that distances are measured in units of @unit.

Signals

void"request-page-setup"(self, print_operation, context, page_nr, setup)

Emitted once for every page that is printed, to give the application a chance to modify the page setup. Any changes done to @setup will be in force only for printing this page.

bool"paginate"(self, print_operation, context)

Emitted after the #GtkPrintOperation::begin-print signal, but before the actual rendering starts. It keeps getting emitted until a connected signal handler returns %TRUE. The ::paginate signal is intended to be used for paginating a document in small chunks, to avoid blocking the user interface for a long time. The signal handler should update the number of pages using gtk_print_operation_set_n_pages(), and return %TRUE if the document has been completely paginated. If you don't need to do pagination in chunks, you can simply do it all in the ::begin-print handler, and set the number of pages from there.

void"end-print"(self, print_operation, context)

Emitted after all pages have been rendered. A handler for this signal can clean up any resources that have been allocated in the #GtkPrintOperation::begin-print handler.

void"begin-print"(self, print_operation, context)

Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts. A typical use for ::begin-print is to use the parameters from the #GtkPrintContext and paginate the document accordingly, and then set the number of pages with gtk_print_operation_set_n_pages().

void"status-changed"(self, print_operation)

Emitted at between the various phases of the print operation. See #GtkPrintStatus for the phases that are being discriminated. Use gtk_print_operation_get_status() to find out the current status.

void"draw-page"(self, print_operation, context, page_nr)

Emitted for every page that is printed. The signal handler must render the @page_nr's page onto the cairo context obtained from @context using gtk_print_context_get_cairo_context(). |[ static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { cairo_t *cr; PangoLayout *layout; gdouble width, text_height; gint layout_height; PangoFontDescription *desc; cr = gtk_print_context_get_cairo_context (context); width = gtk_print_context_get_width (context); cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT); cairo_set_source_rgb (cr, 0.8, 0.8, 0.8); cairo_fill (cr); layout = gtk_print_context_create_pango_layout (context); desc = pango_font_description_from_string ("sans 14"); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); pango_layout_set_text (layout, "some text", -1); pango_layout_set_width (layout, width * PANGO_SCALE); pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); pango_layout_get_size (layout, NULL, &layout_height); text_height = (gdouble)layout_height / PANGO_SCALE; cairo_move_to (cr, width / 2, (HEADER_HEIGHT - text_height) / 2); pango_cairo_show_layout (cr, layout); g_object_unref (layout); } ]| Use gtk_print_operation_set_use_full_page() and gtk_print_operation_set_unit() before starting the print operation to set up the transformation of the cairo context according to your needs.

void"done"(self, print_operation, result)

Emitted when the print operation run has finished doing everything required for printing. If @result is %GTK_PRINT_OPERATION_RESULT_ERROR then you can call gtk_print_operation_get_error() for more information. If you enabled print status tracking then gtk_print_operation_is_finished() may still return %FALSE after #GtkPrintOperation::done was emitted.

void"custom-widget-apply"(self, print_operation, widget)

Emitted right before #GtkPrintOperation::begin-print if you added a custom widget in the #GtkPrintOperation::create-custom-widget handler. When you get this signal you should read the information from the custom widgets, as the widgets are not guaraneed to be around at a later time.

GObject.Object"create-custom-widget"(self, print_operation)

Emitted when displaying the print dialog. If you return a widget in a handler for this signal it will be added to a custom tab in the print dialog. You typically return a container widget with multiple widgets in it. The print dialog owns the returned widget, and its lifetime is not controlled by the application. However, the widget is guaranteed to stay around until the #GtkPrintOperation::custom-widget-apply signal is emitted on the operation. Then you can read out any information you need from the widgets. the print dialog, or %NULL

void"update-custom-widget"(self, print_operation, widget, setup, settings)

Emitted after change of selected printer. The actual page setup and print settings are passed to the custom widget, which can actualize itself according to this change.

bool"preview"(self, print_operation, preview, context, parent)

Gets emitted when a preview is requested from the native dialog. The default handler for this signal uses an external viewer application to preview. To implement a custom print preview, an application must return %TRUE from its handler for this signal. In order to use the provided @context for the preview implementation, it must be given a suitable cairo context with gtk_print_context_set_cairo_context(). The custom preview implementation can use gtk_print_operation_preview_is_selected() and gtk_print_operation_preview_render_page() to find pages which are selected for print and render them. The preview must be finished by calling gtk_print_operation_preview_end_preview() (typically in response to the user clicking a close button).

Methods

voidbegin_print(context)

voidcancel()

voidcustom_widget_apply(widget)

voiddone(result)

voiddraw_page(context, page_nr)

voiddraw_page_finish()

voidend_print(context)

Gtk.PageSetupget_default_page_setup()

boolget_embed_page_setup()

voidget_error()

boolget_has_selection()

intget_n_pages_to_print()

Gtk.PrintSettingsget_print_settings()

Gtk.PrintStatusget_status()

stringget_status_string()

boolget_support_selection()

boolis_finished()

boolpaginate(context)

boolpreview(preview, context, parent)

voidrequest_page_setup(context, page_nr, setup)

voidset_allow_async(allow_async)

voidset_current_page(current_page)

voidset_custom_tab_label(label)

voidset_default_page_setup(default_page_setup)

voidset_defer_drawing()

voidset_embed_page_setup(embed)

voidset_export_filename(filename)

voidset_has_selection(has_selection)

voidset_job_name(job_name)

voidset_n_pages(n_pages)

voidset_print_settings(print_settings)

voidset_show_progress(show_progress)

voidset_support_selection(support_selection)

voidset_track_print_status(track_status)

voidset_unit(unit)

voidset_use_full_page(full_page)

voidstatus_changed()

voidupdate_custom_widget(widget, setup, settings)

Interface: Gtk.PrintOperationPreview

Classes implementing Gtk.PrintOperationPreview: Gtk.PrintOperation

Signals

none"ready"(self, print_operation_preview, context)

The ::ready signal gets emitted once per preview operation, before the first page is rendered. A handler for this signal can be used for setup tasks.

none"got-page-size"(self, print_operation_preview, context, page_setup)

The ::got-page-size signal is emitted once for each page that gets rendered to the preview. A handler for this signal should update the @context according to @page_setup and set up a suitable cairo context, using gtk_print_context_set_cairo_context().

Methods

voidend_preview()

voidgot_page_size(context, page_setup)

boolis_selected(page_nr)

voidready(context)

voidrender_page(page_nr)

Class: Gtk.PrintSettings

Subclass of: GObject.Object

Methods

voidforeach(func, user_data)

stringget(key)

boolget_bool(key)

boolget_collate()

stringget_default_source()

stringget_dither()

floatget_double(key)

floatget_double_with_default(key, def)

Gtk.PrintDuplexget_duplex()

stringget_finishings()

intget_int(key)

intget_int_with_default(key, def)

floatget_length(key, unit)

stringget_media_type()

intget_n_copies()

intget_number_up()

Gtk.NumberUpLayoutget_number_up_layout()

Gtk.PageOrientationget_orientation()

stringget_output_bin()

Array, intget_page_ranges()

Gtk.PageSetget_page_set()

floatget_paper_height(unit)

Gtk.PaperSizeget_paper_size()

floatget_paper_width(unit)

Gtk.PrintPagesget_print_pages()

stringget_printer()

floatget_printer_lpi()

Gtk.PrintQualityget_quality()

intget_resolution()

intget_resolution_x()

intget_resolution_y()

boolget_reverse()

floatget_scale()

boolget_use_color()

boolhas_key(key)

boolload_file(file_name)

boolload_key_file(key_file, group_name)

voidset(key, value)

voidset_bool(key, value)

voidset_collate(collate)

voidset_default_source(default_source)

voidset_dither(dither)

voidset_double(key, value)

voidset_duplex(duplex)

voidset_finishings(finishings)

voidset_int(key, value)

voidset_length(key, value, unit)

voidset_media_type(media_type)

voidset_n_copies(num_copies)

voidset_number_up(number_up)

voidset_number_up_layout(number_up_layout)

voidset_orientation(orientation)

voidset_output_bin(output_bin)

voidset_page_ranges(page_ranges, num_ranges)

voidset_page_set(page_set)

voidset_paper_height(height, unit)

voidset_paper_size(paper_size)

voidset_paper_width(width, unit)

voidset_print_pages(pages)

voidset_printer(printer)

voidset_printer_lpi(lpi)

voidset_quality(quality)

voidset_resolution(resolution)

voidset_resolution_xy(resolution_x, resolution_y)

voidset_reverse(reverse)

voidset_scale(scale)

voidset_use_color(use_color)

boolto_file(file_name)

voidto_key_file(key_file, group_name)

voidunset(key)

Class: Gtk.ProgressBar

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Widget

The #GtkProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. The #GtkProgressBar can be used in two different When an application can determine how much work needs to take place (e.g. read a fixed number of bytes from a file) and can monitor its progress, it can use the #GtkProgressBar in percentage mode and the user sees a growing bar indicating the percentage of the work that has been completed. In this mode, the application is required to call gtk_progress_bar_set_fraction() periodically to update the progress bar. When an application has no accurate way of knowing the amount of work to do, it can use the #GtkProgressBar in activity mode, which shows activity by a block moving back and forth within the progress area. In this mode, the application is required to call gtk_progress_bar_pulse() periodically to update the progress bar. There is quite a bit of flexibility provided to control the appearance of the #GtkProgressBar. Functions are provided to control the orientation of the bar, optional text can be displayed along with the bar, and the step size used in activity mode can be set.

Properties

bool"show-text"read/write

Pango.EllipsizeMode"ellipsize"read/write

The preferred place to ellipsize the string, if the progressbar does not have enough room to display the entire string, specified as a #PangoEllisizeMode. Note that setting this property to a value other than %PANGO_ELLIPSIZE_NONE has the side-effect that the progressbar requests only enough space to display the ellipsis "...". Another means to set a progressbar's width is gtk_widget_set_size_request().

string"text"read/write

bool"inverted"read/write

float"fraction"read/write

float"pulse-step"read/write

Methods

Pango.EllipsizeModeget_ellipsize()

floatget_fraction()

boolget_inverted()

floatget_pulse_step()

boolget_show_text()

stringget_text()

voidpulse()

voidset_ellipsize(mode)

voidset_fraction(fraction)

voidset_inverted(inverted)

voidset_pulse_step(fraction)

voidset_show_text(show_text)

voidset_text(text)

Class: Gtk.RadioAction

Implements: Gtk.Buildable

Subclass of: Gtk.ToggleAction

A #GtkRadioAction is similar to #GtkRadioMenuItem. A number of radio actions can be linked together so that only one may be active at any one time.

Properties

Gtk.RadioAction"group"read/write

Sets a new group for a radio action.

int"value"read/write

The value is an arbitrary integer which can be used as a convenient way to determine which action in the group is currently active in an ::activate or ::changed signal handler. See gtk_radio_action_get_current_value() and #GtkRadioActionEntry for convenient ways to get and set this property.

int"current-value"read/write

The value property of the currently active member of the group to which this action belongs.

Signals

void"changed"(self, radio_action, current)

The ::changed signal is emitted on every member of a radio group when the active member is changed. The signal gets emitted after the ::activate signals for the previous and current active members.

Methods

voidchanged(current)

intget_current_value()

GLib.SListget_group()

voidjoin_group(group_source)

voidset_current_value(current_value)

voidset_group(group)

Class: Gtk.RadioButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.CheckButton

A single radio button performs the same basic function as a #GtkCheckButton, as its position in the object hierarchy reflects. It is only when multiple radio buttons are grouped together that they become a different user interface component in their own right. Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected. A #GtkRadioButton is one way of giving the user a choice from many options. Radio button widgets are created with gtk_radio_button_new(), passing %NULL as the argument if this is the first radio button in a group. In subsequent calls, the group you wish to add this button to should be passed as an argument. Optionally, gtk_radio_button_new_with_label() can be used if you want a text label on the radio button. Alternatively, when adding widgets to an existing group of radio buttons, use gtk_radio_button_new_from_widget() with a #GtkRadioButton that already has a group assigned to it. The convenience function gtk_radio_button_new_with_label_from_widget() is also provided. To retrieve the group a #GtkRadioButton is assigned to, use gtk_radio_button_get_group(). To remove a #GtkRadioButton from one group and make it part of a new one, use gtk_radio_button_set_group(). The group list does not need to be freed, as each #GtkRadioButton will remove itself and its list item when it is destroyed. <example> <title>How to create a group of two radio buttons.</title> <programlisting> void create_radio_buttons (void) { GtkWidget *window, *radio1, *radio2, *box, *entry; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, TRUE, 2); /&ast; Create a radio button with a GtkEntry widget &ast;/ radio1 = gtk_radio_button_new (NULL); entry = gtk_entry_new (<!-- -->); gtk_container_add (GTK_CONTAINER (radio1), entry); /&ast; Create a radio button with a label &ast;/ radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1), "I'm the second radio button."); /&ast; Pack them into a box, then show all the widgets &ast;/ gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 2); gtk_box_pack_start (GTK_BOX (box), radio2, TRUE, TRUE, 2); gtk_container_add (GTK_CONTAINER (window), box); gtk_widget_show_all (window); return; } </programlisting> </example> When an unselected button in the group is clicked the clicked button receives the #GtkToggleButton::toggled signal, as does the previously selected button. Inside the #GtkToggleButton::toggled handler, gtk_toggle_button_get_active() can be used to determine if the button has been selected or deselected.

Properties

Gtk.RadioButton"group"read/write

Sets a new group for a radio button.

Signals

void"group-changed"(self, radio_button)

Emitted when the group of radio buttons that a radio button belongs to changes. This is emitted when a radio button switches from being alone to being part of a group of 2 or more buttons, or vice-versa, and when a button is moved from one group of 2 or more buttons to a different one, but not when the composition of the group that a button belongs to changes.

Methods

GLib.SListget_group()

voidgroup_changed()

voidjoin_group(group_source)

Gtk.Widgetnew_from_widget()

voidset_group(group)

Class: Gtk.RadioMenuItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.CheckMenuItem

Properties

Gtk.RadioMenuItem"group"read/write

The radio menu item whose group this widget belongs to.

Signals

void"group-changed"(self, radio_menu_item)

Methods

GLib.SListget_group()

voidgroup_changed()

Gtk.Widgetnew_from_widget()

Gtk.Widgetnew_with_label_from_widget(label)

Gtk.Widgetnew_with_mnemonic_from_widget(label)

voidset_group(group)

Class: Gtk.RadioToolButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.ToggleToolButton

Properties

Gtk.RadioToolButton"group"read/write

Sets a new group for a radio tool button.

Methods

GLib.SListget_group()

Gtk.ToolItemnew_from_widget()

Gtk.ToolItemnew_with_stock_from_widget(stock_id)

voidset_group(group)

Abstract Class: Gtk.Range

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.Scrollbar, Gtk.Scale

Subclass of: Gtk.Widget

#GtkRange is the common base class for widgets which visualize an adjustment, e.g #GtkScale or #GtkScrollbar. Apart from signals for monitoring the parameters of the adjustment, #GtkRange provides properties and methods for influencing the sensitivity of the "steppers". It also provides properties and methods for setting a "fill level" on range widgets. See gtk_range_set_fill_level().

Properties

float"fill-level"read/write

The fill level (e.g. prebuffering of a network stream). See gtk_range_set_fill_level().

int"round-digits"read/write

The number of digits to round the value to when it changes, or -1. See #GtkRange::change-value.

bool"inverted"read/write

bool"restrict-to-fill-level"read/write

The restrict-to-fill-level property controls whether slider movement is restricted to an upper boundary set by the fill level. See gtk_range_set_restrict_to_fill_level().

bool"show-fill-level"read/write

The show-fill-level property controls whether fill level indicator graphics are displayed on the trough. See gtk_range_set_show_fill_level().

Gtk.SensitivityType"upper-stepper-sensitivity"read/write

Gtk.Adjustment"adjustment"construct-only

Gtk.SensitivityType"lower-stepper-sensitivity"read/write

Signals

void"adjust-bounds"(self, range, value)

Emitted before clamping a value, to give the application a chance to adjust the bounds.

bool"change-value"(self, range, scroll, value)

The #GtkRange::change-value signal is emitted when a scroll action is performed on a range. It allows an application to determine the type of scroll event that occurred and the resultant new value. The application can handle the event itself and return %TRUE to prevent further processing. Or, by returning %FALSE, it can pass the event to other handlers until the default GTK+ handler is reached. The value parameter is unrounded. An application that overrides the GtkRange::change-value signal is responsible for clamping the value to the desired number of decimal digits; the default GTK+ handler clamps the value based on #GtkRange:round-digits. It is not possible to use delayed update policies in an overridden #GtkRange::change-value handler.

void"move-slider"(self, range, step)

Virtual function that moves the slider. Used for keybindings.

void"value-changed"(self, range)

Emitted when the range value changes.

Methods

voidadjust_bounds(new_value)

boolchange_value(scroll, new_value)

Gtk.Adjustmentget_adjustment()

floatget_fill_level()

boolget_flippable()

boolget_inverted()

Gtk.SensitivityTypeget_lower_stepper_sensitivity()

intget_min_slider_size()

voidget_range_border(border_)

void, Gdk.Rectangleget_range_rect()

boolget_restrict_to_fill_level()

intget_round_digits()

boolget_show_fill_level()

void, int, intget_slider_range()

boolget_slider_size_fixed()

Gtk.SensitivityTypeget_upper_stepper_sensitivity()

floatget_value()

voidmove_slider(scroll)

voidset_adjustment(adjustment)

voidset_fill_level(fill_level)

voidset_flippable(flippable)

voidset_increments(step, page)

voidset_inverted(setting)

voidset_lower_stepper_sensitivity(sensitivity)

voidset_min_slider_size(min_size)

voidset_range(min, max)

voidset_restrict_to_fill_level(restrict_to_fill_level)

voidset_round_digits(round_digits)

voidset_show_fill_level(show_fill_level)

voidset_slider_size_fixed(size_fixed)

voidset_upper_stepper_sensitivity(sensitivity)

voidset_value(value)

voidvalue_changed()

Class: Gtk.RcStyle

Subclass of: GObject.Object

Methods

Gtk.RcStylecopy()

voidmerge(src)

intparse(settings, scanner)

Class: Gtk.RecentAction

Implements: Gtk.Buildable, Gtk.RecentChooser

Subclass of: Gtk.Action

A #GtkRecentAction represents a list of recently used files, which can be shown by widgets such as #GtkRecentChooserDialog or #GtkRecentChooserMenu. To construct a submenu showing recently used files, use a #GtkRecentAction as the action for a &lt;menuitem&gt;. To construct a menu toolbutton showing the recently used files in the popup menu, use a #GtkRecentAction as the action for a &lt;toolitem&gt; element.

Properties

bool"show-numbers"read/write

Methods

boolget_show_numbers()

voidset_show_numbers(show_numbers)

Interface: Gtk.RecentChooser

Classes implementing Gtk.RecentChooser: Gtk.RecentChooserDialog, Gtk.RecentAction, Gtk.RecentChooserWidget, Gtk.RecentChooserMenu

#GtkRecentChooser is an interface that can be implemented by widgets displaying the list of recently used files. In GTK+, the main objects that implement this interface are #GtkRecentChooserWidget, #GtkRecentChooserDialog and #GtkRecentChooserMenu. Recently used files are supported since GTK+ 2.10.

Properties

Gtk.RecentSortType"sort-type"read/write

Sorting order to be used when displaying the recently used resources.

gboolean"show-tips"read/write

Whether this #GtkRecentChooser should display a tooltip containing the full path of the recently used resources.

gboolean"local-only"read/write

Whether this #GtkRecentChooser should display only local (file:) resources.

Gtk.RecentManager"recent-manager"construct-only

The #GtkRecentManager instance used by the #GtkRecentChooser to display the list of recently used resources.

Gtk.RecentFilter"filter"read/write

The #GtkRecentFilter object to be used when displaying the recently used resources.

gboolean"show-private"read/write

gboolean"show-not-found"read/write

Whether this #GtkRecentChooser should display the recently used resources even if not present anymore. Setting this to %FALSE will perform a potentially expensive check on every local resource (every remote resource will always be displayed).

gboolean"show-icons"read/write

Whether this #GtkRecentChooser should display an icon near the item.

gboolean"select-multiple"read/write

Allow the user to select multiple resources.

gint"limit"read/write

The maximum number of recently used resources to be displayed, or -1 to display all items. By default, the override that limit on a particular instance of #GtkRecentChooser by setting this property.

Signals

none"selection-changed"(self, recent_chooser)

This signal is emitted when there is a change in the set of selected recently used resources. This can happen when a user modifies the selection with the mouse or the keyboard, or when explicitely calling functions to change the selection.

none"item-activated"(self, recent_chooser)

This signal is emitted when the user "activates" a recent item in the recent chooser. This can happen by double-clicking on an item in the recently used resources list, or by pressing <keycap>Enter</keycap>.

Methods

voidadd_filter(filter)

Gtk.RecentInfoget_current_item()

stringget_current_uri()

Gtk.RecentFilterget_filter()

GLib.Listget_items()

intget_limit()

boolget_local_only()

boolget_select_multiple()

boolget_show_icons()

boolget_show_not_found()

boolget_show_private()

boolget_show_tips()

Gtk.RecentSortTypeget_sort_type()

Array, Gtk.gsizeget_uris()

voiditem_activated()

GLib.SListlist_filters()

voidremove_filter(filter)

voidselect_all()

boolselect_uri(uri)

voidselection_changed()

boolset_current_uri(uri)

voidset_filter(filter)

voidset_limit(limit)

voidset_local_only(local_only)

voidset_select_multiple(select_multiple)

voidset_show_icons(show_icons)

voidset_show_not_found(show_not_found)

voidset_show_private(show_private)

voidset_show_tips(show_tips)

voidset_sort_func(sort_func, sort_data, data_destroy)

voidset_sort_type(sort_type)

voidunselect_all()

voidunselect_uri(uri)

Class: Gtk.RecentChooserDialog

Implements: Gtk.Buildable, Gtk.RecentChooser, Atk.ImplementorIface

Subclass of: Gtk.Dialog

#GtkRecentChooserDialog is a dialog box suitable for displaying the recently used documents. This widgets works by putting a #GtkRecentChooserWidget inside a #GtkDialog. It exposes the #GtkRecentChooserIface interface, so you can use all the #GtkRecentChooser functions on the recent chooser dialog as well as those for #GtkDialog. Note that #GtkRecentChooserDialog does not have any methods of its own. Instead, you should use the functions that work on a #GtkRecentChooser. <example id="gtkrecentchooser-typical-usage"> <title>Typical usage</title> In the simplest of cases, you can use the following code to use a #GtkRecentChooserDialog to select a recently used file: <programlisting> GtkWidget *dialog; dialog = gtk_recent_chooser_dialog_new ("Recent Documents", parent_window, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { GtkRecentInfo *info; info = gtk_recent_chooser_get_current_item (GTK_RECENT_CHOOSER (dialog)); open_file (gtk_recent_info_get_uri (info)); gtk_recent_info_unref (info); } gtk_widget_destroy (dialog); </programlisting> </example> Recently used files are supported since GTK+ 2.10.

Class: Gtk.RecentChooserMenu

Implements: Gtk.Activatable, Gtk.RecentChooser, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Menu

#GtkRecentChooserMenu is a widget suitable for displaying recently used files inside a menu. It can be used to set a sub-menu of a #GtkMenuItem using gtk_menu_item_set_submenu(), or as the menu of a #GtkMenuToolButton. Note that #GtkRecentChooserMenu does not have any methods of its own. Instead, you should use the functions that work on a #GtkRecentChooser. Note also that #GtkRecentChooserMenu does not support multiple filters, as it has no way to let the user choose between them as the #GtkRecentChooserWidget and #GtkRecentChooserDialog widgets do. Thus using gtk_recent_chooser_add_filter() on a #GtkRecentChooserMenu widget will yield the same effects as using gtk_recent_chooser_set_filter(), replacing any currently set filter with the supplied filter; gtk_recent_chooser_remove_filter() will remove any currently set #GtkRecentFilter object and will unset the current filter; gtk_recent_chooser_list_filters() will return a list containing a single #GtkRecentFilter object. Recently used files are supported since GTK+ 2.10.

Properties

bool"show-numbers"read/write

Whether the first ten items in the menu should be prepended by a number acting as a unique mnemonic.

Methods

boolget_show_numbers()

voidset_show_numbers(show_numbers)

Class: Gtk.RecentChooserWidget

Implements: Gtk.Buildable, Gtk.RecentChooser, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.VBox

#GtkRecentChooserWidget is a widget suitable for selecting recently used files. It is the main building block of a #GtkRecentChooserDialog. Most applications will only need to use the latter; you can use #GtkRecentChooserWidget as part of a larger window if you have special needs. Note that #GtkRecentChooserWidget does not have any methods of its own. Instead, you should use the functions that work on a #GtkRecentChooser. Recently used files are supported since GTK+ 2.10.

Class: Gtk.RecentFilter

Implements: Gtk.Buildable

Subclass of: GObject.InitiallyUnowned

A #GtkRecentFilter can be used to restrict the files being shown in a #GtkRecentChooser. Files can be filtered based on their name (with gtk_recent_filter_add_pattern()), on their mime type (with gtk_file_filter_add_mime_type()), on the application that has registered them (with gtk_recent_filter_add_application()), or by a custom filter function (with gtk_recent_filter_add_custom()). Filtering by mime type handles aliasing and subclassing of mime types; e.g. a filter for text/plain also matches a file with mime type application/rtf, since application/rtf is a subclass of text/plain. Note that #GtkRecentFilter allows wildcards for the subtype of a mime type, so you can e.g. filter for image/<!-- -->*. Normally, filters are used by adding them to a #GtkRecentChooser, see gtk_recent_chooser_add_filter(), but it is also possible to manually use a filter on a file with gtk_recent_filter_filter(). Recently used files are supported since GTK+ 2.10. <refsect2 id="GtkRecentFilter-BUILDER-UI"> <title>GtkRecentFilter as GtkBuildable</title> <para> The GtkRecentFilter implementation of the GtkBuildable interface supports adding rules using the &lt;mime-types&gt, &lt;patterns&gt and &lt;applications&gt elements and listing the rules within. Specifying a &lt;mime-type&gt, &lt;pattern&gt or &lt;application&gt is the same as calling gtk_recent_filter_add_mime_type(), gtk_recent_filter_add_pattern() or gtk_recent_filter_add_application(). <example> <title>A UI definition fragment specifying GtkRecentFilter rules</title> <programlisting><![CDATA[ <object class="GtkRecentFilter"> <mime-types> <mime-type>text/plain</mime-type> <mime-type>image/png</mime-type> </mime-types> <patterns> <pattern>*.txt</pattern> <pattern>*.png</pattern> </patterns> <applications> <application>gimp</application> <application>gedit</application> <application>glade</application> </applications> </object> ]]></programlisting> </example> </para> </refsect2>

Methods

voidadd_age(days)

voidadd_application(application)

voidadd_custom(needed, func, data, data_destroy)

voidadd_group(group)

voidadd_mime_type(mime_type)

voidadd_pattern(pattern)

voidadd_pixbuf_formats()

boolfilter(filter_info)

stringget_name()

Gtk.RecentFilterFlagsget_needed()

voidset_name(name)

Class: Gtk.RecentManager

Subclass of: GObject.Object

#GtkRecentManager provides a facility for adding, removing and looking up recently used files. Each recently used file is identified by its URI, and has meta-data associated to it, like the names and command lines of the applications that have registered it, the number of time each application has registered the same file, the mime type of the file and whether the file should be displayed only by the applications that have registered it. <note><para>The recently used files list is per user.</para></note> The #GtkRecentManager acts like a database of all the recently used files. You can create new #GtkRecentManager objects, but it is more efficient to use the default manager created by GTK+. Adding a new recently used file is as simple as: |[ GtkRecentManager *manager; manager = gtk_recent_manager_get_default (); gtk_recent_manager_add_item (manager, file_uri); ]| The #GtkRecentManager will try to gather all the needed information from the file itself through GIO. Looking up the meta-data associated with a recently used file given its URI requires calling gtk_recent_manager_lookup_item(): |[ GtkRecentManager *manager; GtkRecentInfo *info; GError *error = NULL; manager = gtk_recent_manager_get_default (); info = gtk_recent_manager_lookup_item (manager, file_uri, &amp;error); if (error) { g_error_free (error); } else { /&ast; Use the info object &ast;/ gtk_recent_info_unref (info); } ]| In order to retrieve the list of recently used files, you can use gtk_recent_manager_get_items(), which returns a list of #GtkRecentInfo structures. A #GtkRecentManager is the model used to populate the contents of one, or more #GtkRecentChooser implementations. <note><para>The maximum age of the recently used files list is controllable through the #GtkSettings:gtk-recent-files-max-age property.</para></note> Recently used files are supported since GTK+ 2.10.

Properties

int"size"read-only

The size of the recently used resources list.

string"filename"construct-only

The full path to the file to be used to store and read the recently used resources list

Signals

void"changed"(self, recent_manager)

Emitted when the current recently used resources manager changes its contents, either by calling gtk_recent_manager_add_item() or by another application.

Methods

booladd_full(uri, recent_data)

booladd_item(uri)

voidchanged()

Gtk.RecentManagerget_default()(static method)

GLib.Listget_items()

boolhas_item(uri)

Gtk.RecentInfolookup_item(uri)

boolmove_item(uri, new_uri)

intpurge_items()

boolremove_item(uri)

Class: Gtk.Scale

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.VScale, Gtk.HScale

Subclass of: Gtk.Range

A GtkScale is a slider control used to select a numeric value. To use it, you'll probably want to investigate the methods on its base class, #GtkRange, in addition to the methods for GtkScale itself. To set the value of a scale, you would normally use gtk_range_set_value(). To detect changes to the value, you would normally use the #GtkRange::value-changed signal. Note that using the same upper and lower bounds for the #GtkScale (through the #GtkRange methods) will hide the slider itself. This is useful for applications that want to show an undeterminate value on the scale, without changing the layout of the application (such as movie or music players). <refsect2 id="GtkScale-BUILDER-UI"><title>GtkScale as GtkBuildable</title> GtkScale supports a custom &lt;marks&gt; element, which can contain multiple &lt;mark&gt; elements. The "value" and "position" attributes have the same meaning as gtk_scale_add_mark() parameters of the same name. If the element is not empty, its content is taken as the markup to show at the mark. It can be translated with the usual "translatable and "context" attributes. </refsect2>

Properties

int"digits"read/write

Gtk.PositionType"value-pos"read/write

bool"draw-value"read/write

Signals

string"format-value"(self, scale, value)

Signal which allows you to change how the scale value is displayed. Connect a signal handler which returns an allocated string representing Here's an example signal handler which displays a value 1.0 as with "--&gt;1.0&lt;--". |[ static gchar* format_value_callback (GtkScale *scale, gdouble value) { return g_strdup_printf ("--&gt;&percnt;0.*g&lt;--", gtk_scale_get_digits (scale), value); } ]|

Methods

voidadd_mark(value, position, markup)

voidclear_marks()

voiddraw_value()

stringformat_value(value)

intget_digits()

boolget_draw_value()

Pango.Layoutget_layout()

void, int, intget_layout_offsets()

Gtk.PositionTypeget_value_pos()

voidset_digits(digits)

voidset_draw_value(draw_value)

voidset_value_pos(pos)

Class: Gtk.ScaleButton

Implements: Gtk.Orientable, Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.VolumeButton

Subclass of: Gtk.Button

#GtkScaleButton provides a button which pops up a scale widget. This kind of widget is commonly used for volume controls in multimedia applications, and GTK+ provides a #GtkVolumeButton subclass that is tailored for this use case.

Properties

Gtk.IconSize"size"read/write

Gtk.Adjustment"adjustment"read/write

float"value"read/write

Array"icons"read/write

The names of the icons to be used by the scale button. The first item in the array will be used in the button when the current value is the lowest value, the second item for the highest value. All the subsequent icons will be used for all the other values, spread evenly over the range of values. If there's only one icon name in the @icons array, it will be used for all the values. If only two icon names are in the @icons array, the first one will be used for the bottom 50% of the scale, and the second one for the top 50%. It is recommended to use at least 3 icons so that the #GtkScaleButton reflects the current value of the scale better for the users.

Signals

void"popup"(self, scale_button)

The ::popup signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to popup the scale widget. The default bindings for this signal are Space, Enter and Return.

void"value-changed"(self, scale_button, value)

The ::value-changed signal is emitted when the value field has changed.

void"popdown"(self, scale_button)

The ::popdown signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to popdown the scale widget. The default binding for this signal is Escape.

Methods

Gtk.Adjustmentget_adjustment()

Gtk.Widgetget_minus_button()

Gtk.Widgetget_plus_button()

Gtk.Widgetget_popup()

floatget_value()

voidset_adjustment(adjustment)

voidset_icons(icons)

voidset_value(value)

voidvalue_changed(value)

Interface: Gtk.Scrollable

Classes implementing Gtk.Scrollable: Gtk.ToolPalette, Gtk.TextView, Gtk.Viewport, Gtk.Layout, Gtk.IconView, Gtk.TreeView

#GtkScrollable is an interface that is implemented by widgets with native scrolling ability. To implement this interface you should override the #GtkScrollable:hadjustment and #GtkScrollable:vadjustment properties. <refsect2> <title>Creating a scrollable widget</title> <para> All scrollable widgets should do the following. <orderedlist> <listitem> <para> When a parent widget sets the scrollable child widget's adjustments, the widget should populate the adjustments' #GtkAdjustment:lower, #GtkAdjustment:upper, #GtkAdjustment:step-increment, #GtkAdjustment:page-increment and #GtkAdjustment:page-size properties and connect to the #GtkAdjustment::value-changed signal. </para> </listitem> <listitem> <para> When the parent allocates space to the scrollable child widget, the widget should update the adjustments' properties with new values. </para> </listitem> <listitem> <para> When any of the adjustments emits the #GtkAdjustment::value-changed signal, the scrollable widget should scroll its contents. </para> </listitem> </orderedlist> </para> </refsect2>

Properties

Gtk.Adjustment"vadjustment"construct-only

Verical #GtkAdjustment of the scrollable widget. This adjustment is shared between the scrollable widget and its parent.

Gtk.Adjustment"hadjustment"construct-only

Horizontal #GtkAdjustment of the scrollable widget. This adjustment is shared between the scrollable widget and its parent.

Gtk.ScrollablePolicy"hscroll-policy"read/write

Determines whether horizontal scrolling should start once the scrollable widget is allocated less than its minimum width or less than its natural width.

Gtk.ScrollablePolicy"vscroll-policy"read/write

Determines whether vertical scrolling should start once the scrollable widget is allocated less than its minimum height or less than its natural height.

Methods

Gtk.Adjustmentget_hadjustment()

Gtk.ScrollablePolicyget_hscroll_policy()

Gtk.Adjustmentget_vadjustment()

Gtk.ScrollablePolicyget_vscroll_policy()

voidset_hadjustment(hadjustment)

voidset_hscroll_policy(policy)

voidset_vadjustment(vadjustment)

voidset_vscroll_policy(policy)

Class: Gtk.Scrollbar

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.HScrollbar, Gtk.VScrollbar

Subclass of: Gtk.Range

The #GtkScrollbar widget is the base class for #GtkHScrollbar and #GtkVScrollbar. It can be used in the same way as these, by setting the "orientation" property appropriately. The position of the thumb in a scrollbar is controlled by the scroll adjustments. See #GtkAdjustment for the fields in an adjustment - for #GtkScrollbar, the #GtkAdjustment.value field represents the position of the scrollbar, which must be between the #GtkAdjustment.lower field and #GtkAdjustment.upper - #GtkAdjustment.page_size. The #GtkAdjustment.page_size field represents the size of the visible scrollable area. The #GtkAdjustment.step_increment and #GtkAdjustment.page_increment fields are used when the user asks to step down (using the small stepper arrows) or page down (using for example the <keycap>PageDown</keycap> key).

Class: Gtk.ScrolledWindow

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Bin

#GtkScrolledWindow is a #GtkBin subclass: it's a container the accepts a single child widget. #GtkScrolledWindow adds scrollbars to the child widget and optionally draws a beveled frame around the child widget. The scrolled window can work in two ways. Some widgets have native scrolling support; these widgets implement the #GtkScrollable interface. Widgets with native scroll support include #GtkTreeView, #GtkTextView, and #GtkLayout. For widgets that lack native scrolling support, the #GtkViewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use #GtkViewport to scroll child widgets such as #GtkTable, #GtkBox, and so on. If a widget has native scrolling abilities, it can be added to the #GtkScrolledWindow with gtk_container_add(). If a widget does not, you must first add the widget to a #GtkViewport, then add the #GtkViewport to the scrolled window. The convenience function gtk_scrolled_window_add_with_viewport() does exactly this, so you can ignore the presence of the viewport. The position of the scrollbars is controlled by the scroll adjustments. See #GtkAdjustment for the fields in an adjustment - for #GtkScrollbar, used by #GtkScrolledWindow, the "value" field represents the position of the scrollbar, which must be between the "lower" field and "upper - page_size." The "page_size" field represents the size of the visible scrollable area. The "step_increment" and "page_increment" fields are used when the user asks to step down (using the small stepper arrows) or page down (using for example the PageDown key). If a #GtkScrolledWindow doesn't behave quite as you would like, or doesn't have exactly the right layout, it's very possible to set up your own scrolling with #GtkScrollbar and for example a #GtkTable.

Properties

Gtk.Adjustment"hadjustment"construct-only

Gtk.PolicyType"hscrollbar-policy"read/write

Gtk.PolicyType"vscrollbar-policy"read/write

Gtk.CornerType"window-placement"read/write

Gtk.Adjustment"vadjustment"construct-only

int"min-content-height"read/write

The minimum content height of @scrolled_window, or -1 if not set.

Gtk.ShadowType"shadow-type"read/write

int"min-content-width"read/write

The minimum content width of @scrolled_window, or -1 if not set.

bool"window-placement-set"read/write

Whether "window-placement" should be used to determine the location of the contents with respect to the scrollbars. Otherwise, the "gtk-scrolled-window-placement" setting is used.

Signals

bool"scroll-child"(self, scrolled_window, scroll, horizontal)

The ::scroll-child signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when a keybinding that scrolls is pressed. The horizontal or vertical adjustment is updated which triggers a signal that the scrolled windows child may listen to and scroll itself.

void"move-focus-out"(self, scrolled_window, direction_type)

The ::move-focus-out signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when focus is moved away from the scrolled window by a keybinding. The #GtkWidget::move-focus signal is emitted with @direction_type on this scrolled windows toplevel parent in the container hierarchy. The default bindings for this signal are <keycombo><keycap>Tab</keycap><keycap>Ctrl</keycap></keycombo> and <keycombo><keycap>Tab</keycap><keycap>Ctrl</keycap><keycap>Shift</keycap></keycombo>.

Methods

voidadd_with_viewport(child)

Gtk.Adjustmentget_hadjustment()

Gtk.Widgetget_hscrollbar()

intget_min_content_height()

intget_min_content_width()

Gtk.CornerTypeget_placement()

void, Gtk.PolicyType, Gtk.PolicyTypeget_policy()

Gtk.ShadowTypeget_shadow_type()

Gtk.Adjustmentget_vadjustment()

Gtk.Widgetget_vscrollbar()

voidmove_focus_out(direction)

boolscroll_child(scroll, horizontal)

voidset_hadjustment(hadjustment)

voidset_min_content_height(height)

voidset_min_content_width(width)

voidset_placement(window_placement)

voidset_shadow_type(type)

voidset_vadjustment(vadjustment)

voidunset_placement()

Class: Gtk.Separator

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.HSeparator, Gtk.VSeparator

Subclass of: Gtk.Widget

The GtkSeparator widget is the base class for #GtkHSeparator and #GtkVSeparator. It can be used in the same way as these, by setting the "orientation" property suitably.

Class: Gtk.SeparatorMenuItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.MenuItem

The #GtkSeparatorMenuItem is a separator used to group items within a menu. It displays a horizontal line with a shadow to make it appear sunken into the interface.

Class: Gtk.SeparatorToolItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.ToolItem

A #GtkSeparatorItem is a #GtkToolItem that separates groups of other #GtkToolItems. Depending on the theme, a #GtkSeparatorToolItem will often look like a vertical line on horizontally docked toolbars. If the #GtkToolbar child property "expand" is %TRUE and the property #GtkSeparatorToolItem:draw is %FALSE, a #GtkSeparatorToolItem will act as a "spring" that forces other items to the ends of the toolbar. Use gtk_separator_tool_item_new() to create a new #GtkSeparatorToolItem.

Properties

bool"draw"read/write

Methods

boolget_draw()

voidset_draw(draw)

Class: Gtk.Settings

Implements: Gtk.StyleProvider

Subclass of: GObject.Object

GtkSettings provide a mechanism to share global settings between applications. On the X window system, this sharing is realized by an <ulink url="http://www.freedesktop.org/wiki/Specifications/xsettings-spec">XSettings</ulink> manager that is usually part of the desktop environment, along with utilities that let the user change these settings. In the absence of an Xsettings manager, GTK+ reads default values for settings from <filename>settings.ini</filename> files in <filename>/etc/gtk-3.0</filename> and <filename>$XDG_CONFIG_HOME/gtk-3.0</filename>. These files must be valid key files (see #GKeyFile), and have a section called Settings. Themes can also provide default values for settings by installing a <filename>settings.ini</filename> file next to their <filename>gtk.css</filename> file. Applications can override system-wide settings with gtk_settings_set_string_property(), gtk_settings_set_long_property(), etc. This should be restricted to special cases though; GtkSettings are not meant as an application configuration facility. When doing so, you need to be aware that settings that are specific to individual widgets may not be available before the widget type has been realized at least once. The following example demonstrates a way to do this: <informalexample><programlisting> gtk_init (&argc, &argv); /&ast; make sure the type is realized &ast;/ g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM)); g_object_set (gtk_settings_get_default (), "gtk-menu-images", FALSE, NULL); </programlisting></informalexample> There is one GtkSettings instance per screen. It can be obtained with gtk_settings_get_for_screen(), but in many cases, it is more convenient to use gtk_widget_get_settings(). gtk_settings_get_default() returns the GtkSettings instance for the default screen.

Properties

string"gtk-modules"read/write

bool"gtk-application-prefer-dark-theme"read/write

Whether the application prefers to use a dark theme. If a GTK+ theme includes a dark variant, it will be used instead of the configured theme. Some applications benefit from minimizing the amount of light pollution that interferes with the content. Good candidates for dark themes are photo and video editors that make the actual content get all the attention and minimize the distraction of the chrome. Dark themes should not be used for documents, where large spaces are white/light and the dark chrome creates too much contrast (web browser, text editor...).

bool"gtk-entry-select-on-focus"read/write

int"gtk-cursor-theme-size"read/write

string"gtk-print-preview-command"read/write

A command to run for displaying the print preview. The command should contain a %f placeholder, which will get replaced by the path to the pdf file. The command may also contain a %s placeholder, which will get replaced by the path to a file containing the print settings in the format produced by gtk_print_settings_to_file(). The preview application is responsible for removing the pdf file and the print settings file when it is done.

bool"gtk-button-images"read/write

int"gtk-timeout-initial"read/write

GLib.HashTable"color-hash"read-only

Holds a hash table representation of the #GtkSettings:gtk-color-scheme setting, mapping color names to #GdkColor<!-- -->s.

string"gtk-xft-rgba"read/write

bool"gtk-enable-input-feedback-sounds"read/write

Whether to play event sounds as feedback to user input. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink> for more information on event sounds and sound themes. GTK+ itself does not support event sounds, you have to use a loadable module like the one that comes with libcanberra.

bool"gtk-menu-images"read/write

bool"gtk-show-input-method-menu"read/write

int"gtk-cursor-blink-time"read/write

Gtk.IMStatusStyle"gtk-im-status-style"read/write

int"gtk-cursor-blink-timeout"read/write

Time after which the cursor stops blinking, in seconds. The timer is reset after each user interaction. Setting this to zero has the same effect as setting #GtkSettings:gtk-cursor-blink to %FALSE.

string"gtk-sound-theme-name"read/write

The XDG sound theme to use for event sounds. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink> for more information on event sounds and sound themes. GTK+ itself does not support event sounds, you have to use a loadable module like the one that comes with libcanberra.

int"gtk-menu-popup-delay"read/write

string"gtk-fallback-icon-theme"read/write

bool"gtk-alternative-sort-arrows"read/write

Controls the direction of the sort indicators in sorted list and tree views. By default an arrow pointing down means the column is sorted in ascending order. When set to %TRUE, this order will be inverted.

bool"gtk-enable-tooltips"read/write

Whether tooltips should be shown on widgets.

string"gtk-font-name"read/write

string"gtk-icon-theme-name"read/write

bool"gtk-cursor-blink"read/write

Whether the cursor should blink. Also see the #GtkSettings:gtk-cursor-blink-timeout setting, which allows more flexible control over cursor blinking.

int"gtk-dnd-drag-threshold"read/write

int"gtk-fontconfig-timestamp"read/write

string"gtk-icon-sizes"read/write

A list of icon sizes. The list is separated by colons, and item has the form: <replaceable>size-name</replaceable> = <replaceable>width</replaceable> , <replaceable>height</replaceable> E.g. "gtk-menu=16,16:gtk-button=20,20:gtk-dialog=48,48". gtk-button, gtk-small-toolbar, gtk-large-toolbar, gtk-dnd, gtk-dialog. Applications can register their own named icon sizes with gtk_icon_size_register().

bool"gtk-keynav-cursor-only"read/write

When %TRUE, keyboard navigation should be able to reach all widgets by using the cursor keys only. Tab, Shift etc. keys can't be expected to be present on the used input device.

int"gtk-tooltip-timeout"read/write

Time, in milliseconds, after which a tooltip could appear if the cursor is hovering on top of a widget.

int"gtk-recent-files-max-age"read/write

The maximum age, in days, of the items inside the recently used resources list. Items older than this setting will be excised from the list. If set to 0, the list will always be empty; if set to -1, no item will be removed.

int"gtk-tooltip-browse-timeout"read/write

Controls the time after which tooltips will appear when browse mode is enabled, in milliseconds. Browse mode is enabled when the mouse pointer moves off an object where a tooltip was currently being displayed. If the mouse pointer hits another object before the browse mode timeout expires (see #GtkSettings:gtk-tooltip-browse-mode-timeout), it will take the amount of milliseconds specified by this setting to popup the tooltip for the new object.

int"gtk-timeout-expand"read/write

bool"gtk-keynav-wrap-around"read/write

When %TRUE, some widgets will wrap around when doing keyboard navigation, such as menus, menubars and notebooks.

Gtk.IconSize"gtk-toolbar-icon-size"read/write

The size of icons in default toolbars.

string"gtk-menu-bar-accel"read/write

int"gtk-double-click-time"read/write

bool"gtk-can-change-accels"read/write

string"gtk-color-scheme"read/write

A palette of named colors for use in themes. The format of the string is <programlisting> ... </programlisting> Color names must be acceptable as identifiers in the <link linkend="gtk-Resource-Files">gtkrc</link> syntax, and color specifications must be in the format accepted by gdk_color_parse(). Note that due to the way the color tables from different sources are merged, color specifications will be converted to hexadecimal form when getting this property. Starting with GTK+ 2.12, the entries can alternatively be separated by ';' instead of newlines: <programlisting> </programlisting>

bool"gtk-enable-event-sounds"read/write

Whether to play any event sounds at all. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/sound-theme-spec">Sound Theme spec</ulink> for more information on event sounds and sound themes. GTK+ itself does not support event sounds, you have to use a loadable module like the one that comes with libcanberra.

bool"gtk-enable-mnemonics"read/write

Whether labels and menu items should have visible mnemonics which can be activated.

string"gtk-color-palette"read/write

Gtk.CornerType"gtk-scrolled-window-placement"read/write

Where the contents of scrolled windows are located with respect to the scrollbars, if not overridden by the scrolled window's own placement.

int"gtk-xft-hinting"read/write

string"gtk-theme-name"read/write

bool"gtk-touchscreen-mode"read/write

When %TRUE, there are no motion notify events delivered on this screen, and widgets can't use the pointer hovering them for any essential functionality.

bool"gtk-enable-accels"read/write

Whether menu items should have visible accelerators which can be activated.

bool"gtk-label-select-on-focus"read/write

bool"gtk-split-cursor"read/write

Gtk.ToolbarStyle"gtk-toolbar-style"read/write

The size of icons in default toolbars.

string"gtk-file-chooser-backend"read/write

int"gtk-menu-bar-popup-delay"read/write

int"gtk-recent-files-limit"read/write

The number of recently used files that should be displayed by default by #GtkRecentChooser implementations and by the #GtkFileChooser. A value of -1 means every recently used file stored.

bool"gtk-auto-mnemonics"read/write

Whether mnemonics should be automatically shown and hidden when the user presses the mnemonic activator.

string"gtk-im-module"read/write

Which IM (input method) module should be used by default. This is the input method that will be used if the user has not explicitly chosen another input method from the IM context menu. See #GtkIMContext and see the #GtkSettings:gtk-show-input-method-menu property.

bool"gtk-enable-animations"read/write

int"gtk-entry-password-hint-timeout"read/write

How long to show the last input character in hidden entries. This value is in milliseconds. 0 disables showing the last char. 600 is a good value for enabling it.

int"gtk-xft-antialias"read/write

bool"gtk-show-unicode-menu"read/write

int"gtk-tooltip-browse-mode-timeout"read/write

Amount of time, in milliseconds, after which the browse mode will be disabled. See #GtkSettings:gtk-tooltip-browse-timeout for more information about browse mode.

bool"gtk-error-bell"read/write

When %TRUE, keyboard navigation and other input-related errors will cause a beep. Since the error bell is implemented using gdk_window_beep(), the windowing system may offer ways to configure the error bell in many ways, such as flashing the window or similar visual effects.

bool"gtk-alternative-button-order"read/write

string"gtk-cursor-theme-name"read/write

int"gtk-double-click-distance"read/write

int"gtk-xft-dpi"read/write

Gtk.IMPreeditStyle"gtk-im-preedit-style"read/write

int"gtk-timeout-repeat"read/write

string"gtk-print-backends"read/write

A comma-separated list of print backends to use in the print dialog. Available print backends depend on the GTK+ installation, and may include "file", "cups", "lpr" or "papi".

string"gtk-key-theme-name"read/write

int"gtk-menu-popdown-delay"read/write

string"gtk-xft-hintstyle"read/write

Methods

Gtk.Settingsget_default()(static method)

Gtk.Settingsget_for_screen(screen)(static method)

voidinstall_property(pspec)(static method)

voidinstall_property_parser(pspec, parser)(static method)

voidset_double_property(name, v_double, origin)

voidset_long_property(name, v_long, origin)

voidset_property_value(name, svalue)

voidset_string_property(name, v_string, origin)

Class: Gtk.SizeGroup

Implements: Gtk.Buildable

Subclass of: GObject.Object

Properties

Gtk.SizeGroupMode"mode"read/write

bool"ignore-hidden"read/write

If %TRUE, unmapped widgets are ignored when determining the size of the group.

Methods

voidadd_widget(widget)

boolget_ignore_hidden()

Gtk.SizeGroupModeget_mode()

GLib.SListget_widgets()

voidremove_widget(widget)

voidset_ignore_hidden(ignore_hidden)

voidset_mode(mode)

Class: Gtk.Socket

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

Signals

bool"plug-removed"(self, socket)

void"plug-added"(self, socket)

Methods

voidplug_added()

boolplug_removed()

Class: Gtk.SpinButton

Implements: Gtk.Buildable, Gtk.Editable, Gtk.CellEditable, Atk.ImplementorIface

Subclass of: Gtk.Entry

A #GtkSpinButton is an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into a #GtkEntry, GtkSpinButton allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the bonus that it can be checked to ensure it is in a given range. The main properties of a GtkSpinButton are through an adjustment. See the #GtkAdjustment section for more details about an adjustment's properties. <example> <title>Using a GtkSpinButton to get an integer</title> <programlisting> /&ast; Provides a function to retrieve an integer value from a &ast; GtkSpinButton and creates a spin button to model percentage &ast; values. &ast;/ gint grab_int_value (GtkSpinButton *button, gpointer user_data) { return gtk_spin_button_get_value_as_int (button); } void create_integer_spin_button (void) { GtkWidget *window, *button; GtkAdjustment *adjustment; adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 5); /&ast; creates the spinbutton, with no decimal places &ast;/ button = gtk_spin_button_new (adjustment, 1.0, 0); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); } </programlisting> </example> <example> <title>Using a GtkSpinButton to get a floating point value</title> <programlisting> /&ast; Provides a function to retrieve a floating point value from a &ast; GtkSpinButton, and creates a high precision spin button. &ast;/ gfloat grab_float_value (GtkSpinButton *button, gpointer user_data) { return gtk_spin_button_get_value (button); } void create_floating_spin_button (void) { GtkWidget *window, *button; GtkAdjustment *adjustment; adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 5); /&ast; creates the spinbutton, with three decimal places &ast;/ button = gtk_spin_button_new (adjustment, 0.001, 3); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); } </programlisting> </example>

Properties

int"digits"read/write

float"climb-rate"read/write

bool"numeric"read/write

float"value"read/write

bool"snap-to-ticks"read/write

Gtk.SpinButtonUpdatePolicy"update-policy"read/write

bool"wrap"read/write

Gtk.Adjustment"adjustment"read/write

Signals

void"change-value"(self, spin_button, object)

int"input"(self, spin_button, new_value)

The ::input signal can be used to influence the conversion of the users input into a double value. The signal handler is expected to use gtk_entry_get_text() to retrieve the text of the entry and set @new_value to the new value. The default conversion uses g_strtod(). was not handled, and %GTK_INPUT_ERROR if the conversion failed.

void"wrapped"(self, spin_button)

The wrapped signal is emitted right after the spinbutton wraps from its maximum to minimum value or vice-versa.

void"value-changed"(self, spin_button)

bool"output"(self, spin_button)

The ::output signal can be used to change to formatting of the value that is displayed in the spin buttons entry. |[ /&ast; show leading zeros &ast;/ static gboolean on_output (GtkSpinButton *spin, gpointer data) { GtkAdjustment *adjustment; gchar *text; int value; adjustment = gtk_spin_button_get_adjustment (spin); value = (int)gtk_adjustment_get_value (adjustment); text = g_strdup_printf ("%02d", value); gtk_entry_set_text (GTK_ENTRY (spin), text); g_free (text); return TRUE; } ]|

Methods

voidchange_value(scroll)

voidconfigure(adjustment, climb_rate, digits)

Gtk.Adjustmentget_adjustment()

intget_digits()

void, float, floatget_increments()

boolget_numeric()

void, float, floatget_range()

boolget_snap_to_ticks()

Gtk.SpinButtonUpdatePolicyget_update_policy()

floatget_value()

intget_value_as_int()

boolget_wrap()

intinput(new_value)

intoutput()

voidset_adjustment(adjustment)

voidset_digits(digits)

voidset_increments(step, page)

voidset_numeric(numeric)

voidset_range(min, max)

voidset_snap_to_ticks(snap_to_ticks)

voidset_update_policy(policy)

voidset_value(value)

voidset_wrap(wrap)

voidspin(direction, increment)

voidupdate()

voidvalue_changed()

voidwrapped()

Class: Gtk.Spinner

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Widget

A GtkSpinner widget displays an icon-size spinning animation. It is often used as an alternative to a #GtkProgressBar for displaying indefinite activity, instead of actual progress. To start the animation, use gtk_spinner_start(), to stop it use gtk_spinner_stop().

Properties

bool"active"read/write

Methods

voidstart()

voidstop()

Class: Gtk.StatusIcon

Subclass of: GObject.Object

Properties

string"tooltip-text"read/write

Sets the text of tooltip to be the given string. Also see gtk_tooltip_set_text(). This is a convenience property which will take care of getting the tooltip shown if the given string is not %NULL. #GtkStatusIcon:has-tooltip will automatically be set to %TRUE and the default handler for the #GtkStatusIcon::query-tooltip signal will take care of displaying the tooltip. Note that some platforms have limitations on the length of tooltips that they allow on status icons, e.g. Windows only shows the first 64 characters.

Gtk.Orientation"orientation"read-only

The orientation of the tray in which the statusicon is embedded.

bool"embedded"read-only

%TRUE if the statusicon is embedded in a notification area.

string"title"read/write

The title of this tray icon. This should be a short, human-readable, localized string describing the tray icon. It may be used by tools like screen readers to render the tray icon.

Gtk.ImageType"storage-type"read-only

GdkPixbuf.Pixbuf"pixbuf"read/write

Gdk.Screen"screen"read/write

bool"visible"read/write

string"icon-name"read/write

bool"has-tooltip"read/write

Enables or disables the emission of #GtkStatusIcon::query-tooltip on tooltip, in this case the status icon will be queried using #GtkStatusIcon::query-tooltip to determine whether it will provide a tooltip or not. Note that setting this property to %TRUE for the first time will change the event masks of the windows of this status icon to include leave-notify and motion-notify events. This will not be undone when the property is set to %FALSE again. Whether this property is respected is platform dependent. For plain text tooltips, use #GtkStatusIcon:tooltip-text in preference.

string"tooltip-markup"read/write

Sets the text of tooltip to be the given string, which is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>. Also see gtk_tooltip_set_markup(). This is a convenience property which will take care of getting the tooltip shown if the given string is not %NULL. #GtkStatusIcon:has-tooltip will automatically be set to %TRUE and the default handler for the #GtkStatusIcon::query-tooltip signal will take care of displaying the tooltip. On some platforms, embedded markup will be ignored.

Gio.Icon"gicon"read/write

The #GIcon displayed in the #GtkStatusIcon. For themed icons, the image will be updated automatically if the theme changes.

string"file"read/write

string"stock"read/write

int"size"read-only

Signals

void"activate"(self, status_icon)

Gets emitted when the user activates the status icon. If and how status icons can activated is platform-dependent. Unlike most G_SIGNAL_ACTION signals, this signal is meant to be used by applications and should be wrapped by language bindings.

bool"scroll-event"(self, status_icon, event)

The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned. Whether this event is emitted is platform-dependent. %FALSE to propagate the event further.

void"popup-menu"(self, status_icon, button, activate_time)

Gets emitted when the user brings up the context menu of the status icon. Whether status icons can have context menus and how these are activated is platform-dependent. The @button and @activate_time parameters should be passed as the last to arguments to gtk_menu_popup(). Unlike most G_SIGNAL_ACTION signals, this signal is meant to be used by applications and should be wrapped by language bindings.

bool"query-tooltip"(self, status_icon, x, y, keyboard_mode, tooltip)

Emitted when the #GtkSettings:gtk-tooltip-timeout has expired with the cursor hovering above @status_icon; or emitted when @status_icon got focus in keyboard mode. Using the given coordinates, the signal handler should determine whether a tooltip should be shown for @status_icon. If this is the case %TRUE should be returned, %FALSE otherwise. Note that if should not be used. The signal handler is free to manipulate @tooltip with the therefore destined function calls. Whether this signal is emitted is platform-dependent. For plain text tooltips, use #GtkStatusIcon:tooltip-text in preference.

bool"button-release-event"(self, status_icon, event)

The ::button-release-event signal will be emitted when a button (typically from a mouse) is released. Whether this event is emitted is platform-dependent. Use the ::activate and ::popup-menu signals in preference. for the event. %FALSE to propagate the event further.

bool"size-changed"(self, status_icon, size)

Gets emitted when the size available for the image changes, e.g. because the notification area got resized. size. Otherwise, GTK+ will scale the icon as necessary.

bool"button-press-event"(self, status_icon, event)

The ::button-press-event signal will be emitted when a button (typically from a mouse) is pressed. Whether this event is emitted is platform-dependent. Use the ::activate and ::popup-menu signals in preference. for the event. %FALSE to propagate the event further.

Methods

voidactivate()

boolbutton_press_event(event)

boolbutton_release_event(event)

bool, Gdk.Screen, Gdk.Rectangle, Gtk.Orientationget_geometry()

Gio.Iconget_gicon()

boolget_has_tooltip()

stringget_icon_name()

GdkPixbuf.Pixbufget_pixbuf()

Gdk.Screenget_screen()

intget_size()

stringget_stock()

Gtk.ImageTypeget_storage_type()

stringget_title()

stringget_tooltip_markup()

stringget_tooltip_text()

boolget_visible()

intget_x11_window_id()

boolis_embedded()

voidpopup_menu(button, activate_time)

void, int, int, boolposition_menu(menu, user_data)(static method)

boolquery_tooltip(x, y, keyboard_mode, tooltip)

boolscroll_event(event)

voidset_from_file(filename)

voidset_from_gicon(icon)

voidset_from_icon_name(icon_name)

voidset_from_pixbuf(pixbuf)

voidset_from_stock(stock_id)

voidset_has_tooltip(has_tooltip)

voidset_name(name)

voidset_screen(screen)

voidset_title(title)

voidset_tooltip_markup(markup)

voidset_tooltip_text(text)

voidset_visible(visible)

boolsize_changed(size)

Class: Gtk.Statusbar

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.HBox

A #GtkStatusbar is usually placed along the bottom of an application's main #GtkWindow. It may provide a regular commentary of the application's status (as is usually the case in a web browser, for example), or may be used to simply output a message when the status changes, (when an upload is complete in an FTP client, for example). Status bars in GTK+ maintain a stack of messages. The message at the top of the each bar's stack is the one that will currently be displayed. Any messages added to a statusbar's stack must specify a <emphasis>context id</emphasis> that is used to uniquely identify the source of a message. This context id can be generated by gtk_statusbar_get_context_id(), given a message and the statusbar that it will be added to. Note that messages are stored in a stack, and when choosing which message to display, the stack structure is adhered to, regardless of the context identifier of a message. One could say that a statusbar maintains one stack of messages for display purposes, but allows multiple message producers to maintain sub-stacks of the messages they produced (via context ids). Status bars are created using gtk_statusbar_new(). Messages are added to the bar's stack with gtk_statusbar_push(). The message at the top of the stack can be removed using gtk_statusbar_pop(). A message can be removed from anywhere in the stack if its message id was recorded at the time it was added. This is done using gtk_statusbar_remove().

Signals

void"text-popped"(self, statusbar, context_id, text)

Is emitted whenever a new message is popped off a statusbar's stack.

void"text-pushed"(self, statusbar, context_id, text)

Is emitted whenever a new message gets pushed onto a statusbar's stack.

Methods

intget_context_id(context_description)

Gtk.Widgetget_message_area()

voidpop(context_id)

intpush(context_id, text)

voidremove(context_id, message_id)

voidremove_all(context_id)

voidtext_popped(context_id, text)

voidtext_pushed(context_id, text)

Class: Gtk.Style

Subclass of: GObject.Object

A #GtkStyle object encapsulates the information that provides the look and feel for a widget. <warning> In GTK+ 3.0, GtkStyle has been deprecated and replaced by #GtkStyleContext. </warning> Each #GtkWidget has an associated #GtkStyle object that is used when rendering that widget. Also, a #GtkStyle holds information for the five possible widget states though not every widget supports all five states; see #GtkStateType. Usually the #GtkStyle for a widget is the same as the default style that is set by GTK+ and modified the theme engine. Usually applications should not need to use or modify the #GtkStyle of their widgets.

Properties

Gtk.StyleContext"context"construct-only

Signals

void"unrealize"(self, style)

Emitted when the aspects of the style specific to a particular visual is being cleaned up. A connection to this signal can be useful if a widget wants to cache objects as object data on #GtkStyle. This signal provides a convenient place to free such cached objects.

void"realize"(self, style)

Emitted when the style has been initialized for a particular visual. Connecting to this signal is probably seldom useful since most of the time applications and widgets only deal with styles that have been already realized.

Methods

voidapply_default_background(cr, window, state_type, x, y, width, height)

voidcopy(src)

voiddetach()

voiddraw_arrow(cr, state_type, shadow_type, widget, detail, arrow_type, fill, x, y, width, height)

voiddraw_box(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_box_gap(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width)

voiddraw_check(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_diamond(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_expander(cr, state_type, widget, detail, x, y, expander_style)

voiddraw_extension(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side)

voiddraw_flat_box(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_focus(cr, state_type, widget, detail, x, y, width, height)

voiddraw_handle(cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation)

voiddraw_hline(cr, state_type, widget, detail, x1, x2, y)

voiddraw_layout(cr, state_type, use_text, widget, detail, x, y, layout)

voiddraw_option(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_resize_grip(cr, state_type, widget, detail, edge, x, y, width, height)

voiddraw_shadow(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_shadow_gap(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width)

voiddraw_slider(cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation)

voiddraw_spinner(cr, state_type, widget, detail, step, x, y, width, height)

voiddraw_tab(cr, state_type, shadow_type, widget, detail, x, y, width, height)

voiddraw_vline(cr, state_type, widget, detail, y1_, y2_, x)

voidget_style_property(widget_type, property_name, value)

boolhas_context()

voidinit_from_rc(rc_style)

bool, Gdk.Colorlookup_color(color_name)

Gtk.IconSetlookup_icon_set(stock_id)

voidrealize()

GdkPixbuf.Pixbufrender_icon(source, direction, state, size, widget, detail)

voidset_background(window, state_type)

voidunrealize()

Class: Gtk.StyleContext

Subclass of: GObject.Object

#GtkStyleContext is an object that stores styling information affecting a widget defined by #GtkWidgetPath. In order to construct the final style information, #GtkStyleContext queries information from all attached #GtkStyleProviders. Style providers can be either attached explicitly to the context through gtk_style_context_add_provider(), or to the screen through gtk_style_context_add_provider_for_screen(). The resulting style is a combination of all providers' information in priority order. For GTK+ widgets, any #GtkStyleContext returned by gtk_widget_get_style_context() will already have a #GtkWidgetPath, a #GdkScreen and RTL/LTR information set. The style context will be also updated automatically if any of these settings change on the widget. If you are using the theming layer standalone, you will need to set a widget path and a screen yourself to the created style context through gtk_style_context_set_path() and gtk_style_context_set_screen(), as well as updating the context yourself using gtk_style_context_invalidate() whenever any of the conditions change, such as a change in the #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered widget. <refsect2 id="gtkstylecontext-animations"> <title>Transition animations</title> <para> #GtkStyleContext has built-in support for state change transitions. Note that these animations respect the #GtkSettings:gtk-enable-animations setting. </para> <para> For simple widgets where state changes affect the whole widget area, calling gtk_style_context_notify_state_change() with a %NULL region is sufficient to trigger the transition animation. And GTK+ already does that when gtk_widget_set_state() or gtk_widget_set_state_flags() are called. </para> <para> If a widget needs to declare several animatable regions (i.e. not affecting the whole widget area), its #GtkWidget::draw signal handler needs to wrap the render operations for the different regions with calls to gtk_style_context_push_animatable_region() and gtk_style_context_pop_animatable_region(). These functions take an identifier for the region which must be unique within the style context. For simple widgets with a fixed set of animatable regions, using an enumeration works well: </para> <example> <title>Using an enumeration to identify animatable regions</title> <programlisting> enum { REGION_ENTRY, REGION_BUTTON_UP, REGION_BUTTON_DOWN }; ... gboolean spin_button_draw (GtkWidget *widget, cairo_t *cr) { GtkStyleContext *context; context = gtk_widget_get_style_context (widget); gtk_style_context_push_animatable_region (context, GUINT_TO_POINTER (REGION_ENTRY)); gtk_render_background (cr, 0, 0, 100, 30); gtk_render_frame (cr, 0, 0, 100, 30); gtk_style_context_pop_animatable_region (context); ... } </programlisting> </example> <para> For complex widgets with an arbitrary number of animatable regions, it is up to the implementation to come up with a way to uniquely identify each animatable region. Using pointers to internal structs is one way to achieve this: </para> <example> <title>Using struct pointers to identify animatable regions</title> <programlisting> void notebook_draw_tab (GtkWidget *widget, NotebookPage *page, cairo_t *cr) { gtk_style_context_push_animatable_region (context, page); gtk_render_extension (cr, page->x, page->y, page->width, page->height); gtk_style_context_pop_animatable_region (context); } </programlisting> </example> <para> The widget also needs to notify the style context about a state change for a given animatable region so the animation is triggered. </para> <example> <title>Triggering a state change animation on a region</title> <programlisting> gboolean notebook_motion_notify (GtkWidget *widget, GdkEventMotion *event) { GtkStyleContext *context; NotebookPage *page; context = gtk_widget_get_style_context (widget); page = find_page_under_pointer (widget, event); gtk_style_context_notify_state_change (context, gtk_widget_get_window (widget), page, GTK_STATE_PRELIGHT, TRUE); ... } </programlisting> </example> <para> gtk_style_context_notify_state_change() accepts %NULL region IDs as a special value, in this case, the whole widget area will be updated by the animation. </para> </refsect2> <refsect2 id="gtkstylecontext-classes"> <title>Style classes and regions</title> <para> Widgets can add style classes to their context, which can be used to associate different styles by class (see <xref linkend="gtkcssprovider-selectors"/>). Theme engines can also use style classes to vary their rendering. GTK+ has a number of predefined style classes: <informaltable> <tgroup cols="3"> <thead> <row> <entry>Style class</entry> <entry>Macro</entry> <entry>Used by</entry> </row> </thead> <tbody> <row> <entry>button</entry> <entry>GTK_STYLE_CLASS_BUTTON</entry> <entry>#GtkButton, #GtkToggleButton, #GtkRadioButton, #GtkCheckButton</entry> </row> <row> <entry>default</entry> <entry>GTK_STYLE_CLASS_DEFAULT</entry> <entry>#GtkButton</entry> </row> <row> <entry>check</entry> <entry>GTK_STYLE_CLASS_CHECK</entry> <entry>#GtkCheckButton, #GtkCheckMenuItem, #GtkCellRendererToggle</entry> </row> <row> <entry>radio</entry> <entry>GTK_STYLE_CLASS_RADIO</entry> <entry>#GtkRadioButton, #GtkRadioMenuItem, #GtkCellRendererToggle</entry> </row> <row> <entry>arrow</entry> <entry>GTK_STYLE_CLASS_ARROW</entry> <entry>#GtkArrow</entry> </row> <row> <entry>calendar</entry> <entry>GTK_STYLE_CLASS_CALENDAR</entry> <entry>#GtkCalendar</entry> </row> <row> <entry>entry</entry> <entry>GTK_STYLE_CLASS_ENTRY</entry> <entry>#GtkEntry</entry> </row> <row> <entry>cell</entry> <entry>GTK_STYLE_CLASS_CELL</entry> <entry>#GtkCellRendererToggle</entry> </row> <row> <entry>menu</entry> <entry>GTK_STYLE_CLASS_MENU</entry> <entry>#GtkMenu, #GtkMenuItem, #GtkCheckMenuItem, #GtkRadioMenuItem</entry> </row> <row> <entry>expander</entry> <entry>GTK_STYLE_CLASS_EXPANDER</entry> <entry>#GtkExpander</entry> </row> <row> <entry>tooltip</entry> <entry>GTK_STYLE_CLASS_TOOLTIP</entry> <entry>#GtkTooltip</entry> </row> <row> <entry>frame</entry> <entry>GTK_STYLE_CLASS_FRAME</entry> <entry>#GtkFrame</entry> </row> <row> <entry>scrolled-window</entry> <entry></entry> <entry>#GtkScrolledWindow</entry> </row> <row> <entry>viewport</entry> <entry></entry> <entry>#GtkViewport</entry> </row> <row> <entry>trough</entry> <entry>GTK_STYLE_CLASS_TROUGH</entry> <entry>#GtkScrollbar, #GtkProgressBar, #GtkScale</entry> </row> <row> <entry>progressbar</entry> <entry>GTK_STYLE_CLASS_PROGRESSBAR</entry> <entry>#GtkProgressBar, #GtkCellRendererProgress</entry> </row> <row> <entry>slider</entry> <entry>GTK_STYLE_CLASS_SLIDER</entry> <entry>#GtkScrollbar, #GtkScale</entry> </row> <row> <entry>menuitem</entry> <entry>GTK_STYLE_CLASS_MENUITEM</entry> <entry>#GtkMenuItem</entry> </row> <row> <entry>popup</entry> <entry></entry> <entry>#GtkMenu</entry> </row> <row> <entry>accelerator</entry> <entry>GTK_STYLE_CLASS_ACCELERATOR</entry> <entry>#GtkAccelLabel</entry> </row> <row> <entry>menubar</entry> <entry>GTK_STYLE_CLASS_MENUBAR</entry> <entry>#GtkMenuBar</entry> </row> <row> <entry>toolbar</entry> <entry>GTK_STYLE_CLASS_TOOLBAR</entry> <entry>#GtkToolbar</entry> </row> <row> <entry>dock</entry> <entry>GTK_STYLE_CLASS_DOCK</entry> <entry>#GtkHandleBox</entry> </row> <row> <entry>notebook</entry> <entry></entry> <entry>#GtkNotebook</entry> </row> <row> <entry>background</entry> <entry>GTK_STYLE_CLASS_BACKGROUND</entry> <entry>#GtkWindow</entry> </row> <row> <entry>rubberband</entry> <entry>GTK_STYLE_CLASS_RUBBERBAND</entry> <entry></entry> </row> <row> <entry>header</entry> <entry>GTK_STYLE_CLASS_HEADER</entry> <entry></entry> </row> <row> <entry>grip</entry> <entry>GTK_STYLE_CLASS_GRIP</entry> <entry>#GtkWindow</entry> </row> <row> <entry>spinner</entry> <entry>GTK_STYLE_CLASS_SPINNER</entry> <entry>#GtkSpinner</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Widgets can also add regions with flags to their context. The regions used by GTK+ widgets are: <informaltable> <tgroup cols="4"> <thead> <row> <entry>Region</entry> <entry>Flags</entry> <entry>Macro</entry> <entry>Used by</entry> </row> </thead> <tbody> <row> <entry>row</entry> <entry>even, odd</entry> <entry>GTK_STYLE_REGION_ROW</entry> <entry>#GtkTreeView</entry> </row> <row> <entry>column</entry> <entry>first, last, sorted</entry> <entry>GTK_STYLE_REGION_COLUMN</entry> <entry>#GtkTreeView</entry> </row> <row> <entry>column-header</entry> <entry></entry> <entry>GTK_STYLE_REGION_COLUMN_HEADER</entry> <entry></entry> </row> <row> <entry>tab</entry> <entry>even, odd, first, last</entry> <entry>GTK_STYLE_REGION_TAB</entry> <entry>#GtkNotebook</entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect2> <refsect2 id="gtkstylecontext-custom-styling"> <title>Custom styling in UI libraries and applications</title> <para> If you are developing a library with custom #GtkWidget<!-- -->s that render differently than standard components, you may need to add a #GtkStyleProvider yourself with the %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority, either a #GtkCssProvider or a custom object implementing the #GtkStyleProvider interface. This way theming engines may still attempt to style your UI elements in a different way if needed so. </para> <para> If you are using custom styling on an applications, you probably want then to make your style information prevail to the theme's, so you must use a #GtkStyleProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority, keep in mind that the user settings in <filename><replaceable>XDG_CONFIG_HOME</replaceable>/gtk-3.0/gtk.css</filename> will still take precedence over your changes, as it uses the %GTK_STYLE_PROVIDER_PRIORITY_USER priority. </para> <para> If a custom theming engine is needed, you probably want to implement a #GtkStyleProvider yourself so it points to your #GtkThemingEngine implementation, as #GtkCssProvider uses gtk_theming_engine_load() which loads the theming engine module from the standard paths. </para> </refsect2>

Properties

Gtk.TextDirection"direction"read/write

Gdk.Screen"screen"read/write

Signals

void"changed"(self, style_context)

Methods

voidadd_class(class_name)

voidadd_provider(provider, priority)

voidadd_provider_for_screen(screen, provider, priority)(static method)

voidadd_region(region_name, flags)

voidcancel_animations(region_id)

voidchanged()

void, Gdk.RGBAget_background_color(state)

void, Gtk.Borderget_border(state)

void, Gdk.RGBAget_border_color(state)

void, Gdk.RGBAget_color(state)

Gtk.TextDirectionget_direction()

Pango.FontDescriptionget_font(state)

Gtk.JunctionSidesget_junction_sides()

void, Gtk.Borderget_margin(state)

void, Gtk.Borderget_padding(state)

Gtk.WidgetPathget_path()

void, GObject.Valueget_property(property, state)

Gdk.Screenget_screen()

Gtk.StateFlagsget_state()

voidget_style_property(property_name, value)

boolhas_class(class_name)

bool, Gtk.RegionFlagshas_region(region_name)

voidinvalidate()

GLib.Listlist_classes()

GLib.Listlist_regions()

bool, Gdk.RGBAlookup_color(color_name)

Gtk.IconSetlookup_icon_set(stock_id)

voidnotify_state_change(window, region_id, state, state_value)

voidpop_animatable_region()

voidpush_animatable_region(region_id)

voidremove_class(class_name)

voidremove_provider(provider)

voidremove_provider_for_screen(screen, provider)(static method)

voidremove_region(region_name)

voidreset_widgets(screen)(static method)

voidrestore()

voidsave()

voidscroll_animations(window, dx, dy)

voidset_background(window)

voidset_direction(direction)

voidset_junction_sides(sides)

voidset_path(path)

voidset_screen(screen)

voidset_state(flags)

bool, floatstate_is_running(state)

Class: Gtk.StyleProperties

Implements: Gtk.StyleProvider

Subclass of: GObject.Object

GtkStyleProperties provides the storage for style information that is used by #GtkStyleContext and other #GtkStyleProvider implementations. Before style properties can be stored in GtkStyleProperties, they must be registered with gtk_style_properties_register_property(). Unless you are writing a #GtkStyleProvider implementation, you are unlikely to use this API directly, as gtk_style_context_get() and its variants are the preferred way to access styling information from widget implementations and theming engine implementations should use the APIs provided by #GtkThemingEngine instead.

Methods

voidclear()

bool, GObject.Valueget_property(property, state)

Gtk.SymbolicColorlookup_color(name)

voidmap_color(name, color)

voidmerge(props_to_merge, replace)

voidset_property(property, state, value)

voidunset_property(property, state)

Interface: Gtk.StyleProvider

Classes implementing Gtk.StyleProvider: Gtk.CssProvider, Gtk.StyleProperties, Gtk.Settings

GtkStyleProvider is an interface used to provide style information to a #GtkStyleContext. See gtk_style_context_add_provider() and gtk_style_context_add_provider_for_screen().

Methods

Gtk.IconFactoryget_icon_factory(path)

bool, GObject.Valueget_style_property(path, state, pspec)

Class: Gtk.Switch

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Widget

#GtkSwitch is a widget that has two states: on or off. The user can control which state should be active by clicking the empty area, or by dragging the handle.

Properties

bool"active"read/write

Whether the #GtkSwitch widget is in its on or off state.

Signals

void"activate"(self, switch)

The ::activate signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.

Methods

voidactivate()

boolget_active()

voidset_active(is_active)

Class: Gtk.Table

Implements: Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

Properties

bool"homogeneous"read/write

int"row-spacing"read/write

int"column-spacing"read/write

int"n-columns"read/write

int"n-rows"read/write

Methods

voidattach(child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)

voidattach_defaults(widget, left_attach, right_attach, top_attach, bottom_attach)

intget_col_spacing(column)

intget_default_col_spacing()

intget_default_row_spacing()

boolget_homogeneous()

intget_row_spacing(row)

void, int, intget_size()

voidresize(rows, columns)

voidset_col_spacing(column, spacing)

voidset_col_spacings(spacing)

voidset_homogeneous(homogeneous)

voidset_row_spacing(row, spacing)

voidset_row_spacings(spacing)

Class: Gtk.TearoffMenuItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.MenuItem

Class: Gtk.TextBuffer

Subclass of: GObject.Object

Properties

bool"has-selection"read-only

Whether the buffer has some text currently selected.

int"cursor-position"read-only

The position of the insert mark (as offset from the beginning of the buffer). It is useful for getting notified when the cursor moves.

Gtk.TextTagTable"tag-table"construct-only

Gtk.TargetList"copy-target-list"read-only

The list of targets this buffer supports for clipboard copying and as DND source.

Gtk.TargetList"paste-target-list"read-only

The list of targets this buffer supports for clipboard pasting and as DND destination.

string"text"read/write

The text content of the buffer. Without child widgets and images, see gtk_text_buffer_get_text() for more information.

Signals

void"begin-user-action"(self, text_buffer)

The ::begin-user-action signal is emitted at the beginning of a single user-visible operation on a #GtkTextBuffer. gtk_text_buffer_begin_user_action(), gtk_text_buffer_insert_interactive(), gtk_text_buffer_insert_range_interactive(), gtk_text_buffer_delete_interactive(), gtk_text_buffer_backspace(), gtk_text_buffer_delete_selection().

void"delete-range"(self, text_buffer, start, end)

The ::delete-range signal is emitted to delete a range from a #GtkTextBuffer. Note that if your handler runs before the default handler it must not invalidate the @start and @end iters (or has to revalidate them). The default signal handler revalidates the @start and @end iters to both point point to the location where text was deleted. Handlers which run after the default handler (see g_signal_connect_after()) do not have access to the deleted text.

void"changed"(self, text_buffer)

The ::changed signal is emitted when the content of a #GtkTextBuffer has changed.

void"remove-tag"(self, text_buffer, tag, start, end)

The ::remove-tag signal is emitted to remove all occurrences of @tag from a range of text in a #GtkTextBuffer. Removal actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the @start and @end iters (or has to revalidate them). gtk_text_buffer_remove_tag().

void"insert-pixbuf"(self, text_buffer, location, pixbuf)

The ::insert-pixbuf signal is emitted to insert a #GdkPixbuf in a #GtkTextBuffer. Insertion actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the @location iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted @pixbuf.

void"paste-done"(self, text_buffer, since)

The paste-done signal is emitted after paste operation has been completed. This is useful to properly scroll the view to the end of the pasted text. See gtk_text_buffer_paste_clipboard() for more details.

void"modified-changed"(self, text_buffer)

The ::modified-changed signal is emitted when the modified bit of a #GtkTextBuffer flips. See also: gtk_text_buffer_set_modified().

void"mark-deleted"(self, text_buffer, mark)

The ::mark-deleted signal is emitted as notification after a #GtkTextMark is deleted. See also: gtk_text_buffer_delete_mark().

void"apply-tag"(self, text_buffer, tag, start, end)

The ::apply-tag signal is emitted to apply a tag to a range of text in a #GtkTextBuffer. Applying actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the @start and @end iters (or has to revalidate them). gtk_text_buffer_apply_tag(), gtk_text_buffer_insert_with_tags(), gtk_text_buffer_insert_range().

void"insert-child-anchor"(self, text_buffer, location, anchor)

The ::insert-child-anchor signal is emitted to insert a #GtkTextChildAnchor in a #GtkTextBuffer. Insertion actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the @location iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted @anchor.

void"mark-set"(self, text_buffer, location, mark)

The ::mark-set signal is emitted as notification after a #GtkTextMark is set. gtk_text_buffer_create_mark(), gtk_text_buffer_move_mark().

void"insert-text"(self, text_buffer, location, text, len)

The ::insert-text signal is emitted to insert text in a #GtkTextBuffer. Insertion actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the @location iter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text. gtk_text_buffer_insert(), gtk_text_buffer_insert_range().

void"end-user-action"(self, text_buffer)

The ::end-user-action signal is emitted at the end of a single user-visible operation on the #GtkTextBuffer. gtk_text_buffer_end_user_action(), gtk_text_buffer_insert_interactive(), gtk_text_buffer_insert_range_interactive(), gtk_text_buffer_delete_interactive(), gtk_text_buffer_backspace(), gtk_text_buffer_delete_selection(), gtk_text_buffer_backspace().

Methods

voidadd_mark(mark, where)

voidadd_selection_clipboard(clipboard)

voidapply_tag(tag, start, end)

voidapply_tag_by_name(name, start, end)

boolbackspace(iter, interactive, default_editable)

voidbegin_user_action()

voidchanged()

voidcopy_clipboard(clipboard)

Gtk.TextChildAnchorcreate_child_anchor(iter)

Gtk.TextMarkcreate_mark(mark_name, where, left_gravity)

voidcut_clipboard(clipboard, default_editable)

voiddelete(start, end)

booldelete_interactive(start_iter, end_iter, default_editable)

voiddelete_mark(mark)

voiddelete_mark_by_name(name)

voiddelete_range(start, end)

booldelete_selection(interactive, default_editable)

booldeserialize(content_buffer, format, iter, data, length)

booldeserialize_get_can_create_tags(format)

voiddeserialize_set_can_create_tags(format, can_create_tags)

voidend_user_action()

void, Gtk.TextIter, Gtk.TextIterget_bounds()

intget_char_count()

Gtk.TargetListget_copy_target_list()

Array, intget_deserialize_formats()

void, Gtk.TextIterget_end_iter()

boolget_has_selection()

Gtk.TextMarkget_insert()

void, Gtk.TextIterget_iter_at_child_anchor(anchor)

void, Gtk.TextIterget_iter_at_line(line_number)

void, Gtk.TextIterget_iter_at_line_index(line_number, byte_index)

void, Gtk.TextIterget_iter_at_line_offset(line_number, char_offset)

void, Gtk.TextIterget_iter_at_mark(mark)

void, Gtk.TextIterget_iter_at_offset(char_offset)

intget_line_count()

Gtk.TextMarkget_mark(name)

boolget_modified()

Gtk.TargetListget_paste_target_list()

Gtk.TextMarkget_selection_bound()

bool, Gtk.TextIter, Gtk.TextIterget_selection_bounds()

Array, intget_serialize_formats()

stringget_slice(start, end, include_hidden_chars)

void, Gtk.TextIterget_start_iter()

Gtk.TextTagTableget_tag_table()

stringget_text(start, end, include_hidden_chars)

voidinsert(iter, text, len)

voidinsert_at_cursor(text, len)

voidinsert_child_anchor(iter, anchor)

boolinsert_interactive(iter, text, len, default_editable)

boolinsert_interactive_at_cursor(text, len, default_editable)

voidinsert_pixbuf(iter, pixbuf)

voidinsert_range(iter, start, end)

boolinsert_range_interactive(iter, start, end, default_editable)

voidinsert_text(pos, new_text, new_text_length)

voidmark_deleted(mark)

voidmark_set(location, mark)

voidmodified_changed()

voidmove_mark(mark, where)

voidmove_mark_by_name(name, where)

voidpaste_clipboard(clipboard, override_location, default_editable)

voidpaste_done(clipboard)

voidplace_cursor(where)

Gdk.Atomregister_deserialize_format(mime_type, function, user_data, user_data_destroy)

Gdk.Atomregister_deserialize_tagset(tagset_name)

Gdk.Atomregister_serialize_format(mime_type, function, user_data, user_data_destroy)

Gdk.Atomregister_serialize_tagset(tagset_name)

voidremove_all_tags(start, end)

voidremove_selection_clipboard(clipboard)

voidremove_tag(tag, start, end)

voidremove_tag_by_name(name, start, end)

voidselect_range(ins, bound)

Array, Gtk.gsizeserialize(content_buffer, format, start, end)

voidset_modified(setting)

voidset_text(text, len)

voidunregister_deserialize_format(format)

voidunregister_serialize_format(format)

Class: Gtk.TextChildAnchor

Subclass of: GObject.Object

A #GtkTextChildAnchor is a spot in the buffer where child widgets can be "anchored" (inserted inline, as if they were characters). The anchor can have multiple widgets anchored, to allow for multiple views.

Methods

boolget_deleted()

GLib.Listget_widgets()

Class: Gtk.TextMark

Subclass of: GObject.Object

Properties

bool"left-gravity"construct-only

string"name"construct-only

Methods

Gtk.TextBufferget_buffer()

boolget_deleted()

boolget_left_gravity()

stringget_name()

boolget_visible()

voidset_visible(setting)

Class: Gtk.TextTag

Subclass of: GObject.Object

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.

Properties

float"size-points"read/write

int"pixels-above-lines"read/write

string"family"read/write

int"pixels-inside-wrap"read/write

bool"rise-set"read/write

bool"strikethrough"read/write

bool"tabs-set"read/write

Gtk.WrapMode"wrap-mode"read/write

bool"underline-set"read/write

bool"background-full-height-set"read/write

bool"foreground-set"read/write

string"font"read/write

Font description as string, e.g. \"Sans Italic 12\". Note that the initial value of this property depends on the internals of #PangoFontDescription.

Gdk.Color"paragraph-background-gdk"read/write

The paragraph background color as a as a (possibly unallocated) #GdkColor.

Pango.Underline"underline"read/write

bool"left-margin-set"read/write

int"size"read/write

bool"justification-set"read/write

Pango.FontDescription"font-desc"read/write

float"scale"read/write

Gdk.Color"background-gdk"read/write

Pango.Stretch"stretch"read/write

bool"pixels-inside-wrap-set"read/write

bool"indent-set"read/write

bool"size-set"read/write

bool"right-margin-set"read/write

bool"pixels-above-lines-set"read/write

Pango.TabArray"tabs"read/write

bool"background-full-height"read/write

bool"accumulative-margin"read/write

Whether the margins accumulate or override each other. When set to %TRUE the margins of this tag are added to the margins of any other non-accumulative margins present. When set to %FALSE the margins override one another (the default).

bool"variant-set"read/write

bool"background-set"read/write

string"foreground"read/write

Gtk.TextDirection"direction"read/write

Gtk.Justification"justification"read/write

int"weight"read/write

bool"editable-set"read/write

Pango.Variant"variant"read/write

string"paragraph-background"read/write

The paragraph background color as a string.

bool"editable"read/write

Pango.Style"style"read/write

bool"style-set"read/write

bool"strikethrough-set"read/write

int"rise"read/write

bool"family-set"read/write

string"background"read/write

bool"invisible"read/write

Whether this text is hidden. Note that there may still be problems with the support for invisible text, in particular when navigating programmatically inside a buffer containing invisible segments.

bool"paragraph-background-set"read/write

bool"language-set"read/write

int"left-margin"read/write

Gdk.Color"foreground-gdk"read/write

bool"invisible-set"read/write

int"indent"read/write

string"name"construct-only

string"language"read/write

The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If not set, an appropriate default will be used. Note that the initial value of this property depends on the current locale, see also gtk_get_default_language().

int"pixels-below-lines"read/write

bool"stretch-set"read/write

int"right-margin"read/write

bool"scale-set"read/write

bool"pixels-below-lines-set"read/write

bool"wrap-mode-set"read/write

bool"weight-set"read/write

Signals

bool"event"(self, text_tag, object, event, iter)

The ::event signal is emitted when an event occurs on a region of the buffer marked with this tag. event. %FALSE to propagate the event further.

Methods

boolevent(event_object, event, iter)

intget_priority()

voidset_priority(priority)

Class: Gtk.TextTagTable

Implements: Gtk.Buildable

Subclass of: GObject.Object

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. <refsect2 id="GtkTextTagTable-BUILDER-UI"> <title>GtkTextTagTables as GtkBuildable</title> <para> The GtkTextTagTable implementation of the GtkBuildable interface supports adding tags by specifying "tag" as the "type" attribute of a &lt;child&gt; element. <example> <title>A UI definition fragment specifying tags</title> <programlisting><![CDATA[ <object class="GtkTextTagTable"> <child type="tag"> <object class="GtkTextTag"/> </child> </object> ]]></programlisting> </example> </para> </refsect2>

Signals

void"tag-added"(self, text_tag_table, tag)

void"tag-removed"(self, text_tag_table, tag)

void"tag-changed"(self, text_tag_table, tag, size_changed)

Methods

voidadd(tag)

voidforeach(func, data)

intget_size()

Gtk.TextTaglookup(name)

voidremove(tag)

voidtag_added(tag)

voidtag_changed(tag, size_changed)

voidtag_removed(tag)

Class: Gtk.TextView

Implements: Gtk.Scrollable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

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.

Properties

Gtk.Justification"justification"read/write

int"indent"read/write

int"left-margin"read/write

int"pixels-below-lines"read/write

Gtk.TextBuffer"buffer"read/write

int"pixels-above-lines"read/write

bool"editable"read/write

int"right-margin"read/write

int"pixels-inside-wrap"read/write

Pango.TabArray"tabs"read/write

bool"overwrite"read/write

bool"accepts-tab"read/write

bool"cursor-visible"read/write

string"im-module"read/write

Which IM (input method) module should be used for this entry. See #GtkIMContext. Setting this to a non-%NULL value overrides the system-wide IM module setting. See the GtkSettings #GtkSettings:gtk-im-module property.

Gtk.WrapMode"wrap-mode"read/write

Signals

void"set-anchor"(self, text_view)

The ::set-anchor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates setting the "anchor" mark. The "anchor" mark gets placed at the same position as the "insert" mark. This signal has no default bindings.

void"paste-clipboard"(self, text_view)

The ::paste-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to paste the contents of the clipboard into the text view. The default bindings for this signal are Ctrl-v and Shift-Insert.

void"copy-clipboard"(self, text_view)

The ::copy-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to copy the selection to the clipboard. The default bindings for this signal are Ctrl-c and Ctrl-Insert.

void"insert-at-cursor"(self, text_view, string)

The ::insert-at-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates the insertion of a fixed string at the cursor. This signal has no default bindings.

void"toggle-cursor-visible"(self, text_view)

The ::toggle-cursor-visible signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to toggle the visibility of the cursor. The default binding for this signal is F7.

void"cut-clipboard"(self, text_view)

The ::cut-clipboard signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to cut the selection to the clipboard. The default bindings for this signal are Ctrl-x and Shift-Delete.

void"delete-from-cursor"(self, text_view, type, count)

The ::delete-from-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates a text deletion. If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters. The default bindings for this signal are Delete for deleting a character, Ctrl-Delete for deleting a word and Ctrl-Backspace for deleting a word backwords.

void"populate-popup"(self, text_view, menu)

The ::populate-popup signal gets emitted before showing the context menu of the text view. If you need to add items to the context menu, connect to this signal and append your menuitems to the @menu.

void"preedit-changed"(self, text_view, preedit)

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal. This signal is only emitted if the text at the given position is actually editable.

void"backspace"(self, text_view)

The ::backspace signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user asks for it. The default bindings for this signal are Backspace and Shift-Backspace.

void"toggle-overwrite"(self, text_view)

The ::toggle-overwrite signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to toggle the overwrite mode of the text view. The default bindings for this signal is Insert.

void"select-all"(self, text_view, select)

The ::select-all signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted to select or unselect the complete contents of the text view. The default bindings for this signal are Ctrl-a and Ctrl-/ for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.

void"move-viewport"(self, text_view, step, count)

The ::move-viewport signal is a <link linkend="keybinding-signals">keybinding signal</link> which can be bound to key combinations to allow the user to move the viewport, i.e. change what part of the text view is visible in a containing scrolled window. There are no default bindings for this signal.

void"move-cursor"(self, text_view, step, count, extend_selection)

The ::move-cursor signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user initiates a cursor movement. If the cursor is not visible in @text_view, this signal causes the viewport to be moved instead. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically. The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here. <itemizedlist> <listitem>Arrow keys move by individual characters/lines</listitem> <listitem>Ctrl-arrow key combinations move by words/paragraphs</listitem> <listitem>Home/End keys move to the ends of the buffer</listitem> <listitem>PageUp/PageDown keys move vertically by pages</listitem> <listitem>Ctrl-PageUp/PageDown keys move horizontally by pages</listitem> </itemizedlist>

Methods

voidadd_child_at_anchor(child, anchor)

voidadd_child_in_window(child, which_window, xpos, ypos)

voidbackspace()

boolbackward_display_line(iter)

boolbackward_display_line_start(iter)

void, int, intbuffer_to_window_coords(win, buffer_x, buffer_y)

voidcopy_clipboard()

voidcut_clipboard()

voiddelete_from_cursor(type, count)

boolforward_display_line(iter)

boolforward_display_line_end(iter)

boolget_accepts_tab()

intget_border_window_size(type)

Gtk.TextBufferget_buffer()

void, Gdk.Rectangle, Gdk.Rectangleget_cursor_locations(iter)

boolget_cursor_visible()

Gtk.TextAttributesget_default_attributes()

boolget_editable()

Gtk.Adjustmentget_hadjustment()

intget_indent()

void, Gtk.TextIterget_iter_at_location(x, y)

void, Gtk.TextIter, intget_iter_at_position(x, y)

void, Gdk.Rectangleget_iter_location(iter)

Gtk.Justificationget_justification()

intget_left_margin()

void, Gtk.TextIter, intget_line_at_y(y)

void, int, intget_line_yrange(iter)

boolget_overwrite()

intget_pixels_above_lines()

intget_pixels_below_lines()

intget_pixels_inside_wrap()

intget_right_margin()

Pango.TabArrayget_tabs()

Gtk.Adjustmentget_vadjustment()

void, Gdk.Rectangleget_visible_rect()

Gdk.Windowget_window(win)

Gtk.TextWindowTypeget_window_type(window)

Gtk.WrapModeget_wrap_mode()

boolim_context_filter_keypress(event)

voidinsert_at_cursor(str)

voidmove_child(child, xpos, ypos)

voidmove_cursor(step, count, extend_selection)

boolmove_mark_onscreen(mark)

boolmove_visually(iter, count)

voidpaste_clipboard()

boolplace_cursor_onscreen()

voidpopulate_popup(menu)

voidreset_im_context()

voidscroll_mark_onscreen(mark)

boolscroll_to_iter(iter, within_margin, use_align, xalign, yalign)

voidscroll_to_mark(mark, within_margin, use_align, xalign, yalign)

voidset_accepts_tab(accepts_tab)

voidset_anchor()

voidset_border_window_size(type, size)

voidset_buffer(buffer)

voidset_cursor_visible(setting)

voidset_editable(setting)

voidset_indent(indent)

voidset_justification(justification)

voidset_left_margin(left_margin)

voidset_overwrite(overwrite)

voidset_pixels_above_lines(pixels_above_lines)

voidset_pixels_below_lines(pixels_below_lines)

voidset_pixels_inside_wrap(pixels_inside_wrap)

voidset_right_margin(right_margin)

voidset_tabs(tabs)

voidset_wrap_mode(wrap_mode)

boolstarts_display_line(iter)

voidtoggle_overwrite()

void, int, intwindow_to_buffer_coords(win, window_x, window_y)

Class: Gtk.ThemingEngine

Subclass of: GObject.Object

#GtkThemingEngine is the object used for rendering themed content in GTK+ widgets. Even though GTK+ has a default implementation, it can be overridden in CSS files by enforcing a #GtkThemingEngine object to be loaded as a module. In order to implement a theming engine, a #GtkThemingEngine subclass must be created, alongside the CSS file that will reference it, the theming engine would be created as an .so library, and installed in $(gtk-modules-dir)/theming-engines/. #GtkThemingEngine<!-- -->s have limited access to the object they are rendering, the #GtkThemingEngine API has read-only accessors to the style information contained in the rendered object's #GtkStyleContext.

Properties

string"name"construct-only

The theming engine name, this name will be used when registering custom properties, for a theming engine named "Clearlooks" registering a "glossy" custom property, it could be referenced in the CSS file as <programlisting> -Clearlooks-glossy: true; </programlisting>

Methods

void, Gdk.RGBAget_background_color(state)

void, Gtk.Borderget_border(state)

void, Gdk.RGBAget_border_color(state)

void, Gdk.RGBAget_color(state)

Gtk.TextDirectionget_direction()

Pango.FontDescriptionget_font(state)

Gtk.JunctionSidesget_junction_sides()

void, Gtk.Borderget_margin(state)

void, Gtk.Borderget_padding(state)

Gtk.WidgetPathget_path()

void, GObject.Valueget_property(property, state)

Gdk.Screenget_screen()

Gtk.StateFlagsget_state()

voidget_style_property(property_name, value)

boolhas_class(style_class)

bool, Gtk.RegionFlagshas_region(style_region)

Gtk.ThemingEngineload(name)(static method)

bool, Gdk.RGBAlookup_color(color_name)

voidrender_activity(cr, x, y, width, height)

voidrender_arrow(cr, angle, x, y, size)

voidrender_background(cr, x, y, width, height)

voidrender_check(cr, x, y, width, height)

voidrender_expander(cr, x, y, width, height)

voidrender_extension(cr, x, y, width, height, gap_side)

voidrender_focus(cr, x, y, width, height)

voidrender_frame(cr, x, y, width, height)

voidrender_frame_gap(cr, x, y, width, height, gap_side, xy0_gap, xy1_gap)

voidrender_handle(cr, x, y, width, height)

voidrender_layout(cr, x, y, layout)

voidrender_line(cr, x0, y0, x1, y1)

voidrender_option(cr, x, y, width, height)

voidrender_slider(cr, x, y, width, height, orientation)

bool, floatstate_is_running(state)

Class: Gtk.ToggleAction

Implements: Gtk.Buildable

Known subclasses: Gtk.RadioAction

Subclass of: Gtk.Action

A #GtkToggleAction corresponds roughly to a #GtkCheckMenuItem. It has an "active" state specifying whether the action has been checked or not.

Properties

bool"active"read/write

Whether the toggle action should be active.

bool"draw-as-radio"read/write

Whether the proxies for this action look like radio action proxies. This is an appearance property and thus only applies if #GtkActivatable:use-action-appearance is %TRUE.

Signals

void"toggled"(self, toggle_action)

Should be connected if you wish to perform an action whenever the #GtkToggleAction state is changed.

Methods

boolget_active()

boolget_draw_as_radio()

voidset_active(is_active)

voidset_draw_as_radio(draw_as_radio)

voidtoggled()

Class: Gtk.ToggleButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.CheckButton

Subclass of: Gtk.Button

Properties

bool"active"read/write

bool"draw-indicator"read/write

bool"inconsistent"read/write

Signals

void"toggled"(self, toggle_button)

Methods

boolget_active()

boolget_inconsistent()

boolget_mode()

voidset_active(is_active)

voidset_inconsistent(setting)

voidset_mode(draw_indicator)

voidtoggled()

Class: Gtk.ToggleToolButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.RadioToolButton

Subclass of: Gtk.ToolButton

Properties

bool"active"read/write

If the toggle tool button should be pressed in.

Signals

void"toggled"(self, toggle_tool_button)

Emitted whenever the toggle tool button changes state.

Methods

boolget_active()

voidset_active(is_active)

voidtoggled()

Class: Gtk.ToolButton

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.ToggleToolButton, Gtk.MenuToolButton

Subclass of: Gtk.ToolItem

Properties

string"icon-name"read/write

The name of the themed icon displayed on the item. This property only has an effect if not overridden by "label", "icon_widget" or "stock_id" properties.

bool"use-underline"read/write

string"stock-id"read/write

string"label"read/write

Gtk.Widget"icon-widget"read/write

Gtk.Widget"label-widget"read/write

Signals

void"clicked"(self, tool_button)

This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.

Methods

voidclicked()

stringget_icon_name()

Gtk.Widgetget_icon_widget()

stringget_label()

Gtk.Widgetget_label_widget()

stringget_stock_id()

boolget_use_underline()

voidset_icon_name(icon_name)

voidset_icon_widget(icon_widget)

voidset_label(label)

voidset_label_widget(label_widget)

voidset_stock_id(stock_id)

voidset_use_underline(use_underline)

Class: Gtk.ToolItem

Implements: Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.ToolButton, Gtk.SeparatorToolItem

Subclass of: Gtk.Bin

#GtkToolItem<!-- -->s are widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, use gtk_tool_item_new(). Use gtk_container_add() to add a child widget to the tool item. For toolbar items that contain buttons, see the #GtkToolButton, #GtkToggleToolButton and #GtkRadioToolButton classes. See the #GtkToolbar class for a description of the toolbar widget, and #GtkToolShell for a description of the tool shell interface.

Properties

bool"is-important"read/write

bool"visible-vertical"read/write

bool"visible-horizontal"read/write

Signals

void"toolbar-reconfigured"(self, tool_item)

This signal is emitted when some property of the toolbar that the item is a child of changes. For custom subclasses of #GtkToolItem, the default handler of this signal use the functions <itemizedlist> <listitem>gtk_tool_shell_get_orientation()</listitem> <listitem>gtk_tool_shell_get_style()</listitem> <listitem>gtk_tool_shell_get_icon_size()</listitem> <listitem>gtk_tool_shell_get_relief_style()</listitem> </itemizedlist> to find out what the toolbar should look like and change themselves accordingly.

bool"create-menu-proxy"(self, tool_item)

This signal is emitted when the toolbar needs information from @tool_item about whether the item should appear in the toolbar overflow menu. In response the tool item should either <itemizedlist> <listitem>call gtk_tool_item_set_proxy_menu_item() with a %NULL pointer and return %TRUE to indicate that the item should not appear in the overflow menu </listitem> <listitem> call gtk_tool_item_set_proxy_menu_item() with a new menu item and return %TRUE, or </listitem> <listitem> return %FALSE to indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item. </listitem> </itemizedlist> The toolbar may cache the result of this signal. When the tool item changes how it will respond to this signal it must call gtk_tool_item_rebuild_menu() to invalidate the cache and ensure that the toolbar rebuilds its overflow menu.

Methods

boolcreate_menu_proxy()

Pango.EllipsizeModeget_ellipsize_mode()

boolget_expand()

boolget_homogeneous()

intget_icon_size()

boolget_is_important()

Gtk.Orientationget_orientation()

Gtk.Widgetget_proxy_menu_item(menu_item_id)

Gtk.ReliefStyleget_relief_style()

floatget_text_alignment()

Gtk.Orientationget_text_orientation()

Gtk.SizeGroupget_text_size_group()

Gtk.ToolbarStyleget_toolbar_style()

boolget_use_drag_window()

boolget_visible_horizontal()

boolget_visible_vertical()

voidrebuild_menu()

Gtk.Widgetretrieve_proxy_menu_item()

voidset_expand(expand)

voidset_homogeneous(homogeneous)

voidset_is_important(is_important)

voidset_proxy_menu_item(menu_item_id, menu_item)

voidset_tooltip_markup(markup)

voidset_tooltip_text(text)

voidset_use_drag_window(use_drag_window)

voidset_visible_horizontal(visible_horizontal)

voidset_visible_vertical(visible_vertical)

voidtoolbar_reconfigured()

Class: Gtk.ToolItemGroup

Implements: Gtk.Buildable, Gtk.ToolShell, Atk.ImplementorIface

Subclass of: Gtk.Container

A #GtkToolItemGroup is used together with #GtkToolPalette to add #GtkToolItem<!-- -->s to a palette like container with different categories and drag and drop support.

Properties

bool"collapsed"read/write

Gtk.Widget"label-widget"read/write

Pango.EllipsizeMode"ellipsize"read/write

Gtk.ReliefStyle"header-relief"read/write

string"label"read/write

Methods

boolget_collapsed()

Gtk.ToolItemget_drop_item(x, y)

Pango.EllipsizeModeget_ellipsize()

Gtk.ReliefStyleget_header_relief()

intget_item_position(item)

stringget_label()

Gtk.Widgetget_label_widget()

intget_n_items()

Gtk.ToolItemget_nth_item(index)

voidinsert(item, position)

voidset_collapsed(collapsed)

voidset_ellipsize(ellipsize)

voidset_header_relief(style)

voidset_item_position(item, position)

voidset_label(label)

voidset_label_widget(label_widget)

Class: Gtk.ToolPalette

Implements: Gtk.Scrollable, Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Container

A #GtkToolPalette allows you to add #GtkToolItem<!-- -->s to a palette-like container with different categories and drag and drop support. A #GtkToolPalette is created with a call to gtk_tool_palette_new(). #GtkToolItem<!-- -->s cannot be added directly to a #GtkToolPalette - instead they are added to a #GtkToolItemGroup which can than be added to a #GtkToolPalette. To add a #GtkToolItemGroup to a #GtkToolPalette, use gtk_container_add(). |[ GtkWidget *palette, *group; GtkToolItem *item; palette = gtk_tool_palette_new (); group = gtk_tool_item_group_new (_("Test Category")); gtk_container_add (GTK_CONTAINER (palette), group); item = gtk_tool_button_new_from_stock (GTK_STOCK_OK); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); ]| The easiest way to use drag and drop with #GtkToolPalette is to call gtk_tool_palette_add_drag_dest() with the desired drag source @palette and the desired drag target @widget. Then gtk_tool_palette_get_drag_item() can be used to get the dragged item in the #GtkWidget::drag-data-received signal handler of the drag target. |[ static void passive_canvas_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection, guint info, guint time, gpointer data) { GtkWidget *palette; GtkWidget *item; /<!-- -->* Get the dragged item *<!-- -->/ palette = gtk_widget_get_ancestor (gtk_drag_get_source_widget (context), GTK_TYPE_TOOL_PALETTE); if (palette != NULL) item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette), selection); /<!-- -->* Do something with item *<!-- -->/ } GtkWidget *target, palette; palette = gtk_tool_palette_new (); target = gtk_drawing_area_new (); g_signal_connect (G_OBJECT (target), "drag-data-received", G_CALLBACK (passive_canvas_drag_data_received), NULL); gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette), target, GTK_DEST_DEFAULT_ALL, GTK_TOOL_PALETTE_DRAG_ITEMS, GDK_ACTION_COPY); ]|

Properties

Gtk.ToolbarStyle"toolbar-style"read/write

The style of items in the tool palette.

bool"icon-size-set"read/write

Is %TRUE if the #GtkToolPalette:icon-size property has been set.

Gtk.IconSize"icon-size"read/write

The size of the icons in a tool palette is normally determined by the #GtkSettings:toolbar-icon-size setting. When this property is set, it overrides the setting. This should only be used for special-purpose tool palettes, normal application tool palettes should respect the user preferences for the size of icons.

Methods

voidadd_drag_dest(widget, flags, targets, actions)

Gtk.Widgetget_drag_item(selection)

Gtk.TargetEntryget_drag_target_group()(static method)

Gtk.TargetEntryget_drag_target_item()(static method)

Gtk.ToolItemGroupget_drop_group(x, y)

Gtk.ToolItemget_drop_item(x, y)

boolget_exclusive(group)

boolget_expand(group)

intget_group_position(group)

Gtk.Adjustmentget_hadjustment()

intget_icon_size()

Gtk.ToolbarStyleget_style()

Gtk.Adjustmentget_vadjustment()

voidset_drag_source(targets)

voidset_exclusive(group, exclusive)

voidset_expand(group, expand)

voidset_group_position(group, position)

voidset_icon_size(icon_size)

voidset_style(style)

voidunset_icon_size()

voidunset_style()

Interface: Gtk.ToolShell

Classes implementing Gtk.ToolShell: Gtk.Toolbar, Gtk.ToolItemGroup

The #GtkToolShell interface allows container widgets to provide additional information when embedding #GtkToolItem widgets.

Methods

Pango.EllipsizeModeget_ellipsize_mode()

Gtk.IconSizeget_icon_size()

Gtk.Orientationget_orientation()

Gtk.ReliefStyleget_relief_style()

Gtk.ToolbarStyleget_style()

floatget_text_alignment()

Gtk.Orientationget_text_orientation()

Gtk.SizeGroupget_text_size_group()

voidrebuild_menu()

Class: Gtk.Toolbar

Implements: Gtk.Buildable, Gtk.ToolShell, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Container

A toolbar is created with a call to gtk_toolbar_new(). A toolbar can contain instances of a subclass of #GtkToolItem. To add a #GtkToolItem to the a toolbar, use gtk_toolbar_insert(). To remove an item from the toolbar use gtk_container_remove(). To add a button to the toolbar, add an instance of #GtkToolButton. Toolbar items can be visually grouped by adding instances of #GtkSeparatorToolItem to the toolbar. If the GtkToolbar child property "expand" is #TRUE and the property #GtkSeparatorToolItem:draw is set to #FALSE, the effect is to force all following items to the end of the toolbar. Creating a context menu for the toolbar can be done by connecting to the #GtkToolbar::popup-context-menu signal.

Properties

Gtk.ToolbarStyle"toolbar-style"read/write

bool"icon-size-set"read/write

Is %TRUE if the icon-size property has been set.

int"icon-size"read/write

The size of the icons in a toolbar is normally determined by the toolbar-icon-size setting. When this property is set, it overrides the setting. This should only be used for special-purpose toolbars, normal application toolbars should respect the user preferences for the size of icons.

bool"show-arrow"read/write

Signals

void"style-changed"(self, toolbar, style)

Emitted when the style of the toolbar changes.

void"orientation-changed"(self, toolbar, orientation)

Emitted when the orientation of the toolbar changes.

bool"popup-context-menu"(self, toolbar, x, y, button)

Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu. Application developers should handle this signal if they want to display a context menu on the toolbar. The context-menu should appear at the coordinates given by @x and @y. The mouse button number is given by the @button parameter. If the menu was popped up using the keybaord, @button is -1.

bool"focus-home-or-end"(self, toolbar, focus_home)

A keybinding signal used internally by GTK+. This signal can't be used in application code

Methods

intget_drop_index(x, y)

intget_icon_size()

intget_item_index(item)

intget_n_items()

Gtk.ToolItemget_nth_item(n)

Gtk.ReliefStyleget_relief_style()

boolget_show_arrow()

Gtk.ToolbarStyleget_style()

voidinsert(item, pos)

voidorientation_changed(orientation)

boolpopup_context_menu(x, y, button_number)

voidset_drop_highlight_item(tool_item, index_)

voidset_icon_size(icon_size)

voidset_show_arrow(show_arrow)

voidset_style(style)

voidstyle_changed(style)

voidunset_icon_size()

voidunset_style()

Class: Gtk.Tooltip

Subclass of: GObject.Object

Basic tooltips can be realized simply by using gtk_widget_set_tooltip_text() or gtk_widget_set_tooltip_markup() without any explicit tooltip object. When you need a tooltip with a little more fancy contents, like adding an image, or you want the tooltip to have different contents per #GtkTreeView row or cell, you will have to do a little more work: <itemizedlist> <listitem> <para> Set the #GtkWidget:has-tooltip property to %TRUE, this will make GTK+ monitor the widget for motion and related events which are needed to determine when and where to show a tooltip. </para> </listitem> <listitem> <para> Connect to the #GtkWidget::query-tooltip signal. This signal will be emitted when a tooltip is supposed to be shown. One of the arguments passed to the signal handler is a GtkTooltip object. This is the object that we are about to display as a tooltip, and can be manipulated in your callback using functions like gtk_tooltip_set_icon(). There are functions for setting the tooltip's markup, setting an image from a stock icon, or even putting in a custom widget. </para> </listitem> <listitem> <para> Return %TRUE from your query-tooltip handler. This causes the tooltip to be show. If you return %FALSE, it will not be shown. </para> </listitem> </itemizedlist> In the probably rare case where you want to have even more control over the tooltip that is about to be shown, you can set your own #GtkWindow which will be used as tooltip window. This works as follows: <itemizedlist> <listitem> <para> Set #GtkWidget:has-tooltip and connect to #GtkWidget::query-tooltip as before. </para> </listitem> <listitem> <para> Use gtk_widget_set_tooltip_window() to set a #GtkWindow created by you as tooltip window. </para> </listitem> <listitem> <para> In the #GtkWidget::query-tooltip callback you can access your window using gtk_widget_get_tooltip_window() and manipulate as you wish. The semantics of the return value are exactly as before, return %TRUE to show the window, %FALSE to not show it. </para> </listitem> </itemizedlist>

Methods

voidset_custom(custom_widget)

voidset_icon(pixbuf)

voidset_icon_from_gicon(gicon, size)

voidset_icon_from_icon_name(icon_name, size)

voidset_icon_from_stock(stock_id, size)

voidset_markup(markup)

voidset_text(text)

voidset_tip_area(rect)

voidtrigger_tooltip_query(display)(static method)

Interface: Gtk.TreeDragDest

Classes implementing Gtk.TreeDragDest: Gtk.TreeStore, Gtk.ListStore

Methods

booldrag_data_received(dest, selection_data)

boolrow_drop_possible(dest_path, selection_data)

Interface: Gtk.TreeDragSource

Classes implementing Gtk.TreeDragSource: Gtk.TreeModelFilter, Gtk.TreeModelSort, Gtk.ListStore, Gtk.TreeStore

Methods

booldrag_data_delete(path)

bool, Gtk.SelectionDatadrag_data_get(path)

boolrow_draggable(path)

Interface: Gtk.TreeModel

Classes implementing Gtk.TreeModel: Gtk.TreeModelFilter, Gtk.TreeModelSort, Gtk.ListStore, Gtk.TreeStore

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. 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. In order to make life simpler for programmers who do not need to write their own specialized model, two generic models are provided &mdash; 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. 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. 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. 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. 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. 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. 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. <example> <title>Acquiring a <structname>GtkTreeIter</structname></title> <programlisting> /&ast; Three ways of getting the iter pointing to the location &ast;/ GtkTreePath *path; GtkTreeIter iter; GtkTreeIter parent_iter; /&ast; get the iterator from a string &ast;/ gtk_tree_model_get_iter_from_string (model, &amp;iter, "3:2:5"); /&ast; get the iterator from a path &ast;/ path = gtk_tree_path_new_from_string ("3:2:5"); gtk_tree_model_get_iter (model, &amp;iter, path); gtk_tree_path_free (path); /&ast; walk the tree to find the iterator &ast;/ gtk_tree_model_iter_nth_child (model, &amp;iter, NULL, 3); parent_iter = iter; gtk_tree_model_iter_nth_child (model, &amp;iter, &amp;parent_iter, 2); parent_iter = iter; gtk_tree_model_iter_nth_child (model, &amp;iter, &amp;parent_iter, 5); </programlisting> </example> 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; /&ast; make a new list_store &ast;/ list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT); /&ast; Fill the list store with data &ast;/ populate_model (list_store); /&ast; Get the first iter in the list &ast;/ valid = gtk_tree_model_get_iter_first (list_store, &amp;iter); while (valid) { /&ast; Walk through the list, reading each row &ast;/ gchar *str_data; gint int_data; /&ast; Make sure you terminate calls to gtk_tree_model_get() &ast; with a '-1' value &ast;/ gtk_tree_model_get (list_store, &amp;iter, STRING_COLUMN, &amp;str_data, INT_COLUMN, &amp;int_data, -1); /&ast; Do something with the data &ast;/ g_free (str_data); row_count++; valid = gtk_tree_model_iter_next (list_store, &amp;iter); } </programlisting> </example>

Signals

none"row-changed"(self, tree_model, path, iter)

This signal is emitted when a row in the model has changed.

none"rows-reordered"(self, tree_model, path, iter, new_order)

This signal is emitted when the children of a node in the #GtkTreeModel have been reordered. Note that this signal is <emphasis>not</emphasis> emitted when rows are reordered by DND, since this is implemented by removing and then reinserting the row.

none"row-has-child-toggled"(self, tree_model, path, iter)

This signal is emitted when a row has gotten the first child row or lost its last child row.

none"row-inserted"(self, tree_model, path, iter)

This signal is emitted when a new row has been inserted in the model. Note that the row may still be empty at this point, since it is a common pattern to first insert an empty row, and then fill it with the desired values.

none"row-deleted"(self, tree_model, path)

This signal is emitted when a row has been deleted. Note that no iterator is passed to the signal handler, since the row is already deleted. This should be called by models after a row has been removed. The location pointed to by @path should be the location that the row previously was at. It may not be a valid location anymore.

Methods

Gtk.TreeModelfilter_new(root)

voidforeach(func, user_data)

GTypeget_column_type(index_)

Gtk.TreeModelFlagsget_flags()

bool, Gtk.TreeIterget_iter(path)

bool, Gtk.TreeIterget_iter_first()

bool, Gtk.TreeIterget_iter_from_string(path_string)

intget_n_columns()

Gtk.TreePathget_path(iter)

stringget_string_from_iter(iter)

void, GObject.Valueget_value(iter, column)

bool, Gtk.TreeIteriter_children(parent)

booliter_has_child(iter)

intiter_n_children(iter)

booliter_next(iter)

bool, Gtk.TreeIteriter_nth_child(parent, n)

bool, Gtk.TreeIteriter_parent(child)

booliter_previous(iter)

voidref_node(iter)

voidrow_changed(path, iter)

voidrow_deleted(path)

voidrow_has_child_toggled(path, iter)

voidrow_inserted(path, iter)

Gtk.TreeModelsort_new_with_model()

voidunref_node(iter)

Class: Gtk.TreeModelFilter

Implements: Gtk.TreeModel, Gtk.TreeDragSource

Subclass of: GObject.Object

A #GtkTreeModelFilter is a tree model which wraps another tree model, and can do the following things: <itemizedlist> <listitem><para> Filter specific rows, based on data from a "visible column", a column storing booleans indicating whether the row should be filtered or not, or based on the return value of a "visible function", which gets a model, iter and user_data and returns a boolean indicating whether the row should be filtered or not. </para></listitem> <listitem><para> Modify the "appearance" of the model, using a modify function. This is extremely powerful and allows for just changing some values and also for creating a completely different model based on the given child model. </para></listitem> <listitem><para> Set a different root node, also known as a "virtual root". You can pass in a #GtkTreePath indicating the root node for the filter at construction time. </para></listitem> </itemizedlist>

Properties

Gtk.TreeModel"child-model"construct-only

Gtk.TreePath"virtual-root"construct-only

Methods

voidclear_cache()

bool, Gtk.TreeIterconvert_child_iter_to_iter(child_iter)

Gtk.TreePathconvert_child_path_to_path(child_path)

void, Gtk.TreeIterconvert_iter_to_child_iter(filter_iter)

Gtk.TreePathconvert_path_to_child_path(filter_path)

Gtk.TreeModelget_model()

voidmodify(child_model, iter, value, column)

voidrefilter()

voidset_modify_func(n_columns, types, func, data, destroy)

voidset_visible_column(column)

voidset_visible_func(func, data, destroy)

boolvisible(child_model, iter)

Class: Gtk.TreeModelSort

Implements: Gtk.TreeModel, Gtk.TreeSortable, Gtk.TreeDragSource

Subclass of: GObject.Object

Properties

Gtk.TreeModel"model"construct-only

Methods

voidclear_cache()

bool, Gtk.TreeIterconvert_child_iter_to_iter(child_iter)

Gtk.TreePathconvert_child_path_to_path(child_path)

void, Gtk.TreeIterconvert_iter_to_child_iter(sorted_iter)

Gtk.TreePathconvert_path_to_child_path(sorted_path)

Gtk.TreeModelget_model()

booliter_is_valid(iter)

voidreset_default_sort_func()

Class: Gtk.TreeSelection

Subclass of: GObject.Object

The #GtkTreeSelection object is a helper object to manage the selection for a #GtkTreeView widget. The #GtkTreeSelection object is automatically created when a new #GtkTreeView widget is created, and cannot exist independentally of this widget. The primary reason the #GtkTreeSelection objects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on the #GtkTreeView widget instead of a separate function. The #GtkTreeSelection object is gotten from a #GtkTreeView by calling gtk_tree_view_get_selection(). It can be manipulated to check the selection status of the tree, as well as select and deselect individual rows. Selection is done completely view side. As a result, multiple views of the same model can have completely different selections. Additionally, you cannot change the selection of a row on the model that is not currently displayed by the view without expanding its parents first. One of the important things to remember when monitoring the selection of a view is that the #GtkTreeSelection::changed signal is mostly a hint. That is,it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a #GtkTreeSelection::changed signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).

Signals

void"changed"(self, tree_selection)

Emitted whenever the selection has (possibly) changed. Please note that this signal is mostly a hint. It may only be emitted once when a range of rows are selected, and it may occasionally be emitted when nothing has happened.

Methods

voidchanged()

intcount_selected_rows()

Gtk.SelectionModeget_mode()

bool, Gtk.TreeModel, Gtk.TreeIterget_selected()

GLib.List, Gtk.TreeModelget_selected_rows()

Gtk.TreeViewget_tree_view()

booliter_is_selected(iter)

boolpath_is_selected(path)

voidselect_all()

voidselect_iter(iter)

voidselect_path(path)

voidselect_range(start_path, end_path)

voidselected_foreach(func, data)

voidset_mode(type)

voidset_select_function(func, data, destroy)

voidunselect_all()

voidunselect_iter(iter)

voidunselect_path(path)

voidunselect_range(start_path, end_path)

Interface: Gtk.TreeSortable

Classes implementing Gtk.TreeSortable: Gtk.TreeModelSort, Gtk.TreeStore, Gtk.ListStore

#GtkTreeSortable is an interface to be implemented by tree models which support sorting. The #GtkTreeView uses the methods provided by this interface to sort the model.

Signals

none"sort-column-changed"(self, tree_sortable)

The ::sort-column-changed signal is emitted when the sort column or sort order of @sortable is changed. The signal is emitted before the contents of @sortable are resorted.

Methods

bool, int, Gtk.SortTypeget_sort_column_id()

boolhas_default_sort_func()

voidset_default_sort_func(sort_func, user_data, destroy)

voidset_sort_column_id(sort_column_id, order)

voidset_sort_func(sort_column_id, sort_func, user_data, destroy)

voidsort_column_changed()

Class: Gtk.TreeStore

Implements: Gtk.TreeModel, Gtk.TreeSortable, Gtk.Buildable, Gtk.TreeDragSource, Gtk.TreeDragDest

Subclass of: GObject.Object

The #GtkTreeStore object is a list model for use with a #GtkTreeView widget. It implements the #GtkTreeModel interface, and consequentialy, can use all of the methods available there. It also implements the #GtkTreeSortable interface so it can be sorted by the view. Finally, it also implements the tree <link linkend="gtktreednd">drag and drop</link> interfaces. <refsect2 id="GtkTreeStore-BUILDER-UI"> <title>GtkTreeStore as GtkBuildable</title> The GtkTreeStore implementation of the #GtkBuildable interface allows to specify the model columns with a &lt;columns&gt; element that may contain multiple &lt;column&gt; elements, each specifying one model column. The "type" attribute specifies the data type for the column. <example> <title>A UI Definition fragment for a tree store</title> <programlisting><![CDATA[ <object class="GtkTreeStore"> <columns> <column type="gchararray"/> <column type="gchararray"/> <column type="gint"/> </columns> </object> ]]></programlisting> </example> </refsect2>

Methods

void, Gtk.TreeIterappend(parent)

voidclear()

void, Gtk.TreeIterinsert(parent, position)

void, Gtk.TreeIterinsert_after(parent, sibling)

void, Gtk.TreeIterinsert_before(parent, sibling)

void, Gtk.TreeIterinsert_with_valuesv(parent, position, columns, values, n_values)

boolis_ancestor(iter, descendant)

intiter_depth(iter)

booliter_is_valid(iter)

voidmove_after(iter, position)

voidmove_before(iter, position)

Gtk.TreeStorenewv(n_columns, types)(static method)

void, Gtk.TreeIterprepend(parent)

boolremove(iter)

voidset_column_types(n_columns, types)

voidset_value(iter, column, value)

voidset_valuesv(iter, columns, values, n_values)

voidswap(a, b)

Class: Gtk.TreeView

Implements: Gtk.Scrollable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Container

Widget that displays any object that implements the #GtkTreeModel interface. Please refer to the <link linkend="TreeWidget">tree widget conceptual overview</link> for an overview of all the objects and data types related to the tree widget and how they work together. Several different coordinate systems are exposed in the GtkTreeView API. These are: <inlinegraphic fileref="tree-view-coordinates.png" format="PNG"></inlinegraphic> <variablelist><title>Coordinate systems in GtkTreeView API</title> <varlistentry><term>Widget coordinates</term> <listitem> <para> Coordinates relative to the widget (usually <literal>widget->window</literal>). </para> </listitem> </varlistentry> <varlistentry><term>Bin window coordinates</term> <listitem> <para> Coordinates relative to the window that GtkTreeView renders to. </para> </listitem> </varlistentry> <varlistentry><term>Tree coordinates</term> <listitem> <para> Coordinates relative to the entire scrollable area of GtkTreeView. These coordinates start at (0, 0) for row 0 of the tree. </para> </listitem> </varlistentry> </variablelist> Several functions are available for converting between the different coordinate systems. The most common translations are between widget and bin window coordinates and between bin window and tree coordinates. For the former you can use gtk_tree_view_convert_widget_to_bin_window_coords() (and vice versa), for the latter gtk_tree_view_convert_bin_window_to_tree_coords() (and vice versa). <refsect2 id="GtkTreeView-BUILDER-UI"> <title>GtkTreeView as GtkBuildable</title> The GtkTreeView implementation of the GtkBuildable interface accepts #GtkTreeViewColumn objects as &lt;child&gt; elements and exposes the internal #GtkTreeSelection in UI definitions. <example> <title>A UI definition fragment with GtkTreeView</title> <programlisting><![CDATA[ <object class="GtkTreeView" id="treeview"> <property name="model">liststore1</property> <child> <object class="GtkTreeViewColumn" id="test-column"> <property name="title">Test</property> <child> <object class="GtkCellRendererText" id="test-renderer"/> <attributes> <attribute name="text">1</attribute> </attributes> </child> </object> </child> <child internal-child="selection"> <object class="GtkTreeSelection" id="selection"> <signal name="changed" handler="on_treeview_selection_changed"/> </object> </child> </object> ]]></programlisting> </example> </refsect2>

Properties

Gtk.TreeViewGridLines"enable-grid-lines"read/write

bool"enable-tree-lines"read/write

bool"reorderable"read/write

bool"rules-hint"read/write

Gtk.TreeViewColumn"expander-column"read/write

int"level-indentation"read/write

Extra indentation for each level.

int"search-column"read/write

bool"fixed-height-mode"read/write

Setting the ::fixed-height-mode property to %TRUE speeds up #GtkTreeView by assuming that all rows have the same height. Only enable this option if all rows are the same height. Please see gtk_tree_view_set_fixed_height_mode() for more information on this option.

bool"headers-clickable"read/write

bool"hover-selection"read/write

Enables or disables the hover selection mode of @tree_view. Hover selection makes the selected row follow the pointer. Currently, this works only for the selection modes %GTK_SELECTION_SINGLE and %GTK_SELECTION_BROWSE. This mode is primarily intended for treeviews in popups, e.g. in #GtkComboBox or #GtkEntryCompletion.

bool"show-expanders"read/write

%TRUE if the view has expanders.

bool"rubber-banding"read/write

Gtk.TreeModel"model"read/write

bool"hover-expand"read/write

Enables or disables the hover expansion mode of @tree_view. Hover expansion makes rows expand or collapse if the pointer moves over them. This mode is primarily intended for treeviews in popups, e.g. in #GtkComboBox or #GtkEntryCompletion.

bool"headers-visible"read/write

int"tooltip-column"read/write

bool"enable-search"read/write

Signals

bool"select-cursor-parent"(self, tree_view)

bool"test-collapse-row"(self, tree_view, iter, path)

The given row is about to be collapsed (hide its children nodes). Use this signal if you need to control the collapsibility of individual rows.

bool"toggle-cursor-row"(self, tree_view)

bool"unselect-all"(self, tree_view)

bool"select-cursor-row"(self, tree_view, object)

void"columns-changed"(self, tree_view)

The number of columns of the treeview has changed.

bool"start-interactive-search"(self, tree_view)

bool"expand-collapse-cursor-row"(self, tree_view, object, p0, p1)

bool"select-all"(self, tree_view)

bool"test-expand-row"(self, tree_view, iter, path)

The given row is about to be expanded (show its children nodes). Use this signal if you need to control the expandability of individual rows.

void"row-collapsed"(self, tree_view, iter, path)

The given row has been collapsed (child nodes are hidden).

void"row-expanded"(self, tree_view, iter, path)

The given row has been expanded (child nodes are shown).

void"cursor-changed"(self, tree_view)

The position of the cursor (focused cell) has changed.

bool"move-cursor"(self, tree_view, object, p0)

void"row-activated"(self, tree_view, path, column)

The "row-activated" signal is emitted when the method gtk_tree_view_row_activated() is called or the user double clicks a treeview row. It is also emitted when a non-editable row is Enter is pressed. For selection handling refer to the <link linkend="TreeWidget">tree widget conceptual overview</link> as well as #GtkTreeSelection.

Methods

intappend_column(column)

voidcollapse_all()

boolcollapse_row(path)

voidcolumns_autosize()

voidcolumns_changed()

void, int, intconvert_bin_window_to_tree_coords(bx, by)

void, int, intconvert_bin_window_to_widget_coords(bx, by)

void, int, intconvert_tree_to_bin_window_coords(tx, ty)

void, int, intconvert_tree_to_widget_coords(tx, ty)

void, int, intconvert_widget_to_bin_window_coords(wx, wy)

void, int, intconvert_widget_to_tree_coords(wx, wy)

cairo.Surfacecreate_row_drag_icon(path)

voidcursor_changed()

voidenable_model_drag_dest(targets, n_targets, actions)

voidenable_model_drag_source(start_button_mask, targets, n_targets, actions)

voidexpand_all()

boolexpand_collapse_cursor_row(logical, expand, open_all)

boolexpand_row(path, open_all)

voidexpand_to_path(path)

void, Gdk.Rectangleget_background_area(path, column)

Gdk.Windowget_bin_window()

void, Gdk.Rectangleget_cell_area(path, column)

Gtk.TreeViewColumnget_column(n)

GLib.Listget_columns()

void, Gtk.TreePath, Gtk.TreeViewColumnget_cursor()

bool, Gtk.TreePath, Gtk.TreeViewDropPositionget_dest_row_at_pos(drag_x, drag_y)

void, Gtk.TreePath, Gtk.TreeViewDropPositionget_drag_dest_row()

boolget_enable_search()

boolget_enable_tree_lines()

Gtk.TreeViewColumnget_expander_column()

boolget_fixed_height_mode()

Gtk.TreeViewGridLinesget_grid_lines()

Gtk.Adjustmentget_hadjustment()

boolget_headers_clickable()

boolget_headers_visible()

boolget_hover_expand()

boolget_hover_selection()

intget_level_indentation()

Gtk.TreeModelget_model()

bool, Gtk.TreePath, Gtk.TreeViewColumn, int, intget_path_at_pos(x, y)

boolget_reorderable()

boolget_rubber_banding()

boolget_rules_hint()

intget_search_column()

Gtk.Entryget_search_entry()

Gtk.TreeSelectionget_selection()

boolget_show_expanders()

intget_tooltip_column()

bool, Gtk.TreeModel, Gtk.TreePath, Gtk.TreeIterget_tooltip_context(x, y, keyboard_tip)

Gtk.Adjustmentget_vadjustment()

bool, Gtk.TreePath, Gtk.TreePathget_visible_range()

void, Gdk.Rectangleget_visible_rect()

intinsert_column(column, position)

intinsert_column_with_data_func(position, title, cell, func, data, dnotify)

bool, Gtk.TreePath, Gtk.TreeViewColumn, int, intis_blank_at_pos(x, y)

boolis_rubber_banding_active()

voidmap_expanded_rows(func, data)

voidmove_column_after(column, base_column)

boolmove_cursor(step, count)

intremove_column(column)

voidrow_activated(path, column)

voidrow_collapsed(iter, path)

voidrow_expanded(iter, path)

voidscroll_to_cell(path, column, use_align, row_align, col_align)

voidscroll_to_point(tree_x, tree_y)

boolselect_all()

boolselect_cursor_parent()

boolselect_cursor_row(start_editing)

voidset_column_drag_function(func, user_data, destroy)

voidset_cursor(path, focus_column, start_editing)

voidset_cursor_on_cell(path, focus_column, focus_cell, start_editing)

voidset_destroy_count_func(func, data, destroy)

voidset_drag_dest_row(path, pos)

voidset_enable_search(enable_search)

voidset_enable_tree_lines(enabled)

voidset_expander_column(column)

voidset_fixed_height_mode(enable)

voidset_grid_lines(grid_lines)

voidset_hadjustment(adjustment)

voidset_headers_clickable(setting)

voidset_headers_visible(headers_visible)

voidset_hover_expand(expand)

voidset_hover_selection(hover)

voidset_level_indentation(indentation)

voidset_model(model)

voidset_reorderable(reorderable)

voidset_row_separator_func(func, data, destroy)

voidset_rubber_banding(enable)

voidset_rules_hint(setting)

voidset_search_column(column)

voidset_search_entry(entry)

voidset_search_equal_func(search_equal_func, search_user_data, search_destroy)

voidset_search_position_func(func, data, destroy)

voidset_show_expanders(enabled)

voidset_tooltip_cell(tooltip, path, column, cell)

voidset_tooltip_column(column)

voidset_tooltip_row(tooltip, path)

voidset_vadjustment(adjustment)

boolstart_interactive_search()

booltest_collapse_row(iter, path)

booltest_expand_row(iter, path)

booltoggle_cursor_row()

boolunselect_all()

voidunset_rows_drag_dest()

voidunset_rows_drag_source()

Class: Gtk.TreeViewColumn

Implements: Gtk.CellLayout, Gtk.Buildable

Subclass of: GObject.InitiallyUnowned

The GtkTreeViewColumn object represents a visible column in a #GtkTreeView widget. It allows to set properties of the column header, and functions as a holding pen for the cell renderers which determine how the data in the column is displayed. Please refer to the <link linkend="TreeWidget">tree widget conceptual overview</link> for an overview of all the objects and data types related to the tree widget and how they work together.

Properties

Gtk.TreeViewColumnSizing"sizing"read/write

Gtk.Widget"widget"read/write

bool"resizable"read/write

bool"reorderable"read/write

string"title"read/write

int"width"read-only

int"spacing"read/write

int"min-width"read/write

bool"visible"read/write

Gtk.CellArea"cell-area"construct-only

The #GtkCellArea used to layout cell renderers for this column. If no area is specified when creating the tree view column with gtk_tree_view_column_new_with_area() a horizontally oriented #GtkCellAreaBox will be used.

bool"expand"read/write

bool"sort-indicator"read/write

int"max-width"read/write

bool"clickable"read/write

float"alignment"read/write

Gtk.SortType"sort-order"read/write

int"fixed-width"read/write

int"sort-column-id"read/write

Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header clickable. Set to %-1 to make the column unsortable.

Signals

void"clicked"(self, tree_view_column)

Methods

voidadd_attribute(cell_renderer, attribute, column)

bool, int, intcell_get_position(cell_renderer)

void, int, int, int, intcell_get_size(cell_area)

boolcell_is_visible()

voidcell_set_cell_data(tree_model, iter, is_expander, is_expanded)

voidclear()

voidclear_attributes(cell_renderer)

voidclicked()

voidfocus_cell(cell)

floatget_alignment()

Gtk.Widgetget_button()

boolget_clickable()

boolget_expand()

intget_fixed_width()

intget_max_width()

intget_min_width()

boolget_reorderable()

boolget_resizable()

intget_sort_column_id()

boolget_sort_indicator()

Gtk.SortTypeget_sort_order()

intget_spacing()

stringget_title()

Gtk.Widgetget_tree_view()

boolget_visible()

Gtk.Widgetget_widget()

intget_width()

voidpack_end(cell, expand)

voidpack_start(cell, expand)

voidqueue_resize()

voidset_alignment(xalign)

voidset_cell_data_func(cell_renderer, func, func_data, destroy)

voidset_clickable(clickable)

voidset_expand(expand)

voidset_fixed_width(fixed_width)

voidset_max_width(max_width)

voidset_min_width(min_width)

voidset_reorderable(reorderable)

voidset_resizable(resizable)

voidset_sizing(type)

voidset_sort_column_id(sort_column_id)

voidset_sort_indicator(setting)

voidset_sort_order(order)

voidset_spacing(spacing)

voidset_title(title)

voidset_visible(visible)

voidset_widget(widget)

Class: Gtk.UIManager

Implements: Gtk.Buildable

Subclass of: GObject.Object

Properties

bool"add-tearoffs"read/write

The "add-tearoffs" property controls whether generated menus have tearoff menu items. Note that this only affects regular menus. Generated popup menus never have tearoff menu items.

string"ui"read-only

Signals

void"pre-activate"(self, uimanager, action)

The ::pre-activate signal is emitted just before the @action is activated. This is intended for applications to get notification just before any action is activated.

void"actions-changed"(self, uimanager)

The ::actions-changed signal is emitted whenever the set of actions changes.

void"connect-proxy"(self, uimanager, action, proxy)

The ::connect-proxy signal is emitted after connecting a proxy to an action in the group. This is intended for simple customizations for which a custom action class would be too clumsy, e.g. showing tooltips for menuitems in the statusbar.

void"add-widget"(self, uimanager, widget)

The ::add-widget signal is emitted for each generated menubar and toolbar. It is not emitted for generated popup menus, which can be obtained by gtk_ui_manager_get_widget().

void"disconnect-proxy"(self, uimanager, action, proxy)

The ::disconnect-proxy signal is emitted after disconnecting a proxy from an action in the group.

void"post-activate"(self, uimanager, action)

The ::post-activate signal is emitted just after the @action is activated. This is intended for applications to get notification just after any action is activated.

Methods

voidadd_ui(merge_id, path, name, action, type, top)

intadd_ui_from_file(filename)

intadd_ui_from_string(buffer, length)

voidensure_update()

Gtk.AccelGroupget_accel_group()

GLib.Listget_action_groups()

boolget_add_tearoffs()

GLib.SListget_toplevels(types)

stringget_ui()

voidinsert_action_group(action_group, pos)

intnew_merge_id()

voidremove_action_group(action_group)

voidremove_ui(merge_id)

voidset_add_tearoffs(add_tearoffs)

voidactions_changed()

voidadd_widget(widget)

voidconnect_proxy(action, proxy)

voiddisconnect_proxy(action, proxy)

Gtk.Actionget_action(path)

Gtk.Widgetget_widget(path)

voidpost_activate(action)

voidpre_activate(action)

Class: Gtk.VBox

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Known subclasses: Gtk.FontSelection, Gtk.FileChooserWidget, Gtk.RecentChooserWidget, Gtk.ColorSelection

Subclass of: Gtk.Box

A #GtkVBox is a container that organizes child widgets into a single column. Use the #GtkBox packing interface to determine the arrangement, spacing, height, and alignment of #GtkVBox children. All children are allocated the same width.

Class: Gtk.VButtonBox

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.ButtonBox

Class: Gtk.VPaned

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Paned

The VPaned widget is a container widget with two children arranged vertically. The division between the two panes is adjustable by the user by dragging a handle. See #GtkPaned for details.

Class: Gtk.VScale

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Scale

The #GtkVScale widget is used to allow the user to select a value using a vertical slider. To create one, use gtk_hscale_new_with_range(). The position to show the current value, and the number of decimal places shown can be set using the parent #GtkScale class's functions.

Class: Gtk.VScrollbar

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Scrollbar

The #GtkVScrollbar widget is a widget arranged vertically creating a scrollbar. See #GtkScrollbar for details on scrollbars. #GtkAdjustment pointers may be added to handle the adjustment of the scrollbar or it may be left %NULL in which case one will be created for you. See #GtkScrollbar for a description of what the fields in an adjustment represent for a scrollbar.

Class: Gtk.VSeparator

Implements: Gtk.Buildable, Gtk.Orientable, Atk.ImplementorIface

Subclass of: Gtk.Separator

The #GtkVSeparator widget is a vertical separator, used to group the widgets within a window. It displays a vertical line with a shadow to make it appear sunken into the interface.

Class: Gtk.Viewport

Implements: Gtk.Scrollable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.Bin

The #GtkViewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use #GtkViewport to scroll child widgets such as #GtkTable, #GtkBox, and so on. If a widget has native scrolling abilities, such as #GtkTextView, #GtkTreeView or #GtkIconview, it can be added to a #GtkScrolledWindow with gtk_container_add(). If a widget does not, you must first add the widget to a #GtkViewport, then add the viewport to the scrolled window. The convenience function gtk_scrolled_window_add_with_viewport() does exactly this, so you can ignore the presence of the viewport. The #GtkViewport will start scrolling content only if allocated less than the child widget's minimum size in a given orientation.

Properties

Gtk.ShadowType"shadow-type"read/write

Methods

Gdk.Windowget_bin_window()

Gtk.Adjustmentget_hadjustment()

Gtk.ShadowTypeget_shadow_type()

Gtk.Adjustmentget_vadjustment()

Gdk.Windowget_view_window()

voidset_hadjustment(adjustment)

voidset_shadow_type(type)

voidset_vadjustment(adjustment)

Class: Gtk.VolumeButton

Implements: Gtk.Orientable, Gtk.Activatable, Gtk.Buildable, Atk.ImplementorIface

Subclass of: Gtk.ScaleButton

#GtkVolumeButton is a subclass of #GtkScaleButton that has been tailored for use as a volume control widget with suitable icons, tooltips and accessible labels.

Properties

bool"use-symbolic"read/write

Whether to use symbolic icons as the icons. Note that if the symbolic icons are not available in your installed theme, then the normal (potentially colorful) icons will be used.

Abstract Class: Gtk.Widget

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.Range, Gtk.Switch, Gtk.CellView, Gtk.ProgressBar, Gtk.HSV, Gtk.Container, Gtk.Entry, Gtk.Calendar, Gtk.Invisible, Gtk.Separator, Gtk.DrawingArea, Gtk.Misc, Gtk.Spinner

Subclass of: GObject.InitiallyUnowned

GtkWidget is the base class all widgets in GTK+ derive from. It manages the widget lifecycle, states and style. <refsect2 id="geometry-management"> <title>Height-for-width Geometry Management</title> <para> GTK+ uses a height-for-width (and width-for-height) geometry management system. Height-for-width means that a widget can change how much vertical space it needs, depending on the amount of horizontal space that it is given (and similar for width-for-height). The most common example is a label that reflows to fill up the available width, wraps to fewer lines, and therefore needs less height. Height-for-width geometry management is implemented in GTK+ by way of five virtual methods: <itemizedlist> <listitem>#GtkWidgetClass.get_request_mode()</listitem> <listitem>#GtkWidgetClass.get_preferred_width()</listitem> <listitem>#GtkWidgetClass.get_preferred_height()</listitem> <listitem>#GtkWidgetClass.get_preferred_height_for_width()</listitem> <listitem>#GtkWidgetClass.get_preferred_width_for_height()</listitem> </itemizedlist> There are some important things to keep in mind when implementing height-for-width and when using it in container implementations. The geometry management system will query a widget hierarchy in only one orientation at a time. When widgets are initially queried for their minimum sizes it is generally done in two initial passes in the #GtkSizeRequestMode chosen by the toplevel. For example, when queried in the normal %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH mode: First, the default minimum and natural width for each widget in the interface will be computed using gtk_widget_get_preferred_width(). Because the preferred widths for each container depend on the preferred widths of their children, this information propagates up the hierarchy, and finally a minimum and natural width is determined for the entire toplevel. Next, the toplevel will use the minimum width to query for the minimum height contextual to that width using gtk_widget_get_preferred_height_for_width(), which will also be a highly recursive operation. The minimum height for the minimum width is normally used to set the minimum size constraint on the toplevel (unless gtk_window_set_geometry_hints() is explicitly used instead). After the toplevel window has initially requested its size in both dimensions it can go on to allocate itself a reasonable size (or a size previously specified with gtk_window_set_default_size()). During the recursive allocation process it's important to note that request cycles will be recursively executed while container widgets allocate their children. Each container widget, once allocated a size, will go on to first share the space in one orientation among its children and then request each child's height for its target allocated width or its width for allocated height, depending. In this way a #GtkWidget will typically be requested its size a number of times before actually being allocated a size. The size a widget is finally allocated can of course differ from the size it has requested. For this reason, #GtkWidget caches a small number of results to avoid re-querying for the same sizes in one allocation cycle. See <link linkend="container-geometry-management">GtkContainer's geometry management section</link> to learn more about how height-for-width allocations are performed by container widgets. If a widget does move content around to intelligently use up the allocated size then it must support the request in both #GtkSizeRequestModes even if the widget in question only trades sizes in a single orientation. For instance, a #GtkLabel that does height-for-width word wrapping will not expect to have #GtkWidgetClass.get_preferred_height() called because that call is specific to a width-for-height request. In this case the label must return the height required for its own minimum possible width. By following this rule any widget that handles height-for-width or width-for-height requests will always be allocated at least enough space to fit its own content. Here are some examples of how a %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH widget generally deals with width-for-height requests, for #GtkWidgetClass.get_preferred_height() it will do: <programlisting><![CDATA[ static void foo_widget_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height) { if (i_am_in_height_for_width_mode) { gint min_width; GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, min_height, nat_height); } else { ... some widgets do both. For instance, if a GtkLabel is rotated to 90 degrees it will return the minimum and natural height for the rotated label here. } } ]]></programlisting> And in #GtkWidgetClass.get_preferred_width_for_height() it will simply return the minimum and natural width: <programlisting><![CDATA[ static void foo_widget_get_preferred_width_for_height (GtkWidget *widget, gint for_height, gint *min_width, gint *nat_width) { if (i_am_in_height_for_width_mode) { GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, min_width, nat_width); } else { ... again if a widget is sometimes operating in width-for-height mode (like a rotated GtkLabel) it can go ahead and do its real width for height calculation here. } } ]]></programlisting> Often a widget needs to get its own request during size request or allocation. For example, when computing height it may need to also compute width. Or when deciding how to use an allocation, the widget may need to know its natural size. In these cases, the widget should be careful to call its virtual methods directly, like this: <example> <title>Widget calling its own size request method.</title> <programlisting> GTK_WIDGET_GET_CLASS(widget)-&gt;get_preferred_width (widget), &min, &natural); </programlisting> </example> It will not work to use the wrapper functions, such as gtk_widget_get_preferred_width() inside your own size request implementation. These return a request adjusted by #GtkSizeGroup and by the #GtkWidgetClass.adjust_size_request() virtual method. If a widget used the wrappers inside its virtual method implementations, then the adjustments (such as widget margins) would be applied twice. GTK+ therefore does not allow this and will warn if you try to do it. Of course if you are getting the size request for <emphasis>another</emphasis> widget, such as a child of a container, you <emphasis>must</emphasis> use the wrapper APIs. Otherwise, you would not properly consider widget margins, #GtkSizeGroup, and so forth. </para> </refsect2> <refsect2 id="style-properties"> <title>Style Properties</title> <para> <structname>GtkWidget</structname> introduces <firstterm>style properties</firstterm> - these are basically object properties that are stored not on the object, but in the style object associated to the widget. Style properties are set in <link linkend="gtk-Resource-Files">resource files</link>. This mechanism is used for configuring such things as the location of the scrollbar arrows through the theme, giving theme authors more control over the look of applications without the need to write a theme engine in C. </para> <para> Use gtk_widget_class_install_style_property() to install style properties for a widget class, gtk_widget_class_find_style_property() or gtk_widget_class_list_style_properties() to get information about existing style properties and gtk_widget_style_get_property(), gtk_widget_style_get() or gtk_widget_style_get_valist() to obtain the value of a style property. </para> </refsect2> <refsect2 id="GtkWidget-BUILDER-UI"> <title>GtkWidget as GtkBuildable</title> <para> The GtkWidget implementation of the GtkBuildable interface supports a custom &lt;accelerator&gt; element, which has attributes named key, modifiers and signal and allows to specify accelerators. </para> <example> <title>A UI definition fragment specifying an accelerator</title> <programlisting><![CDATA[ <object class="GtkButton"> <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/> </object> ]]></programlisting> </example> <para> In addition to accelerators, <structname>GtkWidget</structname> also support a custom &lt;accessible&gt; element, which supports actions and relations. Properties on the accessible implementation of an object can be set by accessing the internal child "accessible" of a <structname>GtkWidget</structname>. </para> <example> <title>A UI definition fragment specifying an accessible</title> <programlisting><![CDATA[ <object class="GtkButton" id="label1"/> <property name="label">I am a Label for a Button</property> </object> <object class="GtkButton" id="button1"> <accessibility> <action action_name="click" translatable="yes">Click the button.</action> <relation target="label1" type="labelled-by"/> </accessibility> <child internal-child="accessible"> <object class="AtkObject" id="a11y-button1"> <property name="AtkObject::name">Clickable Button</property> </object> </child> </object> ]]></programlisting> </example> <para> Finally, GtkWidget allows style information such as style classes to be associated with widgets, using the custom &lt;style&gt; element: <example> <title>A UI definition fragment specifying an style class</title> <programlisting><![CDATA[ <object class="GtkButton" id="button1"> <style> <class name="my-special-button-class"/> <class name="dark-button"/> </style> </object> ]]></programlisting> </example> </para> </refsect2>

Properties

bool"sensitive"read/write

bool"vexpand-set"read/write

Whether to use the #GtkWidget:vexpand property. See gtk_widget_get_vexpand_set().

int"margin-left"read/write

Margin on left side of widget. This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

bool"visible"read/write

bool"is-focus"read/write

int"margin-right"read/write

Margin on right side of widget. This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

bool"receives-default"read/write

Gtk.Style"style"read/write

bool"double-buffered"read/write

Whether the widget is double buffered.

Gtk.Align"halign"read/write

How to distribute horizontal space if widget gets extra space, see #GtkAlign

int"margin-bottom"read/write

Margin on bottom side of widget. This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

Gdk.Window"window"read-only

The widget's window if it is realized, %NULL otherwise.

bool"hexpand-set"read/write

Whether to use the #GtkWidget:hexpand property. See gtk_widget_get_hexpand_set().

Gtk.Align"valign"read/write

How to distribute vertical space if widget gets extra space, see #GtkAlign

Gdk.EventMask"events"read/write

bool"has-focus"read/write

bool"vexpand"read/write

Whether to expand vertically. See gtk_widget_set_vexpand().

Gtk.Container"parent"read/write

bool"can-default"read/write

int"width-request"read/write

bool"expand"read/write

Whether to expand in both directions. Setting this sets both #GtkWidget:hexpand and #GtkWidget:vexpand

string"tooltip-text"read/write

Sets the text of tooltip to be the given string. Also see gtk_tooltip_set_text(). This is a convenience property which will take care of getting the will automatically be set to %TRUE and there will be taken care of #GtkWidget::query-tooltip in the default signal handler.

bool"has-default"read/write

string"name"read/write

bool"hexpand"read/write

Whether to expand horizontally. See gtk_widget_set_hexpand().

bool"no-show-all"read/write

int"height-request"read/write

bool"can-focus"read/write

bool"has-tooltip"read/write

Enables or disables the emission of #GtkWidget::query-tooltip on @widget. A value of %TRUE indicates that @widget can have a tooltip, in this case the widget will be queried using #GtkWidget::query-tooltip to determine whether it will provide a tooltip or not. Note that setting this property to %TRUE for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to %FALSE again.

int"margin-top"read/write

Margin on top side of widget. This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

string"tooltip-markup"read/write

Sets the text of tooltip to be the given string, which is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>. Also see gtk_tooltip_set_markup(). This is a convenience property which will take care of getting the will automatically be set to %TRUE and there will be taken care of #GtkWidget::query-tooltip in the default signal handler.

bool"app-paintable"read/write

int"margin"read/write

Sets all four sides' margin at once. If read, returns max margin on any side.

bool"composite-child"read-only

Signals

bool"selection-notify-event"(self, widget, event)

void"screen-changed"(self, widget, previous_screen)

The ::screen-changed signal gets emitted when the screen of a widget has changed.

void"style-set"(self, widget, previous_style)

The ::style-set signal is emitted when a new style has been set on a widget. Note that style-modifying functions like gtk_widget_modify_base() also cause this signal to be emitted. Note that this signal is emitted for changes to the deprecated #GtkStyle. To track changes to the #GtkStyleContext associated with a widget, use the #GtkWidget::style-updated signal.

void"show"(self, widget)

void"size-allocate"(self, widget, object)

void"drag-data-get"(self, widget, drag_context, data, info, time)

The ::drag-data-get signal is emitted on the drag source when the drop site requests the data which is dragged. It is the responsibility of the signal handler to fill @data with the data in the format which is indicated by @info. See gtk_selection_data_set() and gtk_selection_data_set_text().

bool"focus-out-event"(self, widget, event)

The ::focus-out-event signal will be emitted when the keyboard focus leaves the @widget's window. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_FOCUS_CHANGE_MASK mask. %FALSE to propagate the event further.

bool"popup-menu"(self, widget)

This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the #GtkEntry widget creates a menu with clipboard commands. See <xref linkend="checklist-popup-menu"/> for an example of how to use this signal.

bool"focus"(self, widget, returns)

void"direction-changed"(self, widget, previous_direction)

The ::direction-changed signal is emitted when the text direction of a widget changes.

bool"selection-clear-event"(self, widget, event)

The ::selection-clear-event signal will be emitted when the the @widget's window has lost ownership of a selection. %FALSE to propagate the event further.

void"parent-set"(self, widget, old_parent)

The ::parent-set signal is emitted when a new parent has been set on a widget.

bool"delete-event"(self, widget, event)

The ::delete-event signal is emitted if a user requests that a toplevel window is closed. The default handler for this signal destroys the window. Connecting gtk_widget_hide_on_delete() to this signal will cause the window to be hidden instead, so that it can later be shown again without reconstructing it. %FALSE to propagate the event further.

void"grab-notify"(self, widget, was_grabbed)

The ::grab-notify signal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed. A widget is shadowed by a gtk_grab_add() when the topmost grab widget in the grab stack of its window group is not its ancestor.

bool"event"(self, widget, event)

The GTK+ main loop will emit three signals for each GDK event delivered signal that matches the type of event delivered (e.g. #GtkWidget::key-press-event) and finally a generic #GtkWidget::event-after signal. and to cancel the emission of the second specific ::event signal. %FALSE to propagate the event further and to allow the emission of the second signal. The ::event-after signal is emitted regardless of the return value.

void"accel-closures-changed"(self, widget)

bool"motion-notify-event"(self, widget, event)

The ::motion-notify-event signal is emitted when the pointer moves over the widget's #GdkWindow. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_POINTER_MOTION_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

void"drag-leave"(self, widget, drag_context, time)

The ::drag-leave signal is emitted on the drop site when the cursor leaves the widget. A typical reason to connect to this signal is to undo things done in #GtkWidget::drag-motion, e.g. undo highlighting with gtk_drag_unhighlight()

void"hide"(self, widget)

bool"drag-drop"(self, widget, drag_context, x, y, time)

The ::drag-drop signal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns %FALSE and no further processing is necessary. Otherwise, the handler returns %TRUE. In this case, the handler must ensure that gtk_drag_finish() is called to let the source know that the drop is done. The call to gtk_drag_finish() can be done either directly or in a #GtkWidget::drag-data-received handler which gets triggered by calling gtk_drag_get_data() to receive the data for one or more of the supported targets.

bool"visibility-notify-event"(self, widget, event)

The ::visibility-notify-event will be emitted when the @widget's window is obscured or unobscured. To receive this signal the #GdkWindow associated to the widget needs to enable the #GDK_VISIBILITY_NOTIFY_MASK mask. %FALSE to propagate the event further.

void"drag-data-delete"(self, widget, drag_context)

The ::drag-data-delete signal is emitted on the drag source when a drag with the action %GDK_ACTION_MOVE is successfully completed. The signal handler is responsible for deleting the data that has been dropped. What "delete" means depends on the context of the drag operation.

void"drag-end"(self, widget, drag_context)

The ::drag-end signal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in #GtkWidget::drag-begin.

bool"mnemonic-activate"(self, widget, object)

void"move-focus"(self, widget, object)

void"child-notify"(self, widget, pspec)

The ::child-notify signal is emitted for each <link linkend="child-properties">child property</link> that has changed on an object. The signal's detail holds the property name.

void"unrealize"(self, widget)

void"state-changed"(self, widget, state)

The ::state-changed signal is emitted when the widget state changes. See gtk_widget_get_state().

void"drag-begin"(self, widget, drag_context)

The ::drag-begin signal is emitted on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with gtk_drag_source_set_icon(). Note that some widgets set up a drag icon in the default handler of this signal, so you may have to use g_signal_connect_after() to override what the default handler did.

void"destroy"(self, widget)

Signals that all holders of a reference to the widget should release the reference that they hold. May result in finalization of the widget if all references are released.

void"drag-data-received"(self, widget, drag_context, x, y, data, info, time)

The ::drag-data-received signal is emitted on the drop site when the dragged data has been received. If the data was received in order to determine whether the drop will be accepted, the handler is expected to call gdk_drag_status() and <emphasis>not</emphasis> finish the drag. If the data was received in response to a #GtkWidget::drag-drop signal (and this is the last target to be received), the handler for this signal is expected to process the received data and then call gtk_drag_finish(), setting the @success parameter depending on whether the data was processed successfully. The handler may inspect and modify @drag_context->action before calling gtk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as shown in the following example: |[ void drag_data_received (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time) { if ((data->length >= 0) && (data->format == 8)) { if (drag_context->action == GDK_ACTION_ASK) { GtkWidget *dialog; gint response; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, "Move the data ?\n"); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_YES) drag_context->action = GDK_ACTION_MOVE; else drag_context->action = GDK_ACTION_COPY; } gtk_drag_finish (drag_context, TRUE, FALSE, time); return; } gtk_drag_finish (drag_context, FALSE, FALSE, time); } ]|

bool"show-help"(self, widget, object)

bool"key-press-event"(self, widget, event)

The ::key-press-event signal is emitted when a key is pressed. The signal emission will reoccur at the key-repeat rate when the key is kept pressed. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_KEY_PRESS_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

bool"leave-notify-event"(self, widget, event)

The ::leave-notify-event will be emitted when the pointer leaves the @widget's window. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_LEAVE_NOTIFY_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

void"map"(self, widget)

bool"draw"(self, widget, cr)

This signal is emitted when a widget is supposed to render itself. The @widget's top left corner must be painted at the origin of the passed in context and be sized to the values returned by gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height(). Signal handlers connected to this signal can modify the cairo context passed as @cr in any way they like and don't need to restore it. The signal emission takes care of calling cairo_save() before and cairo_restore() after invoking the handler.

void"grab-focus"(self, widget)

void"event-after"(self, widget, event)

After the emission of the #GtkWidget::event signal and (optionally) the second more specific signal, ::event-after will be emitted regardless of the previous two signals handlers return values.

void"selection-get"(self, widget, object, p0, p1)

bool"proximity-in-event"(self, widget, event)

To receive this signal the #GdkWindow associated to the widget needs to enable the #GDK_PROXIMITY_IN_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

bool"enter-notify-event"(self, widget, event)

The ::enter-notify-event will be emitted when the pointer enters the @widget's window. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_ENTER_NOTIFY_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

bool"query-tooltip"(self, widget, x, y, keyboard_mode, tooltip)

Emitted when #GtkWidget:has-tooltip is %TRUE and the #GtkSettings:gtk-tooltip-timeout has expired with the cursor hovering "above" @widget; or emitted when @widget got focus in keyboard mode. Using the given coordinates, the signal handler should determine whether a tooltip should be shown for @widget. If this is the case %TRUE should be returned, %FALSE otherwise. Note that if should not be used. The signal handler is free to manipulate @tooltip with the therefore destined function calls.

bool"proximity-out-event"(self, widget, event)

To receive this signal the #GdkWindow associated to the widget needs to enable the #GDK_PROXIMITY_OUT_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

bool"property-notify-event"(self, widget, event)

The ::property-notify-event signal will be emitted when a property on the @widget's window has been changed or deleted. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_PROPERTY_CHANGE_MASK mask. %FALSE to propagate the event further.

bool"damage-event"(self, widget, event)

Emitted when a redirected window belonging to @widget gets drawn into. The region/area members of the event shows what area of the redirected drawable was drawn into. %FALSE to propagate the event further.

bool"can-activate-accel"(self, widget, signal_id)

Determines whether an accelerator that activates the signal identified by @signal_id can currently be activated. This signal is present to allow applications and derived widgets to override the default #GtkWidget handling for determining whether an accelerator can be activated.

bool"button-release-event"(self, widget, event)

The ::button-release-event signal will be emitted when a button (typically from a mouse) is released. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_BUTTON_RELEASE_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

bool"grab-broken-event"(self, widget, event)

Emitted when a pointer or keyboard grab on a window belonging to @widget gets broken. On X11, this happens when the grab window becomes unviewable (i.e. it or one of its ancestors is unmapped), or if the same application grabs the pointer or keyboard again. the event. %FALSE to propagate the event further.

void"realize"(self, widget)

void"style-updated"(self, widget)

The ::style-updated signal is emitted when the #GtkStyleContext of a widget is changed. Note that style-modifying functions like gtk_widget_override_color() also cause this signal to be emitted.

void"selection-received"(self, widget, object, p0)

bool"keynav-failed"(self, widget, direction)

Gets emitted if keyboard navigation fails. See gtk_widget_keynav_failed() for details. if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).

void"unmap"(self, widget)

bool"selection-request-event"(self, widget, event)

The ::selection-request-event signal will be emitted when another client requests ownership of the selection owned by the @widget's window. %FALSE to propagate the event further.

void"composited-changed"(self, widget)

The ::composited-changed signal is emitted when the composited status of @widget<!-- -->s screen changes. See gdk_screen_is_composited().

bool"key-release-event"(self, widget, event)

The ::key-release-event signal is emitted when a key is released. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_KEY_RELEASE_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

bool"destroy-event"(self, widget, event)

The ::destroy-event signal is emitted when a #GdkWindow is destroyed. You rarely get this signal, because most widgets disconnect themselves from their window before they destroy it, so no widget owns the window at destroy time. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows. %FALSE to propagate the event further.

bool"unmap-event"(self, widget, event)

The ::unmap-event signal will be emitted when the @widget's window is unmapped. A window is unmapped when it becomes invisible on the screen. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows. %FALSE to propagate the event further.

bool"drag-failed"(self, widget, drag_context, result)

The ::drag-failed signal is emitted on the drag source when a drag has failed. The signal handler may hook custom code to handle a failed DND operation based on the type of error, it returns %TRUE is the failure has been already handled (not showing the default "drag operation failed" animation), otherwise it returns %FALSE.

bool"map-event"(self, widget, event)

The ::map-event signal will be emitted when the @widget's window is mapped. A window is mapped when it becomes visible on the screen. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows. %FALSE to propagate the event further.

bool"scroll-event"(self, widget, event)

The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_BUTTON_PRESS_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

void"state-flags-changed"(self, widget, flags)

The ::state-flags-changed signal is emitted when the widget state changes, see gtk_widget_get_state_flags().

bool"window-state-event"(self, widget, event)

The ::window-state-event will be emitted when the state of the toplevel window associated to the @widget changes. To receive this signal the #GdkWindow associated to the widget needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows. event. %FALSE to propagate the event further.

void"hierarchy-changed"(self, widget, previous_toplevel)

The ::hierarchy-changed signal is emitted when the anchored state of a widget changes. A widget is <firstterm>anchored</firstterm> when its toplevel ancestor is a #GtkWindow. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.

bool"configure-event"(self, widget, event)

The ::configure-event signal will be emitted when the size, position or stacking of the @widget's window has changed. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows. %FALSE to propagate the event further.

bool"focus-in-event"(self, widget, event)

The ::focus-in-event signal will be emitted when the keyboard focus enters the @widget's window. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_FOCUS_CHANGE_MASK mask. %FALSE to propagate the event further.

bool"drag-motion"(self, widget, drag_context, x, y, time)

The drag-motion signal is emitted on the drop site when the user moves the cursor over the widget during a drag. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns %FALSE and no further processing is necessary. Otherwise, the handler returns %TRUE. In this case, the handler is responsible for providing the necessary information for displaying feedback to the user, by calling gdk_drag_status(). If the decision whether the drop will be accepted or rejected can't be made based solely on the cursor position and the type of the data, the handler may inspect the dragged data by calling gtk_drag_get_data() and defer the gdk_drag_status() call to the #GtkWidget::drag-data-received handler. Note that you cannot not pass #GTK_DEST_DEFAULT_DROP, #GTK_DEST_DEFAULT_MOTION or #GTK_DEST_DEFAULT_ALL to gtk_drag_dest_set() when using the drag-motion signal that way. Also note that there is no drag-enter signal. The drag receiver has to keep track of whether he has received any drag-motion signals since the last #GtkWidget::drag-leave and if not, treat the drag-motion signal as an "enter" signal. Upon an "enter", the handler will typically highlight the drop site with gtk_drag_highlight(). |[ static void drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time) { GdkAtom target; PrivateData *private_data = GET_PRIVATE_DATA (widget); if (!private_data->drag_highlight) { private_data->drag_highlight = 1; gtk_drag_highlight (widget); } target = gtk_drag_dest_find_target (widget, context, NULL); if (target == GDK_NONE) gdk_drag_status (context, 0, time); else { private_data->pending_status = context->suggested_action; gtk_drag_get_data (widget, context, target, time); } return TRUE; } static void drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time) { PrivateData *private_data = GET_PRIVATE_DATA (widget); if (private_data->suggested_action) { private_data->suggested_action = 0; /&ast; We are getting this data due to a request in drag_motion, * rather than due to a request in drag_drop, so we are just * supposed to call gdk_drag_status (), not actually paste in * the data. &ast;/ str = gtk_selection_data_get_text (selection_data); if (!data_is_acceptable (str)) gdk_drag_status (context, 0, time); else gdk_drag_status (context, private_data->suggested_action, time); } else { /&ast; accept the drop &ast;/ } } ]|

bool"button-press-event"(self, widget, event)

The ::button-press-event signal will be emitted when a button (typically from a mouse) is pressed. To receive this signal, the #GdkWindow associated to the widget needs to enable the #GDK_BUTTON_PRESS_MASK mask. This signal will be sent to the grab widget if there is one. %FALSE to propagate the event further.

Methods

booldrag_check_threshold(start_x, start_y, current_x, current_y)

voiddrag_dest_add_image_targets()

voiddrag_dest_add_text_targets()

voiddrag_dest_add_uri_targets()

Gdk.Atomdrag_dest_find_target(context, target_list)

Gtk.TargetListdrag_dest_get_target_list()

booldrag_dest_get_track_motion()

voiddrag_dest_set(flags, targets, n_targets, actions)

voiddrag_dest_set_proxy(proxy_window, protocol, use_coordinates)

voiddrag_dest_set_target_list(target_list)

voiddrag_dest_set_track_motion(track_motion)

voiddrag_dest_unset()

voiddrag_get_data(context, target, time_)

voiddrag_highlight()

voiddrag_source_add_image_targets()

voiddrag_source_add_text_targets()

voiddrag_source_add_uri_targets()

Gtk.TargetListdrag_source_get_target_list()

voiddrag_source_set(start_button_mask, targets, n_targets, actions)

voiddrag_source_set_icon_name(icon_name)

voiddrag_source_set_icon_pixbuf(pixbuf)

voiddrag_source_set_icon_stock(stock_id)

voiddrag_source_set_target_list(target_list)

voiddrag_source_unset()

voiddrag_unhighlight()

voidgrab_add()

voidgrab_remove()

boolactivate()

voidadd_accelerator(accel_signal, accel_group, accel_key, accel_mods, accel_flags)

voidadd_device_events(device, events)

voidadd_events(events)

voidadd_mnemonic_label(label)

voidadjust_size_allocation(orientation, minimum_size, natural_size, allocated_pos, allocated_size)

voidadjust_size_request(orientation, minimum_size, natural_size)

boolbutton_press_event(event)

boolbutton_release_event(event)

boolcan_activate_accel(signal_id)

boolchild_focus(direction)

voidchild_notify(pspec)

void, int, string, stringclass_path()

voidcomposited_changed()

voidcompute_expand(hexpand_p, vexpand_p)

boolconfigure_event(event)

Pango.Contextcreate_pango_context()

Pango.Layoutcreate_pango_layout(text)

booldamage_event(event)

booldelete_event(event)

voiddestroy()

booldestroy_event(event)

voiddestroyed(widget_pointer)

booldevice_is_shadowed(device)

voiddirection_changed(previous_direction)

voiddispatch_child_properties_changed(n_pspecs, pspecs)

voiddrag_begin(context)

voiddrag_data_delete(context)

voiddrag_data_get(context, selection_data, info, time_)

voiddrag_data_received(context, x, y, selection_data, info, time_)

booldrag_drop(context, x, y, time_)

voiddrag_end(context)

booldrag_failed(context, result)

voiddrag_leave(context, time_)

booldrag_motion(context, x, y, time_)

booldraw(cr)

voidensure_style()

boolenter_notify_event(event)

voiderror_bell()

boolevent(event)

boolfocus(direction)

boolfocus_in_event(event)

boolfocus_out_event(event)

voidfreeze_child_notify()

Atk.Objectget_accessible()

intget_allocated_height()

intget_allocated_width()

void, Gtk.Allocationget_allocation()

Gtk.Widgetget_ancestor(widget_type)

boolget_app_paintable()

boolget_can_default()

boolget_can_focus()

void, Gtk.Requisitionget_child_requisition()

boolget_child_visible()

Gtk.Clipboardget_clipboard(selection)

stringget_composite_name()

Gtk.TextDirectionget_default_direction()(static method)

Gtk.Styleget_default_style()(static method)

boolget_device_enabled(device)

Gdk.EventMaskget_device_events(device)

Gtk.TextDirectionget_direction()

Gdk.Displayget_display()

boolget_double_buffered()

intget_events()

Gtk.Alignget_halign()

boolget_has_tooltip()

boolget_has_window()

boolget_hexpand()

boolget_hexpand_set()

boolget_mapped()

intget_margin_bottom()

intget_margin_left()

intget_margin_right()

intget_margin_top()

Gtk.RcStyleget_modifier_style()

stringget_name()

boolget_no_show_all()

Pango.Contextget_pango_context()

Gtk.Widgetget_parent()

Gdk.Windowget_parent_window()

Gtk.WidgetPathget_path()

void, int, intget_pointer()

void, int, intget_preferred_height()

void, int, intget_preferred_height_for_width(width)

void, Gtk.Requisition, Gtk.Requisitionget_preferred_size()

void, int, intget_preferred_width()

void, int, intget_preferred_width_for_height(height)

boolget_realized()

boolget_receives_default()

Gtk.SizeRequestModeget_request_mode()

void, Gtk.Requisitionget_requisition()

Gdk.Windowget_root_window()

Gdk.Screenget_screen()

boolget_sensitive()

Gtk.Settingsget_settings()

void, int, intget_size_request()

Gtk.StateTypeget_state()

Gtk.StateFlagsget_state_flags()

Gtk.Styleget_style()

Gtk.StyleContextget_style_context()

boolget_support_multidevice()

stringget_tooltip_markup()

stringget_tooltip_text()

Gtk.Windowget_tooltip_window()

Gtk.Widgetget_toplevel()

Gtk.Alignget_valign()

boolget_vexpand()

boolget_vexpand_set()

boolget_visible()

Gdk.Visualget_visual()

Gdk.Windowget_window()

boolgrab_broken_event(event)

voidgrab_default()

voidgrab_focus()

voidgrab_notify(was_grabbed)

boolhas_default()

boolhas_focus()

boolhas_grab()

boolhas_rc_style()

boolhas_screen()

voidhide()

boolhide_on_delete()

voidhierarchy_changed(previous_toplevel)

boolin_destruction()

voidinput_shape_combine_region(region)

boolintersect(area, intersection)

boolis_ancestor(ancestor)

boolis_composited()

boolis_drawable()

boolis_focus()

boolis_sensitive()

boolis_toplevel()

boolkey_press_event(event)

boolkey_release_event(event)

boolkeynav_failed(direction)

boolleave_notify_event(event)

GLib.Listlist_accel_closures()

GLib.Listlist_mnemonic_labels()

voidmap()

boolmap_event(event)

boolmnemonic_activate(group_cycling)

voidmodify_base(state, color)

voidmodify_bg(state, color)

voidmodify_cursor(primary, secondary)

voidmodify_fg(state, color)

voidmodify_font(font_desc)

voidmodify_style(style)

voidmodify_text(state, color)

boolmotion_notify_event(event)

voidmove_focus(direction)

voidoverride_background_color(state, color)

voidoverride_color(state, color)

voidoverride_cursor(cursor, secondary_cursor)

voidoverride_font(font_desc)

voidoverride_symbolic_color(name, color)

voidparent_set(previous_parent)

void, int, string, stringpath()

voidpop_composite_child()(static method)

boolpopup_menu()

boolproperty_notify_event(event)

boolproximity_in_event(event)

boolproximity_out_event(event)

voidpush_composite_child()(static method)

boolquery_tooltip(x, y, keyboard_tooltip, tooltip)

voidqueue_compute_expand()

voidqueue_draw()

voidqueue_draw_area(x, y, width, height)

voidqueue_draw_region(region)

voidqueue_resize()

voidqueue_resize_no_redraw()

voidrealize()

cairo.Regionregion_intersect(region)

boolremove_accelerator(accel_group, accel_key, accel_mods)

voidremove_mnemonic_label(label)

GdkPixbuf.Pixbufrender_icon(stock_id, size, detail)

GdkPixbuf.Pixbufrender_icon_pixbuf(stock_id, size)

voidreparent(new_parent)

voidreset_rc_styles()

voidreset_style()

voidscreen_changed(previous_screen)

boolscroll_event(event)

boolselection_clear_event(event)

voidselection_get(selection_data, info, time_)

boolselection_notify_event(event)

voidselection_received(selection_data, time_)

boolselection_request_event(event)

intsend_expose(event)

boolsend_focus_change(event)

voidset_accel_path(accel_path, accel_group)

voidset_allocation(allocation)

voidset_app_paintable(app_paintable)

voidset_can_default(can_default)

voidset_can_focus(can_focus)

voidset_child_visible(is_visible)

voidset_composite_name(name)

voidset_default_direction(dir)(static method)

voidset_device_enabled(device, enabled)

voidset_device_events(device, events)

voidset_direction(dir)

voidset_double_buffered(double_buffered)

voidset_events(events)

voidset_halign(align)

voidset_has_tooltip(has_tooltip)

voidset_has_window(has_window)

voidset_hexpand(expand)

voidset_hexpand_set(set)

voidset_mapped(mapped)

voidset_margin_bottom(margin)

voidset_margin_left(margin)

voidset_margin_right(margin)

voidset_margin_top(margin)

voidset_name(name)

voidset_no_show_all(no_show_all)

voidset_parent(parent)

voidset_parent_window(parent_window)

voidset_realized(realized)

voidset_receives_default(receives_default)

voidset_redraw_on_allocate(redraw_on_allocate)

voidset_sensitive(sensitive)

voidset_size_request(width, height)

voidset_state(state)

voidset_state_flags(flags, clear)

voidset_style(style)

voidset_support_multidevice(support_multidevice)

voidset_tooltip_markup(markup)

voidset_tooltip_text(text)

voidset_tooltip_window(custom_window)

voidset_valign(align)

voidset_vexpand(expand)

voidset_vexpand_set(set)

voidset_visible(visible)

voidset_visual(visual)

voidset_window(window)

voidshape_combine_region(region)

voidshow()

voidshow_all()

boolshow_help(help_type)

voidshow_now()

voidsize_allocate(allocation)

void, Gtk.Requisitionsize_request()

voidstate_changed(previous_state)

voidstate_flags_changed(previous_state_flags)

voidstyle_attach()

voidstyle_get_property(property_name, value)

voidstyle_set(previous_style)

voidstyle_updated()

voidthaw_child_notify()

bool, int, inttranslate_coordinates(dest_widget, src_x, src_y)

voidtrigger_tooltip_query()

voidunmap()

boolunmap_event(event)

voidunparent()

voidunrealize()

voidunset_state_flags(flags)

boolvisibility_notify_event(event)

boolwindow_state_event(event)

Class: Gtk.Window

Implements: Gtk.Buildable, Atk.ImplementorIface

Known subclasses: Gtk.OffscreenWindow, Gtk.Plug, Gtk.Dialog, Gtk.Assistant

Subclass of: Gtk.Bin

A GtkWindow is a toplevel window which can contain other widgets. Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,...). GTK+ also allows windows to have a resize grip (a small area in the lower right or left corner) which can be clicked to reszie the window. To control whether a window has a resize grip, use gtk_window_set_has_resize_grip(). <refsect2 id="GtkWindow-BUILDER-UI"> <title>GtkWindow as GtkBuildable</title> <para> The GtkWindow implementation of the GtkBuildable interface supports a custom <tag class="starttag">accel-groups</tag> element, which supports any number of <tag class="starttag">group</tag> elements representing the #GtkAccelGroup objects you want to add to your window (synonymous with gtk_window_add_accel_group(). </para> <example> <title>A UI definition fragment with accel groups</title> <programlisting><![CDATA[ <object class="GtkWindow"> <accel-groups> <group name="accelgroup1"/> </accel-groups> </object> <!-- --> ... <!-- --> <object class="GtkAccelGroup" id="accelgroup1"/> ]]></programlisting> </example> </refsect2>

Properties

string"startup-id"read/write

The :startup-id is a write-only property for setting window's startup notification identifier. See gtk_window_set_startup_id() for more details.

string"icon-name"read/write

The :icon-name property specifies the name of the themed icon to use as the window icon. See #GtkIconTheme for more details.

Gdk.WindowTypeHint"type-hint"read/write

bool"accept-focus"read/write

Whether the window should receive the input focus.

bool"has-toplevel-focus"read-only

int"default-height"read/write

bool"resize-grip-visible"read-only

Whether a corner resize grip is currently shown.

Gdk.Gravity"gravity"read/write

The window gravity of the window. See gtk_window_move() and #GdkGravity for more details about window gravity.

Gtk.Application"application"read/write

The #GtkApplication associated with the window. The application will be kept alive for at least as long as it has any windows associated with it (see g_application_hold() for a way to keep it alive without windows). Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the ::application property to %NULL.

bool"is-active"read-only

string"role"read/write

bool"skip-taskbar-hint"read/write

Gtk.Window"transient-for"construct-only

The transient parent of the window. See gtk_window_set_transient_for() for more details about transient windows.

Gtk.WindowPosition"window-position"read/write

Gtk.WindowType"type"construct-only

float"opacity"read/write

The requested opacity of the window. See gtk_window_set_opacity() for more details about window opacity.

bool"resizable"read/write

Gdk.Screen"screen"read/write

bool"destroy-with-parent"read/write

bool"deletable"read/write

Whether the window frame should have a close button.

int"default-width"read/write

bool"decorated"read/write

Whether the window should be decorated by the window manager.

GdkPixbuf.Pixbuf"icon"read/write

bool"has-resize-grip"read/write

Whether the window has a corner resize grip. Note that the resize grip is only shown if the window is actually resizable and not maximized. Use #GtkWindow:resize-grip-visible to find out if the resize grip is currently shown.

string"title"read/write

bool"urgency-hint"read/write

bool"mnemonics-visible"read/write

bool"skip-pager-hint"read/write

bool"modal"read/write

bool"focus-on-map"read/write

Whether the window should receive the input focus when mapped.

Signals

void"activate-focus"(self, window)

The ::activate-focus signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user activates the currently focused widget of @window.

void"activate-default"(self, window)

The ::activate-default signal is a <link linkend="keybinding-signals">keybinding signal</link> which gets emitted when the user activates the default widget of @window.

void"set-focus"(self, window, object)

void"keys-changed"(self, window)

The ::keys-changed signal gets emitted when the set of accelerators or mnemonics that are associated with @window changes.

Methods

voidactivate_default()

voidactivate_focus()

boolactivate_key(event)

voidadd_accel_group(accel_group)

voidadd_mnemonic(keyval, target)

voidbegin_move_drag(button, root_x, root_y, timestamp)

voidbegin_resize_drag(edge, button, root_x, root_y, timestamp)

voiddeiconify()

voidfullscreen()

boolget_accept_focus()

Gtk.Applicationget_application()

boolget_decorated()

GLib.Listget_default_icon_list()(static method)

stringget_default_icon_name()(static method)

void, int, intget_default_size()

Gtk.Widgetget_default_widget()

boolget_deletable()

boolget_destroy_with_parent()

Gtk.Widgetget_focus()

boolget_focus_on_map()

Gdk.Gravityget_gravity()

Gtk.WindowGroupget_group()

boolget_has_resize_grip()

GdkPixbuf.Pixbufget_icon()

GLib.Listget_icon_list()

stringget_icon_name()

Gdk.ModifierTypeget_mnemonic_modifier()

boolget_mnemonics_visible()

boolget_modal()

floatget_opacity()

void, int, intget_position()

boolget_resizable()

bool, Gdk.Rectangleget_resize_grip_area()

stringget_role()

Gdk.Screenget_screen()

void, int, intget_size()

boolget_skip_pager_hint()

boolget_skip_taskbar_hint()

stringget_title()

Gtk.Windowget_transient_for()

Gdk.WindowTypeHintget_type_hint()

boolget_urgency_hint()

Gtk.WindowTypeget_window_type()

boolhas_group()

boolhas_toplevel_focus()

voidiconify()

boolis_active()

voidkeys_changed()

GLib.Listlist_toplevels()(static method)

voidmaximize()

boolmnemonic_activate(keyval, modifier)

voidmove(x, y)

boolparse_geometry(geometry)

voidpresent()

voidpresent_with_time(timestamp)

boolpropagate_key_event(event)

voidremove_accel_group(accel_group)

voidremove_mnemonic(keyval, target)

voidreshow_with_initial_size()

voidresize(width, height)

boolresize_grip_is_visible()

voidresize_to_geometry(width, height)

voidset_accept_focus(setting)

voidset_application(application)

voidset_auto_startup_notification(setting)(static method)

voidset_decorated(setting)

voidset_default(default_widget)

voidset_default_geometry(width, height)

voidset_default_icon(icon)(static method)

boolset_default_icon_from_file(filename)(static method)

voidset_default_icon_list(list)(static method)

voidset_default_icon_name(name)(static method)

voidset_default_size(width, height)

voidset_deletable(setting)

voidset_destroy_with_parent(setting)

voidset_focus(focus)

voidset_focus_on_map(setting)

voidset_geometry_hints(geometry_widget, geometry, geom_mask)

voidset_gravity(gravity)

voidset_has_resize_grip(value)

voidset_has_user_ref_count(setting)

voidset_icon(icon)

boolset_icon_from_file(filename)

voidset_icon_list(list)

voidset_icon_name(name)

voidset_keep_above(setting)

voidset_keep_below(setting)

voidset_mnemonic_modifier(modifier)

voidset_mnemonics_visible(setting)

voidset_modal(modal)

voidset_opacity(opacity)

voidset_position(position)

voidset_resizable(resizable)

voidset_role(role)

voidset_screen(screen)

voidset_skip_pager_hint(setting)

voidset_skip_taskbar_hint(setting)

voidset_startup_id(startup_id)

voidset_title(title)

voidset_transient_for(parent)

voidset_type_hint(hint)

voidset_urgency_hint(setting)

voidset_wmclass(wmclass_name, wmclass_class)

voidstick()

voidunfullscreen()

voidunmaximize()

voidunstick()

Class: Gtk.WindowGroup

Subclass of: GObject.Object

Methods

voidadd_window(window)

Gtk.Widgetget_current_device_grab(device)

Gtk.Widgetget_current_grab()

GLib.Listlist_windows()

voidremove_window(window)