Protocols
The following protocols are available globally.
-
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.
Accelerators ##
Accelerators are handled by the GTK+ accelerator map. All actions are assigned an accelerator path (which normally has the form
<Actions>/group-name/action-name
) 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.GtkActionGroup as GtkBuildable #
The
GtkActionGroup
implementation of theGtkBuildable
interface acceptsGtkAction
objects as <child> 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 <accelerator> element, which has attributes named “key“ and “modifiers“ and allows to specify accelerators. This is similar to the <accelerator> element of
GtkWidget
, the main difference is that it doesn’t allow you to specify a signal.A
GtkDialog
UI definition fragment.<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>
The
See moreActionGroupProtocol
protocol exposes the methods and properties of an underlyingGtkActionGroup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionGroup
. Alternatively, useActionGroupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionGroupProtocol : ObjectProtocol, BuildableProtocol
-
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, session management, provides some basic scriptability and desktop shell integration by exporting actions and menus and manages a list of toplevel windows whose life-cycle is automatically tied to the life-cycle of your application.
While GtkApplication works fine with plain
GtkWindows
, it is recommended to use it together withGtkApplicationWindow
.When GDK threads are enabled, GtkApplication will acquire the GDK lock when invoking actions that arrive from other processes. The GDK lock is not touched for local action invocations. In order to have actions invoked in a predictable context it is therefore recommended that the GDK lock be held while invoking actions locally with
g_action_group_activate_action()
. The same applies to actions associated withGtkApplicationWindow
and to the “activate” and “open”GApplication
methods.Automatic resources ##
GtkApplication
will automatically load menus from theGtkBuilder
resource located at “gtk/menus.ui”, relative to the application’s resource base path (seeg_application_set_resource_base_path()
). The menu with the ID “app-menu” is taken as the application’s app menu and the menu with the ID “menubar” is taken as the application’s menubar. Additional menus (most interesting submenus) can be named and accessed viagtk_application_get_menu_by_id()
which allows for dynamic population of a part of the menu structure.If the resources “gtk/menus-appmenu.ui” or “gtk/menus-traditional.ui” are present then these files will be used in preference, depending on the value of
gtk_application_prefers_app_menu()
. If the resource “gtk/menus-common.ui” is present it will be loaded as well. This is useful for storing items that are referenced from both “gtk/menus-appmenu.ui” and “gtk/menus-traditional.ui”.It is also possible to provide the menus manually using
gtk_application_set_app_menu()
andgtk_application_set_menubar()
.GtkApplication
will also automatically setup an icon search path for the default icon theme by appending “icons” to the resource base path. This allows your application to easily store its icons as resources. Seegtk_icon_theme_add_resource_path()
for more information.If there is a resource located at “gtk/help-overlay.ui” which defines a
GtkShortcutsWindow
with ID “help_overlay” then GtkApplication associates an instance of this shortcuts window with eachGtkApplicationWindow
and sets up keyboard accelerators (Control-F1 and Control-?) to open it. To create a menu item that displays the shortcuts window, associate the item with the action win.show-help-overlay.A simple application ##
GtkApplication optionally registers with a session manager of the users session (if you set the
GtkApplication:register-session
property) and offers various functionality related to the session life-cycle.An application can block various ways to end the session with the
gtk_application_inhibit()
function. Typical use cases for this kind of inhibiting are long-running, uninterruptible operations, such as burning a CD or performing a disk backup. The session manager may not honor the inhibitor, but it can be expected to inform the user about the negative consequences of ending the session while inhibitors are present.See Also ##
HowDoI: Using GtkApplication, Getting Started with GTK+: Basics
The
See moreApplicationProtocol
protocol exposes the methods and properties of an underlyingGtkApplication
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeApplication
. Alternatively, useApplicationRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ApplicationProtocol : ApplicationProtocol
-
The GtkBox widget arranges child widgets into a single row or column, depending upon the value of its
GtkOrientable:orientation
property. Within the other dimension, all children are allocated the same size. Of course, theGtkWidget:halign
andGtkWidget:valign
properties can be used on the children to influence their allocation.GtkBox uses a notion of packing. Packing refers to adding widgets with reference to a particular position in a
GtkContainer
. For a GtkBox, there are two reference positions: the start and the end of the box. For a verticalGtkBox
, the start is defined as the top of the box and the end is defined as the bottom. For a horizontalGtkBox
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. Usegtk_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 usegtk_container_add()
to insert widgets into the box, and they will be packed with the default values for expand and fill child properties. Usegtk_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 between the children, while padding added bygtk_box_pack_start()
orgtk_box_pack_end()
is added on either side 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 expand, fill and padding child properties. Usegtk_box_query_child_packing()
to query these fields.CSS nodes
GtkBox uses a single CSS node with name box.
In horizontal orientation, the nodes of the children are always arranged from left to right. So :first-child will always select the leftmost child, regardless of text direction.
The
See moreBoxProtocol
protocol exposes the methods and properties of an underlyingGtkBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBox
. Alternatively, useBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BoxProtocol : ContainerProtocol, OrientableProtocol
-
GtkCssProvider is an object implementing the
GtkStyleProvider
interface. It is able to parse CSS-like input in order to style widgets.An application can make GTK+ parse a specific CSS style sheet by calling
gtk_css_provider_load_from_file()
orgtk_css_provider_load_from_resource()
and adding the provider withgtk_style_context_add_provider()
orgtk_style_context_add_provider_for_screen()
.In addition, certain files will be read when GTK+ is initialized. First, the file
$XDG_CONFIG_HOME/gtk-3.0/gtk.css
is loaded if it exists. Then, GTK+ loads the first existing file amongXDG_DATA_HOME/themes/THEME/gtk-VERSION/gtk.css
,$HOME/.themes/THEME/gtk-VERSION/gtk.css
,$XDG_DATA_DIRS/themes/THEME/gtk-VERSION/gtk.css
andDATADIR/share/themes/THEME/gtk-VERSION/gtk.css
, whereTHEME
is the name of the current theme (see theGtkSettings:gtk-theme-name
setting),DATADIR
is the prefix configured when GTK+ was compiled (unless overridden by theGTK_DATA_PREFIX
environment variable), andVERSION
is the GTK+ version number. If no file is found for the current version, GTK+ tries older versions all the way back to 3.0.In the same way, GTK+ tries to load a gtk-keys.css file for the current key theme, as defined by
GtkSettings:gtk-key-theme-name
.The
See moreCssProviderProtocol
protocol exposes the methods and properties of an underlyingGtkCssProvider
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCssProvider
. Alternatively, useCssProviderRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CssProviderProtocol : ObjectProtocol, StyleProviderProtocol
-
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 aGtkFrame
containing aGtkLabel
. If you wanted an image instead of a textual label inside the frame, you might replace theGtkLabel
widget with aGtkImage
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 decorators, which add some kind of functionality to the child. For example, aGtkButton
makes its child into a clickable button; aGtkFrame
draws a frame around its child and aGtkWindow
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 layout. This means that these containers assign sizes and positions to their children. For example, a
GtkHBox
arranges its children in a horizontal row, and aGtkGrid
arranges the widgets it contains in a two-dimensional grid.For implementations of
GtkContainer
the virtual methodGtkContainerClass.forall
()
is always required, since it’s used for drawing and other internal operations on the children. If theGtkContainer
implementation expect to have non internal children it’s needed to implement bothGtkContainerClass.add
()
andGtkContainerClass.remove
()
. If the GtkContainer implementation has internal children, they should be added withgtk_widget_set_parent()
oninit()
and removed withgtk_widget_unparent()
in theGtkWidgetClass.destroy
()
implementation. See more about implementing custom widgets at https://wiki.gnome.org/HowDoI/CustomWidgetsHeight for width geometry management
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 isGTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH
orGTK_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 throughgtk_widget_get_preferred_height_for_width()
. When handling requests in the oppositeGtkSizeRequestMode
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:(C Language Example):
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) ... } }
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:(C Language Example):
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 ... } }
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
get_preferred_height_for_width()
virtual function by first callinggtk_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 ofGtkRequestedSize
structures. Any child spacing should be removed from the inputfor_width
and then the collective size should be allocated using thegtk_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 theGtkRequestedSize
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 andgtk_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 usinggtk_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 GtkWidget’s geometry management section to learn more about implementing height-for-width geometry management for widgets.
Child properties
GtkContainer introduces child properties. 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 andgtk_container_class_find_child_property()
orgtk_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()
orgtk_container_child_set_valist()
. To obtain the value of a child property, usegtk_container_child_get_property()
,gtk_container_child_get()
orgtk_container_child_get_valist()
. To emit notification about child property changes, usegtk_widget_child_notify()
.GtkContainer as GtkBuildable
The GtkContainer implementation of the GtkBuildable interface supports a <packing> element for children, which can contain multiple <property> elements that specify child properties for the child.
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.
Since 3.16, containers can have a <focus-chain> element containing multiple <widget> elements, one for each child that should be added to the focus chain. The ”name” attribute gives the id of the widget.
An example of these properties in UI definitions:
<object class="GtkBox"> <child> <object class="GtkEntry" id="entry1"/> <packing> <property name="pack-type">start</property> </packing> </child> <child> <object class="GtkEntry" id="entry2"/> </child> <focus-chain> <widget name="entry1"/> <widget name="entry2"/> </focus-chain> </object>
The
See moreContainerProtocol
protocol exposes the methods and properties of an underlyingGtkContainer
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeContainer
. Alternatively, useContainerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ContainerProtocol : WidgetProtocol
-
GtkWidget is the base class all widgets in GTK+ derive from. It manages the widget lifecycle, states and style.
Height-for-width Geometry Management #
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:
GtkWidgetClass.get_request_mode
()
GtkWidgetClass.get_preferred_width
()
GtkWidgetClass.get_preferred_height
()
GtkWidgetClass.get_preferred_height_for_width
()
GtkWidgetClass.get_preferred_width_for_height
()
GtkWidgetClass.get_preferred_height_and_baseline_for_width
()
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 usinggtk_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 usinggtk_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 (unlessgtk_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 aGtkWidget
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 GtkContainer’s geometry management section 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 haveGtkWidgetClass.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, forGtkWidgetClass.get_preferred_height
()
it will do:(C Language Example):
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, nat_width; GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, &nat_width); 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. } }
And in
GtkWidgetClass.get_preferred_width_for_height
()
it will simply return the minimum and natural width: (C Language Example):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. } }
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:
(C Language Example):
GTK_WIDGET_GET_CLASS(widget)->get_preferred_width (widget, &min, &natural);
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 byGtkSizeGroup
and by theGtkWidgetClass.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 another widget, such as a child of a container, you must use the wrapper APIs. Otherwise, you would not properly consider widget margins,
GtkSizeGroup
, and so forth.Since 3.10 GTK+ also supports baseline vertical alignment of widgets. This means that widgets are positioned such that the typographical baseline of widgets in the same row are aligned. This happens if a widget supports baselines, has a vertical alignment of
GTK_ALIGN_BASELINE
, and is inside a container that supports baselines and has a natural “row” that it aligns to the baseline, or a baseline assigned to it by the grandparent.Baseline alignment support for a widget is done by the
GtkWidgetClass.get_preferred_height_and_baseline_for_width
()
virtual function. It allows you to report a baseline in combination with the minimum and natural height. If there is no baseline you can return -1 to indicate this. The default implementation of this virtual function calls into theGtkWidgetClass.get_preferred_height
()
andGtkWidgetClass.get_preferred_height_for_width
()
, so if baselines are not supported it doesn’t need to be implemented.If a widget ends up baseline aligned it will be allocated all the space in the parent as if it was
GTK_ALIGN_FILL
, but the selected baseline can be found viagtk_widget_get_allocated_baseline()
. If this has a value other than -1 you need to align the widget such that the baseline appears at the position.Style Properties
GtkWidget
introduces “style properties” - 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 resource files. 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.Use
gtk_widget_class_install_style_property()
to install style properties for a widget class,gtk_widget_class_find_style_property()
orgtk_widget_class_list_style_properties()
to get information about existing style properties andgtk_widget_style_get_property()
,gtk_widget_style_get()
orgtk_widget_style_get_valist()
to obtain the value of a style property.GtkWidget as GtkBuildable
The GtkWidget implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named ”key”, ”modifiers” and ”signal” and allows to specify accelerators.
An example of a UI definition fragment specifying an accelerator:
<object class="GtkButton"> <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/> </object>
In addition to accelerators, GtkWidget also support a custom <accessible> 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
GtkWidget
.An example of a UI definition fragment specifying an accessible:
<object class="GtkLabel" 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="accessible-name">Clickable Button</property> </object> </child> </object>
Finally, GtkWidget allows style information such as style classes to be associated with widgets, using the custom <style> element:
<object class="GtkButton" id="button1"> <style> <class name="my-special-button-class"/> <class name="dark-button"/> </style> </object>
Building composite widgets from template XML ##
GtkWidget exposes some facilities to automate the procedure of creating composite widgets using
GtkBuilder
interface description language.To create composite widgets with
GtkBuilder
XML, one must associate the interface description with the widget class at class initialization time usinggtk_widget_class_set_template()
.The interface description semantics expected in composite template descriptions is slightly different from regular
GtkBuilder
XML.Unlike regular interface descriptions,
gtk_widget_class_set_template()
will expect a <template> tag as a direct child of the toplevel <interface> tag. The <template> tag must specify the “class” attribute which must be the type name of the widget. Optionally, the “parent” attribute may be specified to specify the direct parent type of the widget type, this is ignored by the GtkBuilder but required for Glade to introspect what kind of properties and internal children exist for a given type when the actual type does not exist.The XML which is contained inside the <template> tag behaves as if it were added to the <object> tag defining
widget
itself. You may set properties onwidget
by inserting <property> tags into the <template> tag, and also add <child> tags to add children and extendwidget
in the normal way you would with <object> tags.Additionally, <object> tags can also be added before and after the initial <template> tag in the normal way, allowing one to define auxiliary objects which might be referenced by other widgets declared as children of the <template> tag.
An example of a GtkBuilder Template Definition:
<interface> <template class="FooWidget" parent="GtkBox"> <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> <property name="spacing">4</property> <child> <object class="GtkButton" id="hello_button"> <property name="label">Hello World</property> <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/> </object> </child> <child> <object class="GtkButton" id="goodbye_button"> <property name="label">Goodbye World</property> </object> </child> </template> </interface>
Typically, you’ll place the template fragment into a file that is bundled with your project, using
GResource
. In order to load the template, you need to callgtk_widget_class_set_template_from_resource()
from the class initialization of yourGtkWidget
type:(C Language Example):
static void foo_widget_class_init (FooWidgetClass *klass) { // ... gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/example/ui/foowidget.ui"); }
You will also need to call
gtk_widget_init_template()
from the instance initialization function:(C Language Example):
static void foo_widget_init (FooWidget *self) { // ... gtk_widget_init_template (GTK_WIDGET (self)); }
You can access widgets defined in the template using the
gtk_widget_get_template_child()
function, but you will typically declare a pointer in the instance private data structure of your type using the same name as the widget in the template definition, and callgtk_widget_class_bind_template_child_private()
with that name, e.g.(C Language Example):
typedef struct { GtkWidget *hello_button; GtkWidget *goodbye_button; } FooWidgetPrivate; G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX) static void foo_widget_class_init (FooWidgetClass *klass) { // ... gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/example/ui/foowidget.ui"); gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), FooWidget, hello_button); gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), FooWidget, goodbye_button); } static void foo_widget_init (FooWidget *widget) { }
You can also use
gtk_widget_class_bind_template_callback()
to connect a signal callback defined in the template with a function visible in the scope of the class, e.g.(C Language Example):
// the signal handler has the instance and user data swapped // because of the swapped="yes" attribute in the template XML static void hello_button_clicked (FooWidget *self, GtkButton *button) { g_print ("Hello, world!\n"); } static void foo_widget_class_init (FooWidgetClass *klass) { // ... gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/example/ui/foowidget.ui"); gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked); }
The
See moreWidgetProtocol
protocol exposes the methods and properties of an underlyingGtkWidget
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWidget
. Alternatively, useWidgetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WidgetProtocol : ImplementorIfaceProtocol, InitiallyUnownedProtocol, BuildableProtocol
-
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
About
option from theHelp
menu. All parts of the dialog are optional.About dialogs often contain links and email addresses. GtkAboutDialog displays these as clickable links. By default, it calls
gtk_show_uri_on_window()
when a user clicks one. The behaviour can be overridden with theGtkAboutDialog::activate-link
signal.To specify a person with an email address, use a string like “Edgar Allan Poe <edgar`poe.com`>”. To specify a website with a title, use a string like “GTK+ team http://www.gtk.org”.
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
_("About %s")
on the dialog window (where `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: (C Language Example):GdkPixbuf *example_logo = gdk_pixbuf_new_from_file ("./logo.png", NULL); gtk_show_about_dialog (NULL, "program-name", "ExampleCode", "logo", example_logo, "title", _("About ExampleCode"), NULL);
It is also possible to show a
GtkAboutDialog
like any otherGtkDialog
, e.g. usinggtk_dialog_run()
. In this case, you might need to know that the “Close” button returns theGTK_RESPONSE_CANCEL
response id.The
See moreAboutDialogProtocol
protocol exposes the methods and properties of an underlyingGtkAboutDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAboutDialog
. Alternatively, useAboutDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AboutDialogProtocol : DialogProtocol
-
A
GtkAccelGroup
represents a group of keyboard accelerators, typically attached to a toplevelGtkWindow
(withgtk_window_add_accel_group()
). Usually you won’t need to create aGtkAccelGroup
directly; instead, when usingGtkUIManager
, GTK+ automatically sets up the accelerators for your menus in the ui manager’sGtkAccelGroup
.Note that “accelerators” are different from “mnemonics”. 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.The
See moreAccelGroupProtocol
protocol exposes the methods and properties of an underlyingGtkAccelGroup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelGroup
. Alternatively, useAccelGroupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelGroupProtocol : ObjectProtocol
-
The
GtkAccelLabel
widget is a subclass ofGtkLabel
that also displays an accelerator key on the right of the label text, e.g. “Ctrl+S”. It is commonly used in menus to show the keyboard short-cuts for commands.The accelerator key to display is typically not set explicitly (although it can be, with
gtk_accel_label_set_accel()
). Instead, theGtkAccelLabel
displays the accelerators which have been added to a particular widget. This widget is set by callinggtk_accel_label_set_accel_widget()
.For example, a
GtkMenuItem
widget may have an accelerator added to emit the “activate” signal when the “Ctrl+S” key combination is pressed. AGtkAccelLabel
is created and added to theGtkMenuItem
, andgtk_accel_label_set_accel_widget()
is called with theGtkMenuItem
as the second argument. TheGtkAccelLabel
will now display “Ctrl+S” after its label.Note that creating a
GtkMenuItem
withgtk_menu_item_new_with_label()
(or one of the similar functions forGtkCheckMenuItem
andGtkRadioMenuItem
) automatically adds aGtkAccelLabel
to theGtkMenuItem
and callsgtk_accel_label_set_accel_widget()
to set it up for you.A
GtkAccelLabel
will only display accelerators which haveGTK_ACCEL_VISIBLE
set (seeGtkAccelFlags
). AGtkAccelLabel
can display multiple accelerators and even signal names, though it is almost always used to display just one accelerator key.Creating a simple menu item with an accelerator key.
(C Language Example):
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); GtkWidget *menu = gtk_menu_new (); 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_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
CSS nodes
(plain Language Example):
label ╰── accelerator
Like
GtkLabel
, GtkAccelLabel has a main CSS node with the name label. It adds a subnode with name accelerator.The
See moreAccelLabelProtocol
protocol exposes the methods and properties of an underlyingGtkAccelLabel
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelLabel
. Alternatively, useAccelLabelRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelLabelProtocol : LabelProtocol
-
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.An accelerator is uniquely defined by:
- accelerator path
- accelerator key
- accelerator modifiers
The accelerator path must consist of “<WINDOWTYPE>/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: “<Gimp-Toolbox>/File/Dialogs/Tool Options…”.
All accelerators are stored inside one global
GtkAccelMap
that can be obtained usinggtk_accel_map_get()
. See Monitoring changes for additional details.Manipulating accelerators
New accelerators can be added using
gtk_accel_map_add_entry()
. To search for specific accelerator, usegtk_accel_map_lookup_entry()
. Modifications of existing accelerators should be done usinggtk_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 usinggtk_accel_map_unlock_path()
.Saving and loading accelerator maps
Accelerator maps can be saved to and loaded from some external resource. For simple saving and loading from file,
gtk_accel_map_save()
andgtk_accel_map_load()
are provided. Saving and loading can also be done by providing file descriptor togtk_accel_map_save_fd()
andgtk_accel_map_load_fd()
.Monitoring changes
GtkAccelMap
object is only useful for monitoring changes of accelerators. By connecting toGtkAccelMap::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 theGtkAccelMap::changed
signal.The
See moreAccelMapProtocol
protocol exposes the methods and properties of an underlyingGtkAccelMap
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelMap
. Alternatively, useAccelMapRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelMapProtocol : ObjectProtocol
-
The
GtkAccessible
class is the base class for accessible implementations forGtkWidget
subclasses. It is a thin wrapper aroundAtkObject
, which adds facilities for associating a widget with its accessible object.An accessible implementation for a third-party widget should derive from
GtkAccessible
and implement the suitable interfaces from ATK, such asAtkText
orAtkSelection
. To establish the connection between the widget class and its corresponding acccessible implementation, override the get_accessible vfunc inGtkWidgetClass
.The
See moreAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccessible
. Alternatively, useAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccessibleProtocol : ObjectProtocol
-
> In GTK+ 3.10, GtkAction has been deprecated. Use
GAction
> instead, and associate actions withGtkActionable
widgets. Use >GMenuModel
for creating menus withgtk_menu_new_from_model()
.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:
a name (not translated, for path lookup)
a label (translated, for display)
an accelerator
whether label indicates a stock id
a tooltip (optional, translated)
a toolbar label (optional, shorter than label)
The action will also have some state information:
visible (shown/hidden)
sensitive (enabled/disabled)
Apart from regular actions, there are toggle actions, which can be toggled between two states and radio actions, 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 areGtkAction:sensitive
andGtkAction:visible
.GtkAction:gicon
,GtkAction:icon-name
,GtkAction:label
,GtkAction:short-label
andGtkAction:stock-id
properties are only mirorred if proxy widget hasGtkActivatable:use-action-appearance
property set totrue
.When the proxy is activated, it should activate its action.
The
See moreActionProtocol
protocol exposes the methods and properties of an underlyingGtkAction
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAction
. Alternatively, useActionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionProtocol : ObjectProtocol, BuildableProtocol
-
GtkActionBar is designed to present contextual actions. It is expected to be displayed below the content and expand horizontally to fill the area.
It allows placing children at the start or the end. In addition, it contains an internal centered box which is centered with respect to the full width of the box, even if the children at either side take up different amounts of space.
CSS nodes
GtkActionBar has a single CSS node with name actionbar.
The
See moreActionBarProtocol
protocol exposes the methods and properties of an underlyingGtkActionBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionBar
. Alternatively, useActionBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionBarProtocol : BinProtocol
-
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, includingGtkSpinButton
,GtkViewport
, andGtkRange
(which is a base class forGtkScrollbar
andGtkScale
).The
GtkAdjustment
object does not update the value itself. Instead it is left up to the owner of theGtkAdjustment
to control the value.The
See moreAdjustmentProtocol
protocol exposes the methods and properties of an underlyingGtkAdjustment
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAdjustment
. Alternatively, useAdjustmentRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AdjustmentProtocol : InitiallyUnownedProtocol
-
The
GtkAlignment
widget controls the alignment and size of its child widget. It has four settings: xscale, yscale, xalign, and yalign.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.
GtkAlignment has been deprecated in 3.14 and should not be used in newly-written code. The desired effect can be achieved by using the
GtkWidget:halign
,GtkWidget:valign
andGtkWidget:margin
properties on the child widget.The
See moreAlignmentProtocol
protocol exposes the methods and properties of an underlyingGtkAlignment
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAlignment
. Alternatively, useAlignmentRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AlignmentProtocol : BinProtocol
-
The
GtkAppChooserButton
is a widget that lets the user select an application. It implements theGtkAppChooser
interface.Initially, a
GtkAppChooserButton
selects the first application in its list, which will either be the most-recently used application or, ifGtkAppChooserButton:show-default-item
istrue
, the default application.The list of applications shown in a
GtkAppChooserButton
includes the recommended applications for the given content type. WhenGtkAppChooserButton:show-default-item
is set, the default application is also included. To let the user chooser other applications, you can set theGtkAppChooserButton:show-dialog-item
property, which allows to open a fullGtkAppChooserDialog
.It is possible to add custom items to the list, using
gtk_app_chooser_button_append_custom_item()
. These items cause theGtkAppChooserButton::custom-item-activated
signal to be emitted when they are selected.To track changes in the selected application, use the
GtkComboBox::changed
signal.The
See moreAppChooserButtonProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooserButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooserButton
. Alternatively, useAppChooserButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserButtonProtocol : AppChooserProtocol, ComboBoxProtocol
-
GtkAppChooserDialog
shows aGtkAppChooserWidget
inside aGtkDialog
.Note that
GtkAppChooserDialog
does not have any interesting methods of its own. Instead, you should get the embeddedGtkAppChooserWidget
usinggtk_app_chooser_dialog_get_widget()
and call its methods if the genericGtkAppChooser
interface is not sufficient for your needs.To set the heading that is shown above the
GtkAppChooserWidget
, usegtk_app_chooser_dialog_set_heading()
.The
See moreAppChooserDialogProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooserDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooserDialog
. Alternatively, useAppChooserDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserDialogProtocol : AppChooserProtocol, DialogProtocol
-
GtkAppChooserWidget
is a widget for selecting applications. It is the main building block forGtkAppChooserDialog
. 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.GtkAppChooserWidget
offers detailed control over what applications are shown, using theGtkAppChooserWidget:show-default
,GtkAppChooserWidget:show-recommended
,GtkAppChooserWidget:show-fallback
,GtkAppChooserWidget:show-other
andGtkAppChooserWidget:show-all
properties. See theGtkAppChooser
documentation for more information about these groups of applications.To keep track of the selected application, use the
GtkAppChooserWidget::application-selected
andGtkAppChooserWidget::application-activated
signals.CSS nodes
GtkAppChooserWidget has a single CSS node with name appchooser.
The
See moreAppChooserWidgetProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooserWidget
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooserWidget
. Alternatively, useAppChooserWidgetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserWidgetProtocol : AppChooserProtocol, BoxProtocol
-
GtkApplicationWindow
is aGtkWindow
subclass that offers some extra functionality for better integration withGtkApplication
features. Notably, it can handle both the application menu as well as the menubar. Seegtk_application_set_app_menu()
andgtk_application_set_menubar()
.This class implements the
GActionGroup
andGActionMap
interfaces, to let you add window-specific actions that will be exported by the associatedGtkApplication
, together with its application-wide actions. Window-specific actions are prefixed with the “win.” prefix and application-wide actions are prefixed with the “app.” prefix. Actions must be addressed with the prefixed name when referring to them from aGMenuModel
.Note that widgets that are placed inside a
GtkApplicationWindow
can also activate these actions, if they implement theGtkActionable
interface.As with
GtkApplication
, the GDK lock will be acquired when processing actions arriving from other processes and should therefore be held when activating actions locally (if GDK threads are enabled).The settings
GtkSettings:gtk-shell-shows-app-menu
andGtkSettings:gtk-shell-shows-menubar
tell GTK+ whether the desktop environment is showing the application menu and menubar models outside the application as part of the desktop shell. For instance, on OS X, both menus will be displayed remotely; on Windows neither will be. gnome-shell (starting with version 3.4) will display the application menu, but not the menubar.If the desktop environment does not display the menubar, then
GtkApplicationWindow
will automatically show aGtkMenuBar
for it. This behaviour can be overridden with theGtkApplicationWindow:show-menubar
property. If the desktop environment does not display the application menu, then it will automatically be included in the menubar or in the windows client-side decorations.A GtkApplicationWindow with a menubar
(C Language Example):
GtkApplication *app = gtk_application_new ("org.gtk.test", 0); GtkBuilder *builder = gtk_builder_new_from_string ( "<interface>" " <menu id='menubar'>" " <submenu label='_Edit'>" " <item label='_Copy' action='win.copy'/>" " <item label='_Paste' action='win.paste'/>" " </submenu>" " </menu>" "</interface>", -1); GMenuModel *menubar = G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")); gtk_application_set_menubar (GTK_APPLICATION (app), menubar); g_object_unref (builder); // ... GtkWidget *window = gtk_application_window_new (app);
Handling fallback yourself
The XML format understood by
GtkBuilder
forGMenuModel
consists of a toplevel<menu>
element, which contains one or more<item>
elements. Each<item>
element contains<attribute>
and<link>
elements with a mandatory name attribute.<link>
elements have the same content model as<menu>
. Instead of<link name="submenu>
or<link name="section">
, you can use<submenu>
or<section>
elements.Attribute values can be translated using gettext, like other
GtkBuilder
content.<attribute>
elements can be marked for translation with atranslatable="yes"
attribute. It is also possible to specify message context and translator comments, using the context and comments attributes. To make use of this, theGtkBuilder
must have been given the gettext domain to use.The following attributes are used when constructing menu items:
- “label”: a user-visible string to display
- “action”: the prefixed name of the action to trigger
- “target”: the parameter to use when activating the action
- “icon” and “verb-icon”: names of icons that may be displayed
- “submenu-action”: name of an action that may be used to determine if a submenu can be opened
- “hidden-when”: a string used to determine when the item will be hidden. Possible values include “action-disabled”, “action-missing”, “macos-menubar”.
The following attributes are used when constructing sections:
- “label”: a user-visible string to use as section heading
- “display-hint”: a string used to determine special formatting for the section. Possible values include “horizontal-buttons”.
- “text-direction”: a string used to determine the
GtkTextDirection
to use when “display-hint” is set to “horizontal-buttons”. Possible values include “rtl”, “ltr”, and “none”.
The following attributes are used when constructing submenus:
- “label”: a user-visible string to display
- “icon”: icon name to display
The
See moreApplicationWindowProtocol
protocol exposes the methods and properties of an underlyingGtkApplicationWindow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeApplicationWindow
. Alternatively, useApplicationWindowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ApplicationWindowProtocol : ActionGroupProtocol, ActionMapProtocol, WindowProtocol
-
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 amended 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 usinggtk_arrow_set()
.GtkArrow has been deprecated; you can simply use a
GtkImage
with a suitable icon name, such as “pan-down-symbolic“. When replacing GtkArrow by an image, pay attention to the fact that GtkArrow is doing automatic flipping betweenGTK_ARROW_LEFT
andGTK_ARROW_RIGHT
, depending on the text direction. To get the same effect with an image, use the icon names “pan-start-symbolic“ and “pan-end-symbolic“, which react to the text direction.The
See moreArrowProtocol
protocol exposes the methods and properties of an underlyingGtkArrow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeArrow
. Alternatively, useArrowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ArrowProtocol : MiscProtocol
-
The
See moreArrowAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkArrowAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeArrowAccessible
. Alternatively, useArrowAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ArrowAccessibleProtocol : ImageProtocol, WidgetAccessibleProtocol
-
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 fromGtkFrame
, so it can draw a label and a frame around the child. The frame will be “shrink-wrapped” to the size of the child.CSS nodes
GtkAspectFrame uses a CSS node with name frame.
The
See moreAspectFrameProtocol
protocol exposes the methods and properties of an underlyingGtkAspectFrame
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAspectFrame
. Alternatively, useAspectFrameRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AspectFrameProtocol : FrameProtocol
-
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 type of each page, in addition to state information like the page completion and committed status.
If you have a case that doesn’t quite fit in
GtkAssistants
way of handling buttons, you can use theGTK_ASSISTANT_PAGE_CUSTOM
page type and handle buttons yourself.GtkAssistant as GtkBuildable
The GtkAssistant implementation of the
GtkBuildable
interface exposes theaction_area
as internal children with the name “action_area”.To add pages to an assistant in
GtkBuilder
, simply add it as a child to the GtkAssistant object, and set its child properties as necessary.CSS nodes
GtkAssistant has a single CSS node with the name assistant.
The
See moreAssistantProtocol
protocol exposes the methods and properties of an underlyingGtkAssistant
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAssistant
. Alternatively, useAssistantRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AssistantProtocol : WindowProtocol
-
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
, includingGtkWindow
,GtkButton
,GtkFrame
,GtkHandleBox
orGtkScrolledWindow
.The
See moreBinProtocol
protocol exposes the methods and properties of an underlyingGtkBin
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBin
. Alternatively, useBinRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BinProtocol : ContainerProtocol
-
The
See moreAboutDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkAboutDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAboutDialogClass
. Alternatively, useAboutDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AboutDialogClassProtocol
-
The
See moreAccelGroupClassProtocol
protocol exposes the methods and properties of an underlyingGtkAccelGroupClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelGroupClass
. Alternatively, useAccelGroupClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelGroupClassProtocol
-
The
See moreAccelGroupEntryProtocol
protocol exposes the methods and properties of an underlyingGtkAccelGroupEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelGroupEntry
. Alternatively, useAccelGroupEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelGroupEntryProtocol
-
The
See moreAccelKeyProtocol
protocol exposes the methods and properties of an underlyingGtkAccelKey
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelKey
. Alternatively, useAccelKeyRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelKeyProtocol
-
The
See moreAccelLabelClassProtocol
protocol exposes the methods and properties of an underlyingGtkAccelLabelClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelLabelClass
. Alternatively, useAccelLabelClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelLabelClassProtocol
-
The
See moreAccelMapClassProtocol
protocol exposes the methods and properties of an underlyingGtkAccelMapClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccelMapClass
. Alternatively, useAccelMapClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccelMapClassProtocol
-
The
See moreAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAccessibleClass
. Alternatively, useAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AccessibleClassProtocol
-
The
See moreActionBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkActionBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionBarClass
. Alternatively, useActionBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionBarClassProtocol
-
The
See moreActionClassProtocol
protocol exposes the methods and properties of an underlyingGtkActionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionClass
. Alternatively, useActionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionClassProtocol
-
GtkActionEntry
structs are used withgtk_action_group_add_actions()
to construct actions.The
See moreActionEntryProtocol
protocol exposes the methods and properties of an underlyingGtkActionEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionEntry
. Alternatively, useActionEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionEntryProtocol
-
The
See moreActionGroupClassProtocol
protocol exposes the methods and properties of an underlyingGtkActionGroupClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionGroupClass
. Alternatively, useActionGroupClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionGroupClassProtocol
-
The interface vtable for
GtkActionable
.The
See moreActionableInterfaceProtocol
protocol exposes the methods and properties of an underlyingGtkActionableInterface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionableInterface
. Alternatively, useActionableInterfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionableInterfaceProtocol
-
> This method can be called with a
nil
action at times.The
See moreActivatableIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkActivatableIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActivatableIface
. Alternatively, useActivatableIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActivatableIfaceProtocol
-
The
See moreAdjustmentClassProtocol
protocol exposes the methods and properties of an underlyingGtkAdjustmentClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAdjustmentClass
. Alternatively, useAdjustmentClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AdjustmentClassProtocol
-
The
See moreAlignmentClassProtocol
protocol exposes the methods and properties of an underlyingGtkAlignmentClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAlignmentClass
. Alternatively, useAlignmentClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AlignmentClassProtocol
-
The
See moreAppChooserButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooserButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooserButtonClass
. Alternatively, useAppChooserButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserButtonClassProtocol
-
The
See moreAppChooserDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooserDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooserDialogClass
. Alternatively, useAppChooserDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserDialogClassProtocol
-
The
See moreAppChooserWidgetClassProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooserWidgetClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooserWidgetClass
. Alternatively, useAppChooserWidgetClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserWidgetClassProtocol
-
The
See moreApplicationClassProtocol
protocol exposes the methods and properties of an underlyingGtkApplicationClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeApplicationClass
. Alternatively, useApplicationClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ApplicationClassProtocol
-
The
See moreApplicationWindowClassProtocol
protocol exposes the methods and properties of an underlyingGtkApplicationWindowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeApplicationWindowClass
. Alternatively, useApplicationWindowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ApplicationWindowClassProtocol
-
The
See moreArrowAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkArrowAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeArrowAccessibleClass
. Alternatively, useArrowAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ArrowAccessibleClassProtocol
-
The
See moreArrowClassProtocol
protocol exposes the methods and properties of an underlyingGtkArrowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeArrowClass
. Alternatively, useArrowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ArrowClassProtocol
-
The
See moreAspectFrameClassProtocol
protocol exposes the methods and properties of an underlyingGtkAspectFrameClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAspectFrameClass
. Alternatively, useAspectFrameClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AspectFrameClassProtocol
-
The
See moreAssistantClassProtocol
protocol exposes the methods and properties of an underlyingGtkAssistantClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAssistantClass
. Alternatively, useAssistantClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AssistantClassProtocol
-
The
See moreBinClassProtocol
protocol exposes the methods and properties of an underlyingGtkBinClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBinClass
. Alternatively, useBinClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BinClassProtocol
-
This interface provides a convenient way of associating widgets with actions on a
GtkApplicationWindow
orGtkApplication
.It primarily consists of two properties:
GtkActionable:action-name
andGtkActionable:action-target
. There are also some convenience APIs for setting these properties.The action will be looked up in action groups that are found among the widgets ancestors. Most commonly, these will be the actions with the “win.” or “app.” prefix that are associated with the
GtkApplicationWindow
orGtkApplication
, but other action groups that are added withgtk_widget_insert_action_group()
will be consulted as well.The
See moreActionableProtocol
protocol exposes the methods and properties of an underlyingGtkActionable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActionable
. Alternatively, useActionableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActionableProtocol : WidgetProtocol
-
Activatable widgets can be connected to a
GtkAction
and reflects the state of its action. AGtkActivatable
can also provide feedback through its action, as they are responsible for activating their related actions.Implementing GtkActivatable
When extending a class that is already
GtkActivatable
; it is only necessary to implement theGtkActivatable-
>sync_action_properties()
andGtkActivatable-
>update()
methods and chain up to the parent implementation, however when introducing a newGtkActivatable
class; theGtkActivatable:related-action
andGtkActivatable: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 callinggtk_activatable_do_set_related_action()
andgtk_activatable_sync_action_properties()
at the appropriate times.A class fragment implementing
GtkActivatable
(C Language Example):
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)); ... }
The
See moreActivatableProtocol
protocol exposes the methods and properties of an underlyingGtkActivatable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeActivatable
. Alternatively, useActivatableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ActivatableProtocol
-
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 areGtkAppChooserWidget
,GtkAppChooserDialog
andGtkAppChooserButton
.Applications are represented by GIO
GAppInfo
objects here. GIO has a concept of recommended and fallback applications for a given content type. Recommended applications are those that claim to handle the content type itself, while fallback also includes applications that handle a more generic content type. GIO also knows the default and last-used application for a given content type. TheGtkAppChooserWidget
provides detailed control over whether the shown list of applications should include default, recommended or fallback applications.To obtain the application that has been selected in a
GtkAppChooser
, usegtk_app_chooser_get_app_info()
.The
See moreAppChooserProtocol
protocol exposes the methods and properties of an underlyingGtkAppChooser
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeAppChooser
. Alternatively, useAppChooserRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol AppChooserProtocol : WidgetProtocol
-
GtkBuildable allows objects to extend and customize their deserialization from GtkBuilder UI descriptions. 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 of these functions directly.An object only needs to implement this interface if it needs to extend the
GtkBuilder
format or run any extra routines at deserialization time.The
See moreBuildableProtocol
protocol exposes the methods and properties of an underlyingGtkBuildable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBuildable
. Alternatively, useBuildableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BuildableProtocol
-
A
GtkBindingArg
holds the data associated with an argument for a key binding signal emission as stored inGtkBindingSignal
.The
See moreBindingArgProtocol
protocol exposes the methods and properties of an underlyingGtkBindingArg
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBindingArg
. Alternatively, useBindingArgRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BindingArgProtocol
-
Each key binding element of a binding sets binding list is represented by a GtkBindingEntry.
The
See moreBindingEntryProtocol
protocol exposes the methods and properties of an underlyingGtkBindingEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBindingEntry
. Alternatively, useBindingEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BindingEntryProtocol
-
A binding set maintains a list of activatable key bindings. A single binding set can match multiple types of widgets. Similar to style contexts, can be matched by any information contained in a widgets
GtkWidgetPath
. When a binding within a set is matched upon activation, an action signal is emitted on the target widget to carry out the actual activation.The
See moreBindingSetProtocol
protocol exposes the methods and properties of an underlyingGtkBindingSet
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBindingSet
. Alternatively, useBindingSetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BindingSetProtocol
-
A GtkBindingSignal stores the necessary information to activate a widget in response to a key press via a signal emission.
The
See moreBindingSignalProtocol
protocol exposes the methods and properties of an underlyingGtkBindingSignal
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBindingSignal
. Alternatively, useBindingSignalRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BindingSignalProtocol
-
The
See moreBooleanCellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkBooleanCellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBooleanCellAccessibleClass
. Alternatively, useBooleanCellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BooleanCellAccessibleClassProtocol
-
A struct that specifies a border around a rectangular area that can be of different width on each side.
The
See moreBorderProtocol
protocol exposes the methods and properties of an underlyingGtkBorder
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBorder
. Alternatively, useBorderRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BorderProtocol
-
The
See moreBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBoxClass
. Alternatively, useBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BoxClassProtocol
-
The
GtkBuildableIface
interface contains method that are necessary to allowGtkBuilder
to construct an object from aGtkBuilder
UI definition.The
See moreBuildableIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkBuildableIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBuildableIface
. Alternatively, useBuildableIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BuildableIfaceProtocol
-
The
See moreBuilderClassProtocol
protocol exposes the methods and properties of an underlyingGtkBuilderClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBuilderClass
. Alternatively, useBuilderClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BuilderClassProtocol
-
The
See moreButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeButtonAccessibleClass
. Alternatively, useButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ButtonAccessibleClassProtocol
-
The
See moreButtonBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkButtonBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeButtonBoxClass
. Alternatively, useButtonBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ButtonBoxClassProtocol
-
The
See moreButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeButtonClass
. Alternatively, useButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ButtonClassProtocol
-
The
See moreCalendarClassProtocol
protocol exposes the methods and properties of an underlyingGtkCalendarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCalendarClass
. Alternatively, useCalendarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CalendarClassProtocol
-
The
See moreBooleanCellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkBooleanCellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBooleanCellAccessible
. Alternatively, useBooleanCellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BooleanCellAccessibleProtocol : RendererCellAccessibleProtocol
-
A GtkBuilder is an auxiliary object that reads textual descriptions of a user interface and instantiates the described objects. To create a GtkBuilder from a user interface description, call
gtk_builder_new_from_file()
,gtk_builder_new_from_resource()
orgtk_builder_new_from_string()
.In the (unusual) case that you want to add user interface descriptions from multiple sources to the same GtkBuilder you can call
gtk_builder_new()
to get an empty builder and populate it by (multiple) calls togtk_builder_add_from_file()
,gtk_builder_add_from_resource()
orgtk_builder_add_from_string()
.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()
andgtk_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 withgtk_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 withg_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.GtkBuilder UI Definitions #
GtkBuilder parses textual descriptions of user interfaces which are specified in an XML format which can be roughly described by the RELAX NG schema below. We refer to these descriptions as “GtkBuilder UI definitions” or just “UI definitions” if the context is clear. Do not confuse GtkBuilder UI Definitions with GtkUIManager UI Definitions, which are more limited in scope. It is common to use
.ui
as the filename extension for files containing GtkBuilder UI definitions.The toplevel element is <interface>. 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 callinggtk_builder_set_translation_domain()
on the builder. Objects are described by <object> elements, which can contain <property> elements to set properties, <signal> elements which connect signals to handlers, and <child> 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 <child> element contains an <object> element which describes the child object. The target toolkitversion(s)
are described by <requires> 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 “<major>.<minor>”. The builder will error out if the version requirements are not met.Typically, the specific kind of object represented by an <object> element is specified by the “class” attribute. If the type has not been loaded yet, GTK+ tries to find the
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 theget_type()
function explictly with the “type-func” attribute. As a special case, GtkBuilder allows to use an object that has been constructed by aGtkUIManager
in another part of the UI definition by specifying the id of theGtkUIManager
in the “constructor” attribute and the name of the object in the “id” attribute.Objects may 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. GTK+ reserves ids starting and ending with ___ (3 underscores) for its own purposes.Setting properties of objects is pretty straightforward with the <property> 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()
(ordgettext()
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 types: characters, strings, integers, floating-point numbers, booleans (strings like “TRUE”, “t”, “yes”, “y”, “1” are interpreted as
true
, strings like “FALSE”, “f”, “no”, “n”, “0” are interpreted asfalse
), 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 bygdk_rgba_parse()
).GVariants can be specified in the format understood by
g_variant_parse()
, and pixbufs can be specified as a filename of an image file to load.Objects can be referred to by their name and by default refer to objects declared in the local xml fragment and objects exposed via
gtk_builder_expose_object()
. In general, GtkBuilder allows forward references to objects — declared in the local xml; 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.It is also possible to bind a property value to another object’s property value using the attributes “bind-source” to specify the source object of the binding, “bind-property” to specify the source property and optionally “bind-flags” to specify the binding flags. Internally builder implements this using GBinding objects. For more information see
g_object_bind_property()
Signal handlers are set up with the <signal> 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 customGtkBuilderConnectFunc
togtk_builder_connect_signals_full()
. The remaining attributes, “after”, “swapped” and “object”, have the same meaning as the corresponding parameters of theg_signal_connect_object()
org_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 aGtkDialog
). This can be achieved by setting the “internal-child” property of the <child> element to a true value. Note that GtkBuilder still requires an <object> 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 <child> The possible values for the “type” attribute are described in the sections describing the widget-specific portions of UI definitions.
A GtkBuilder UI Definition
<interface> <object class="GtkDialog" id="dialog1"> <child internal-child="vbox"> <object class="GtkBox" id="vbox1"> <property name="border-width">10</property> <child internal-child="action_area"> <object class="GtkButtonBox" 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>
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 <child> element gets parsed by the custom tag handler of the parent object, while a custom element in an <object> element gets parsed by the custom tag handler of the object.
These XML fragments are explained in the documentation of the respective objects.
Additionally, since 3.10 a special <template> tag has been added to the format allowing one to define a widget class’s components. See the GtkWidget documentation for details.
The
See moreBuilderProtocol
protocol exposes the methods and properties of an underlyingGtkBuilder
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBuilder
. Alternatively, useBuilderRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BuilderProtocol : ObjectProtocol
-
The
GtkButton
widget is generally used to trigger a callback function 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 almost any other standardGtkWidget
. The most commonly used child is theGtkLabel
.CSS nodes
GtkButton has a single CSS node with name button. The node will get the style classes .image-button or .text-button, if the content is just an image or label, respectively. It may also receive the .flat style class.
Other style classes that are commonly used with GtkButton include .suggested-action and .destructive-action. In special cases, buttons can be made round by adding the .circular style class.
Button-like widgets like
GtkToggleButton
,GtkMenuButton
,GtkVolumeButton
,GtkLockButton
,GtkColorButton
,GtkFontButton
orGtkFileChooserButton
use style classes such as .toggle, .popup, .scale, .lock, .color, .font, .file to differentiate themselves from a plain GtkButton.The
See moreButtonProtocol
protocol exposes the methods and properties of an underlyingGtkButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeButton
. Alternatively, useButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ButtonProtocol : ActionableProtocol, ActivatableProtocol, BinProtocol
-
The
See moreButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeButtonAccessible
. Alternatively, useButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ButtonAccessibleProtocol : ActionProtocol, ImageProtocol, ContainerAccessibleProtocol
-
The
See moreButtonBoxProtocol
protocol exposes the methods and properties of an underlyingGtkButtonBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeButtonBox
. Alternatively, useButtonBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ButtonBoxProtocol : BoxProtocol
-
GtkCalendar
is a widget that displays a Gregorian calendar, one month at a time. It can be created withgtk_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 usinggtk_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 withgtk_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
usinggtk_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.
The
See moreCalendarProtocol
protocol exposes the methods and properties of an underlyingGtkCalendar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCalendar
. Alternatively, useCalendarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CalendarProtocol : WidgetProtocol
-
The
See moreCellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkCellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAccessible
. Alternatively, useCellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAccessibleProtocol : ActionProtocol, ComponentProtocol, TableCellProtocol, AccessibleProtocol
-
The
GtkCellArea
is an abstract class forGtkCellLayout
widgets (also referred to as “layouting widgets”) to interface with an arbitrary number ofGtkCellRenderers
and interact with the user for a givenGtkTreeModel
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.Requesting area sizes
As outlined in GtkWidget’s geometry management section, 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 ofGtkTreeModel
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 aGtkIconView
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 aGtkCellAreaContext
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 theGtkCellArea
which created it (seegtk_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 sameGtkCellAreaContext
which was used to request the sizes for a givenGtkTreeModel
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:(C Language Example):
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);
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. TheGtkCellLayout
widget in that case would calculate the required width of the rows in an idle or timeout source (seeg_timeout_add()
) and when the widget is requested its actual width inGtkWidgetClass.get_preferred_width
()
it can simply consult the width accumulated so far in theGtkCellAreaContext
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:
(C Language Example):
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); }
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 theGtkCellArea
).In order to request the height for width of all the rows at the root level of a
GtkTreeModel
one would do the following:(C Language Example):
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); }
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 scrollbar values while more and more height is required for the row heights that are calculated in the background.Rendering Areas
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:
(C Language Example):
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); }
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 usinggtk_distribute_natural_allocation()
.Handling Events and Driving Keyboard Focus
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. UsuallyGtkCellArea
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 theGtkCellArea::focus-changed
signal to fire; as well asGtkCellArea::add-editable
in the case that an editable cell was clicked and needs to start editing. You can callgtk_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 toGtkWidget
. For layouting widgets that support giving focus to cells it’s important to remember to passGTK_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 whereGtkTreeModel
rows are rendered inside the widget, so atGtkWidgetClass.focus
()
time the layouting widget should use theGtkCellArea
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:(C Language Example):
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; }
Note that the layouting widget is responsible for matching the GtkDirectionType values to the way it lays out its cells.
Cell Properties
The
GtkCellArea
introduces cell properties forGtkCellRenderers
in very much the same way thatGtkContainer
introduces child properties forGtkWidgets
. This provides some general interfaces for defining the relationship cell areas have with their cells. For instance in aGtkCellAreaBox
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 sameGtkCellAreaContext
.Use
gtk_cell_area_class_install_cell_property()
to install cell properties for a cell area class andgtk_cell_area_class_find_cell_property()
orgtk_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()
orgtk_cell_area_cell_set_valist()
. To obtain the value of a cell property, usegtk_cell_area_cell_get_property()
,gtk_cell_area_cell_get()
orgtk_cell_area_cell_get_valist()
.The
See moreCellAreaProtocol
protocol exposes the methods and properties of an underlyingGtkCellArea
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellArea
. Alternatively, useCellAreaRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAreaProtocol : InitiallyUnownedProtocol, BuildableProtocol, CellLayoutProtocol
-
The
GtkCellAreaBox
renders cell renderers into a row or a column depending on itsGtkOrientation
.GtkCellAreaBox uses a notion of packing. Packing refers to adding cell renderers with reference to a particular position in a
GtkCellAreaBox
. There are two reference positions: the start and the end of the box. When theGtkCellAreaBox
is oriented in theGTK_ORIENTATION_VERTICAL
orientation, the start is defined as the top of the box and the end is defined as the bottom. In theGTK_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 theGtkCellAreaBox
align child cell property withgtk_cell_area_cell_set_property()
or by specifying the “align” argument togtk_cell_area_box_pack_start()
andgtk_cell_area_box_pack_end()
.The
See moreCellAreaBoxProtocol
protocol exposes the methods and properties of an underlyingGtkCellAreaBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAreaBox
. Alternatively, useCellAreaBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAreaBoxProtocol : CellAreaProtocol, OrientableProtocol
-
The
GtkCellAreaContext
object is created by a givenGtkCellArea
implementation via itsGtkCellAreaClass.create_context
()
virtual method and is used to store cell sizes and alignments for a series ofGtkTreeModel
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, it’s important that the same context which was used to request sizes for a givenGtkTreeModel
row also be used for the same row when calling otherGtkCellArea
APIs such asgtk_cell_area_render()
andgtk_cell_area_event()
.The
See moreCellAreaContextProtocol
protocol exposes the methods and properties of an underlyingGtkCellAreaContext
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAreaContext
. Alternatively, useCellAreaContextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAreaContextProtocol : ObjectProtocol
-
The
GtkCellRenderer
is a base class of a set of objects used for rendering a cell to acairo_t
. These objects are used primarily by theGtkTreeView
widget, though they aren’t tied to them in any specific way. It is worth noting thatGtkCellRenderer
is not aGtkWidget
and cannot be treated as such.The primary use of a
GtkCellRenderer
is for drawing a certain graphical elements on acairo_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 usingGObjects
property system. Then, the cell is measured usinggtk_cell_renderer_get_size()
. Finally, the cell is rendered in the correct location usinggtk_cell_renderer_render()
.There are a number of rules that must be followed when writing a new
GtkCellRenderer
. First and foremost, it’s important that a certain set of properties will always yield a cell renderer of the same size, barring aGtkStyle
change. TheGtkCellRenderer
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 “activatable” like
GtkCellRendererToggle
, which toggles when it gets activated by a mouse click, or it can be “editable” likeGtkCellRendererText
, which allows the user to edit the text using a widget implementing theGtkCellEditable
interface, e.g.GtkEntry
. To make a cell renderer activatable or editable, you have to implement theGtkCellRendererClass.activate
orGtkCellRendererClass.start_editing
virtual functions, respectively.Many properties of
GtkCellRenderer
and its subclasses have a corresponding “set” property, e.g. “cell-background-set” corresponds to “cell-background”. These “set” properties reflect whether a property has been set or not. You should not set them independently.The
See moreCellRendererProtocol
protocol exposes the methods and properties of an underlyingGtkCellRenderer
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRenderer
. Alternatively, useCellRendererRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererProtocol : InitiallyUnownedProtocol
-
GtkCellRendererAccel
displays a keyboard accelerator (i.e. a key combination likeControl + a
). If the cell renderer is editable, the accelerator can be changed by simply typing the new combination.The
GtkCellRendererAccel
cell renderer was added in GTK+ 2.10.The
See moreCellRendererAccelProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererAccel
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererAccel
. Alternatively, useCellRendererAccelRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererAccelProtocol : CellRendererTextProtocol
-
GtkCellRendererCombo
renders text in a cell likeGtkCellRendererText
from which it is derived. But whileGtkCellRendererText
offers a simple entry to edit the text,GtkCellRendererCombo
offers aGtkComboBox
widget to edit the text. The values to display in the combo box are taken from the tree model specified in theGtkCellRendererCombo:model
property.The combo cell renderer takes care of adding a text cell renderer to the combo box and sets it to display the column specified by its
GtkCellRendererCombo:text-column
property. Further properties of the combo box can be set in a handler for theGtkCellRenderer::editing-started
signal.The
GtkCellRendererCombo
cell renderer was added in GTK+ 2.6.The
See moreCellRendererComboProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererCombo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererCombo
. Alternatively, useCellRendererComboRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererComboProtocol : CellRendererTextProtocol
-
A
GtkCellRendererPixbuf
can be used to render an image in a cell. It allows to render either a givenGdkPixbuf
(set via theGtkCellRendererPixbuf:pixbuf
property) or a named icon (set via theGtkCellRendererPixbuf:icon-name
property).To support the tree view,
GtkCellRendererPixbuf
also supports rendering two alternative pixbufs, when theGtkCellRenderer:is-expander
property istrue
. If theGtkCellRenderer:is-expanded
property istrue
and theGtkCellRendererPixbuf:pixbuf-expander-open
property is set to a pixbuf, it renders that pixbuf, if theGtkCellRenderer:is-expanded
property isfalse
and theGtkCellRendererPixbuf:pixbuf-expander-closed
property is set to a pixbuf, it renders that one.The
See moreCellRendererPixbufProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererPixbuf
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererPixbuf
. Alternatively, useCellRendererPixbufRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererPixbufProtocol : CellRendererProtocol
-
GtkCellRendererProgress
renders a numeric value as a progress par in a cell. Additionally, it can display a text on top of the progress bar.The
GtkCellRendererProgress
cell renderer was added in GTK+ 2.6.The
See moreCellRendererProgressProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererProgress
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererProgress
. Alternatively, useCellRendererProgressRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererProgressProtocol : CellRendererProtocol, OrientableProtocol
-
GtkCellRendererSpin
renders text in a cell likeGtkCellRendererText
from which it is derived. But whileGtkCellRendererText
offers a simple entry to edit the text,GtkCellRendererSpin
offers aGtkSpinButton
widget. Of course, that means that the text has to be parseable as a floating point number.The range of the spinbutton is taken from the adjustment property of the cell renderer, which can be set explicitly or mapped to a column in the tree model, like all properties of cell renders.
GtkCellRendererSpin
also has properties for theGtkCellRendererSpin:climb-rate
and the number ofGtkCellRendererSpin:digits
to display. OtherGtkSpinButton
properties can be set in a handler for theGtkCellRenderer::editing-started
signal.The
GtkCellRendererSpin
cell renderer was added in GTK+ 2.10.The
See moreCellRendererSpinProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererSpin
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererSpin
. Alternatively, useCellRendererSpinRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererSpinProtocol : CellRendererTextProtocol
-
GtkCellRendererSpinner renders a spinning animation in a cell, very similar to
GtkSpinner
. It can often be used as an alternative to aGtkCellRendererProgress
for displaying indefinite activity, instead of actual progress.To start the animation in a cell, set the
GtkCellRendererSpinner:active
property totrue
and increment theGtkCellRendererSpinner: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()
.The
See moreCellRendererSpinnerProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererSpinner
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererSpinner
. Alternatively, useCellRendererSpinnerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererSpinnerProtocol : CellRendererProtocol
-
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 theGtkCellRendererText:ellipsize
property allows it.If the
GtkCellRenderer:mode
isGTK_CELL_RENDERER_MODE_EDITABLE
, theGtkCellRendererText
allows to edit its text using an entry.The
See moreCellRendererTextProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererText
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererText
. Alternatively, useCellRendererTextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererTextProtocol : CellRendererProtocol
-
GtkCellRendererToggle
renders a toggle button in a cell. The button is drawn as a radio or a checkbutton, depending on theGtkCellRendererToggle:radio
property. When activated, it emits theGtkCellRendererToggle::toggled
signal.The
See moreCellRendererToggleProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererToggle
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererToggle
. Alternatively, useCellRendererToggleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererToggleProtocol : CellRendererProtocol
-
A
GtkCellView
displays a single row of aGtkTreeModel
using aGtkCellArea
andGtkCellAreaContext
. AGtkCellAreaContext
can be provided to theGtkCellView
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 ofGtkComboBox
).GtkCellView
isGtkOrientable
in order to decide in which orientation the underlyingGtkCellAreaContext
should be allocated. Taking theGtkComboBox
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).CSS nodes
GtkCellView has a single CSS node with name cellview.
The
See moreCellViewProtocol
protocol exposes the methods and properties of an underlyingGtkCellView
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellView
. Alternatively, useCellViewRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellViewProtocol : CellLayoutProtocol, OrientableProtocol, WidgetProtocol
-
A
GtkCheckButton
places a discreteGtkToggleButton
next to a widget, (usually aGtkLabel
). See the section onGtkToggleButton
widgets for more information about toggle/check buttons.The important signal (
GtkToggleButton::toggled
) is also inherited fromGtkToggleButton
.CSS nodes
(plain Language Example):
checkbutton ├── check ╰── <child>
A GtkCheckButton with indicator (see
gtk_toggle_button_set_mode()
) has a main CSS node with name checkbutton and a subnode with name check.(plain Language Example):
button.check ├── check ╰── <child>
A GtkCheckButton without indicator changes the name of its main node to button and adds a .check style class to it. The subnode is invisible in this case.
The
See moreCheckButtonProtocol
protocol exposes the methods and properties of an underlyingGtkCheckButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCheckButton
. Alternatively, useCheckButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CheckButtonProtocol : ToggleButtonProtocol
-
A
GtkCheckMenuItem
is a menu item that maintains the state of a boolean value in addition to aGtkMenuItem
usual role in activating application code.A check box indicating the state of the boolean value is displayed at the left side of the
GtkMenuItem
. Activating theGtkMenuItem
toggles the value.CSS nodes
(plain Language Example):
menuitem ├── check.left ╰── <child>
GtkCheckMenuItem has a main CSS node with name menuitem, and a subnode with name check, which gets the .left or .right style class.
The
See moreCheckMenuItemProtocol
protocol exposes the methods and properties of an underlyingGtkCheckMenuItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCheckMenuItem
. Alternatively, useCheckMenuItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CheckMenuItemProtocol : MenuItemProtocol
-
The
See moreCheckMenuItemAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkCheckMenuItemAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCheckMenuItemAccessible
. Alternatively, useCheckMenuItemAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CheckMenuItemAccessibleProtocol : MenuItemAccessibleProtocol
-
The
See moreClipboardProtocol
protocol exposes the methods and properties of an underlyingGtkClipboard
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeClipboard
. Alternatively, useClipboardRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ClipboardProtocol : ObjectProtocol
-
The
GtkColorButton
is a button which displays the currently selected color and allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.CSS nodes
GtkColorButton has a single CSS node with name button. To differentiate it from a plain
GtkButton
, it gets the .color style class.The
See moreColorButtonProtocol
protocol exposes the methods and properties of an underlyingGtkColorButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorButton
. Alternatively, useColorButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorButtonProtocol : ButtonProtocol, ColorChooserProtocol
-
The
GtkColorChooserDialog
widget is a dialog for choosing a color. It implements theGtkColorChooser
interface.The
See moreColorChooserDialogProtocol
protocol exposes the methods and properties of an underlyingGtkColorChooserDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorChooserDialog
. Alternatively, useColorChooserDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorChooserDialogProtocol : ColorChooserProtocol, DialogProtocol
-
The
GtkColorChooserWidget
widget lets the user select a color. By default, the chooser presents a predefined palette of colors, plus a small number of settable custom colors. It is also possible to select a different color with the single-color editor. To enter the single-color editing mode, use the context menu of any color of the palette, or use the ‘+’ button to add a new custom color.The chooser automatically remembers the last selection, as well as custom colors.
To change the initially selected color, use
gtk_color_chooser_set_rgba()
. To get the selected color usegtk_color_chooser_get_rgba()
.The
GtkColorChooserWidget
is used in theGtkColorChooserDialog
to provide a dialog for selecting colors.CSS names
GtkColorChooserWidget has a single CSS node with name colorchooser.
The
See moreColorChooserWidgetProtocol
protocol exposes the methods and properties of an underlyingGtkColorChooserWidget
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorChooserWidget
. Alternatively, useColorChooserWidgetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorChooserWidgetProtocol : BoxProtocol, ColorChooserProtocol
-
The
See moreColorSelectionProtocol
protocol exposes the methods and properties of an underlyingGtkColorSelection
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorSelection
. Alternatively, useColorSelectionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorSelectionProtocol : BoxProtocol
-
The
See moreColorSelectionDialogProtocol
protocol exposes the methods and properties of an underlyingGtkColorSelectionDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorSelectionDialog
. Alternatively, useColorSelectionDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorSelectionDialogProtocol : DialogProtocol
-
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 callinggtk_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 andGtkComboBoxText
can contain an entry.CSS nodes
(plain Language Example):
combobox ├── box.linked │ ╰── button.combo │ ╰── box │ ├── cellview │ ╰── arrow ╰── window.popup
A normal combobox contains a box with the .linked class, a button with the .combo class and inside those buttons, there are a cellview and an arrow.
(plain Language Example):
combobox ├── box.linked │ ├── entry.combo │ ╰── button.combo │ ╰── box │ ╰── arrow ╰── window.popup
A GtkComboBox with an entry has a single CSS node with name combobox. It contains a box with the .linked class. That box contains an entry and a button, both with the .combo class added. The button also contains another node with name arrow.
The
See moreComboBoxProtocol
protocol exposes the methods and properties of an underlyingGtkComboBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeComboBox
. Alternatively, useComboBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ComboBoxProtocol : BinProtocol, CellEditableProtocol, CellLayoutProtocol
-
The
See moreComboBoxAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkComboBoxAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeComboBoxAccessible
. Alternatively, useComboBoxAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ComboBoxAccessibleProtocol : ActionProtocol, SelectionProtocol, ContainerAccessibleProtocol
-
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()
orgtk_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()
orgtk_combo_box_text_prepend_text()
and remove options withgtk_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 callinggtk_bin_get_child()
on the combo box.You should not call
gtk_combo_box_set_model()
or attempt to pack more cells into this combo box via its GtkCellLayout interface.GtkComboBoxText as GtkBuildable
The GtkComboBoxText implementation of the GtkBuildable interface supports adding items directly using the <items> element and specifying <item> elements for each item. Each <item> element can specify the “id” corresponding to the appended text and also supports the regular translation attributes “translatable”, “context” and “comments”.
Here is a UI definition fragment specifying GtkComboBoxText items:
<object class="GtkComboBoxText"> <items> <item translatable="yes" id="factory">Factory</item> <item translatable="yes" id="home">Home</item> <item translatable="yes" id="subway">Subway</item> </items> </object>
CSS nodes
(plain Language Example):
combobox ╰── box.linked ├── entry.combo ├── button.combo ╰── window.popup
GtkComboBoxText has a single CSS node with name combobox. It adds the style class .combo to the main CSS nodes of its entry and button children, and the .linked class to the node of its internal box.
The
See moreComboBoxTextProtocol
protocol exposes the methods and properties of an underlyingGtkComboBoxText
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeComboBoxText
. Alternatively, useComboBoxTextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ComboBoxTextProtocol : ComboBoxProtocol
-
The
See moreContainerAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkContainerAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeContainerAccessible
. Alternatively, useContainerAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ContainerAccessibleProtocol : WidgetAccessibleProtocol
-
The
See moreContainerCellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkContainerCellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeContainerCellAccessible
. Alternatively, useContainerCellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ContainerCellAccessibleProtocol : CellAccessibleProtocol
-
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 aGtkLabel
or aGtkEntry
should be packed. The bottom area is known as the “action area”. 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 togtk_dialog_new()
orgtk_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()
andgtk_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 theGTK_WINDOW()
macro to cast the widget returned fromgtk_dialog_new()
into aGtkWindow
. When usinggtk_dialog_new_with_buttons()
you can also pass theGTK_DIALOG_MODAL
flag to make a dialog modal.If you add buttons to
GtkDialog
usinggtk_dialog_new_with_buttons()
,gtk_dialog_add_button()
,gtk_dialog_add_buttons()
, orgtk_dialog_add_action_widget()
, clicking the button will emit a signal calledGtkDialog::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 theGtkResponseType
enumeration (these all have values less than zero). If a dialog receives a delete event, theGtkDialog::response
signal will be emitted with a response ID ofGTK_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.An example for simple GtkDialog usage: (C Language Example):
// Function to open a dialog box with a message void quick_message (GtkWindow *parent, gchar *message) { GtkWidget *dialog, *label, *content_area; GtkDialogFlags flags; // Create the widgets flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_dialog_new_with_buttons ("Message", parent, flags, _("_OK"), GTK_RESPONSE_NONE, NULL); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); label = gtk_label_new (message); // Ensure that the dialog box is destroyed when the user responds g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); // Add the label, and show everything we’ve added gtk_container_add (GTK_CONTAINER (content_area), label); gtk_widget_show_all (dialog); }
GtkDialog as GtkBuildable
The GtkDialog implementation of the
GtkBuildable
interface exposes thevbox
andaction_area
as internal children with the names “vbox” and “action_area”.GtkDialog supports a custom <action-widgets> element, which can contain multiple <action-widget> 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
). To mark a response as default, set the “default“ attribute of the <action-widget> element to true.GtkDialog supports adding action widgets by specifying “action“ as the “type“ attribute of a <child> element. The widget will be added either to the action area or the headerbar of the dialog, depending on the “use-header-bar“ property. The response id has to be associated with the action widget using the <action-widgets> element.
An example of a
GtkDialog
UI definition fragment:<object class="GtkDialog" id="dialog1"> <child type="action"> <object class="GtkButton" id="button_cancel"/> </child> <child type="action"> <object class="GtkButton" id="button_ok"> <property name="can-default">True</property> </object> </child> <action-widgets> <action-widget response="cancel">button_cancel</action-widget> <action-widget response="ok" default="true">button_ok</action-widget> </action-widgets> </object>
The
See moreDialogProtocol
protocol exposes the methods and properties of an underlyingGtkDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeDialog
. Alternatively, useDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol DialogProtocol : WindowProtocol
-
The
See moreCellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAccessibleClass
. Alternatively, useCellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAccessibleClassProtocol
-
The
See moreCellAccessibleParentIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkCellAccessibleParentIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAccessibleParentIface
. Alternatively, useCellAccessibleParentIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAccessibleParentIfaceProtocol
-
The
See moreCellAreaBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellAreaBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAreaBoxClass
. Alternatively, useCellAreaBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAreaBoxClassProtocol
-
The
See moreCellAreaClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellAreaClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAreaClass
. Alternatively, useCellAreaClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAreaClassProtocol
-
The
See moreCellAreaContextClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellAreaContextClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAreaContextClass
. Alternatively, useCellAreaContextClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAreaContextClassProtocol
-
The
See moreCellEditableIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkCellEditableIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellEditableIface
. Alternatively, useCellEditableIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellEditableIfaceProtocol
-
The
See moreCellLayoutIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkCellLayoutIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellLayoutIface
. Alternatively, useCellLayoutIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellLayoutIfaceProtocol
-
The
See moreCellRendererAccelClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererAccelClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererAccelClass
. Alternatively, useCellRendererAccelClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererAccelClassProtocol
-
The
See moreCellRendererClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererClass
. Alternatively, useCellRendererClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererClassProtocol
-
The
See moreCellRendererClassPrivateProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererClassPrivate
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererClassPrivate
. Alternatively, useCellRendererClassPrivateRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererClassPrivateProtocol
-
The
See moreCellRendererComboClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererComboClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererComboClass
. Alternatively, useCellRendererComboClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererComboClassProtocol
-
The
See moreCellRendererPixbufClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererPixbufClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererPixbufClass
. Alternatively, useCellRendererPixbufClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererPixbufClassProtocol
-
The
See moreCellRendererProgressClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererProgressClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererProgressClass
. Alternatively, useCellRendererProgressClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererProgressClassProtocol
-
The
See moreCellRendererSpinClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererSpinClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererSpinClass
. Alternatively, useCellRendererSpinClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererSpinClassProtocol
-
The
See moreCellRendererSpinnerClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererSpinnerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererSpinnerClass
. Alternatively, useCellRendererSpinnerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererSpinnerClassProtocol
-
The
See moreCellRendererTextClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererTextClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererTextClass
. Alternatively, useCellRendererTextClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererTextClassProtocol
-
The
See moreCellRendererToggleClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellRendererToggleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellRendererToggleClass
. Alternatively, useCellRendererToggleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellRendererToggleClassProtocol
-
The
See moreCellViewClassProtocol
protocol exposes the methods and properties of an underlyingGtkCellViewClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellViewClass
. Alternatively, useCellViewClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellViewClassProtocol
-
The
See moreCheckButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkCheckButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCheckButtonClass
. Alternatively, useCheckButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CheckButtonClassProtocol
-
The
See moreCheckMenuItemAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkCheckMenuItemAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCheckMenuItemAccessibleClass
. Alternatively, useCheckMenuItemAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CheckMenuItemAccessibleClassProtocol
-
The
See moreCheckMenuItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkCheckMenuItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCheckMenuItemClass
. Alternatively, useCheckMenuItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CheckMenuItemClassProtocol
-
The
See moreColorButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkColorButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorButtonClass
. Alternatively, useColorButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorButtonClassProtocol
-
The
See moreColorChooserDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkColorChooserDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorChooserDialogClass
. Alternatively, useColorChooserDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorChooserDialogClassProtocol
-
The
See moreColorChooserInterfaceProtocol
protocol exposes the methods and properties of an underlyingGtkColorChooserInterface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorChooserInterface
. Alternatively, useColorChooserInterfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorChooserInterfaceProtocol
-
The
See moreColorChooserWidgetClassProtocol
protocol exposes the methods and properties of an underlyingGtkColorChooserWidgetClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorChooserWidgetClass
. Alternatively, useColorChooserWidgetClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorChooserWidgetClassProtocol
-
The
See moreColorSelectionClassProtocol
protocol exposes the methods and properties of an underlyingGtkColorSelectionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorSelectionClass
. Alternatively, useColorSelectionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorSelectionClassProtocol
-
The
See moreColorSelectionDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkColorSelectionDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorSelectionDialogClass
. Alternatively, useColorSelectionDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorSelectionDialogClassProtocol
-
The
See moreComboBoxAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkComboBoxAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeComboBoxAccessibleClass
. Alternatively, useComboBoxAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ComboBoxAccessibleClassProtocol
-
The
See moreComboBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkComboBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeComboBoxClass
. Alternatively, useComboBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ComboBoxClassProtocol
-
The
See moreComboBoxTextClassProtocol
protocol exposes the methods and properties of an underlyingGtkComboBoxTextClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeComboBoxTextClass
. Alternatively, useComboBoxTextClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ComboBoxTextClassProtocol
-
The
See moreContainerAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkContainerAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeContainerAccessibleClass
. Alternatively, useContainerAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ContainerAccessibleClassProtocol
-
The
See moreContainerCellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkContainerCellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeContainerCellAccessibleClass
. Alternatively, useContainerCellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ContainerCellAccessibleClassProtocol
-
Base class for containers.
The
See moreContainerClassProtocol
protocol exposes the methods and properties of an underlyingGtkContainerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeContainerClass
. Alternatively, useContainerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ContainerClassProtocol
-
The
See moreCssProviderClassProtocol
protocol exposes the methods and properties of an underlyingGtkCssProviderClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCssProviderClass
. Alternatively, useCssProviderClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CssProviderClassProtocol
-
Defines a part of a CSS document. Because sections are nested into one another, you can use
gtk_css_section_get_parent()
to get the containing region.The
See moreCssSectionProtocol
protocol exposes the methods and properties of an underlyingGtkCssSection
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCssSection
. Alternatively, useCssSectionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CssSectionProtocol
-
The
See moreDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeDialogClass
. Alternatively, useDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol DialogClassProtocol
-
The
See moreCellAccessibleParentProtocol
protocol exposes the methods and properties of an underlyingGtkCellAccessibleParent
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellAccessibleParent
. Alternatively, useCellAccessibleParentRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellAccessibleParentProtocol
-
The
GtkCellEditable
interface must be implemented for widgets to be usable to edit the contents of aGtkTreeView
cell. It provides a way to specify how temporary widgets should be configured for editing, get the new value, etc.The
See moreCellEditableProtocol
protocol exposes the methods and properties of an underlyingGtkCellEditable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellEditable
. Alternatively, useCellEditableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellEditableProtocol : WidgetProtocol
-
GtkCellLayout
is an interface to be implemented by all objects which want to provide aGtkTreeViewColumn
like API for packing cells, setting attributes and data funcs.One of the notable features provided by implementations of GtkCellLayout are attributes. 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 withgtk_cell_layout_set_cell_data_func()
that is called to determine the value of the attribute for each cell that is rendered.GtkCellLayouts as GtkBuildable
Implementations of GtkCellLayout which also implement the GtkBuildable interface (
GtkCellView
,GtkIconView
,GtkComboBox
,GtkEntryCompletion
,GtkTreeViewColumn
) accept GtkCellRenderer objects as <child> elements in UI definitions. They support a custom <attributes> element for their children, which can contain multiple <attribute> elements. Each <attribute> element has a name attribute which specifies a property of the cell renderer; the content of the element is the attribute value.This is an example of a UI definition fragment specifying attributes:
<object class="GtkCellView"> <child> <object class="GtkCellRendererText"/> <attributes> <attribute name="text">0</attribute> </attributes> </child>" </object>
Furthermore for implementations of GtkCellLayout that use a
GtkCellArea
to lay out cells (all GtkCellLayouts in GTK+ use a GtkCellArea) cell properties can also be defined in the format by specifying the custom <cell-packing> attribute which can contain multiple <property> elements defined in the normal way.Here is a UI definition fragment specifying cell properties:
<object class="GtkTreeViewColumn"> <child> <object class="GtkCellRendererText"/> <cell-packing> <property name="align">True</property> <property name="expand">False</property> </cell-packing> </child>" </object>
Subclassing GtkCellLayout implementations
When subclassing a widget that implements
GtkCellLayout
likeGtkIconView
orGtkComboBox
, there are some considerations related to the fact that these widgets internally use aGtkCellArea
. The cell area is exposed as a construct-only property by these widgets. This means that it is possible to e.g. do(C Language Example):
combo = g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", my_cell_area, NULL);
to use a custom cell area with a combo box. But construct properties are only initialized after 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).(C Language Example):
static void my_combo_box_init (MyComboBox *b) { GtkCellRenderer *cell; cell = gtk_cell_renderer_pixbuf_new (); // The following call causes the default cell area for combo boxes, // a GtkCellAreaBox, to be instantiated gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (b), cell, FALSE); ... } GtkWidget * my_combo_box_new (GtkCellArea *area) { // This call is going to cause a warning about area being ignored return g_object_new (MY_TYPE_COMBO_BOX, "cell-area", area, NULL); }
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 aconstructor()
for your class.The
See moreCellLayoutProtocol
protocol exposes the methods and properties of an underlyingGtkCellLayout
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCellLayout
. Alternatively, useCellLayoutRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol CellLayoutProtocol
-
GtkColorChooser
is an interface that is implemented by widgets for choosing colors. Depending on the situation, colors may be allowed to have alpha (translucency).In GTK+, the main widgets that implement this interface are
GtkColorChooserWidget
,GtkColorChooserDialog
andGtkColorButton
.The
See moreColorChooserProtocol
protocol exposes the methods and properties of an underlyingGtkColorChooser
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeColorChooser
. Alternatively, useColorChooserRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ColorChooserProtocol
-
The
GtkEditable
interface is an interface which should be implemented by text editing widgets, such asGtkEntry
andGtkSpinButton
. 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
GtkEditable::insert-text
, an application can convert all entry into a widget into uppercase.Forcing entry to uppercase.
(C Language Example):
#include <ctype.h>; void insert_text_handler (GtkEditable *editable, const gchar *text, gint length, gint *position, gpointer data) { gchar *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); }
The
See moreEditableProtocol
protocol exposes the methods and properties of an underlyingGtkEditable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEditable
. Alternatively, useEditableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EditableProtocol
-
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:Mouse and button press signals to respond to input from the user. (Use
gtk_widget_add_events()
to enable events you wish to receive.)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.)The
GtkWidget::size-allocate
signal to take any necessary actions when the widget changes size.The
GtkWidget::draw
signal to handle redrawing the contents of the widget.
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 before sending the expose event, and that drawing is implicitly clipped to the exposed area. If you want to have a theme-provided background, you need to call
gtk_render_background()
in yourdraw
method.Simple GtkDrawingArea usage
(C Language Example):
gboolean draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data) { guint width, height; GdkRGBA color; GtkStyleContext *context; context = gtk_widget_get_style_context (widget); width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); gtk_render_background (context, cr, 0, 0, width, height); cairo_arc (cr, width / 2.0, height / 2.0, MIN (width, height) / 2.0, 0, 2 * G_PI); gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color); gdk_cairo_set_source_rgba (cr, &color); cairo_fill (cr); return FALSE; } [...] GtkWidget *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);
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()
andgdk_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 GDK Drawing Primitives 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. Usegtk_widget_has_focus()
in your expose event handler to decide whether to draw the focus indicator. Seegtk_render_focus()
for one way to draw focus.The
See moreDrawingAreaProtocol
protocol exposes the methods and properties of an underlyingGtkDrawingArea
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeDrawingArea
. Alternatively, useDrawingAreaRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol DrawingAreaProtocol : WidgetProtocol
-
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 withgtk_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 theGtkEntry: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()
orgtk_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 theGtkEntry::icon-press
signal. To allow DND operations from an icon, usegtk_entry_set_icon_drag_source()
. To set a tooltip on an icon, usegtk_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.
CSS nodes
(plain Language Example):
entry[.read-only][.flat][.warning][.error] ├── image.left ├── image.right ├── undershoot.left ├── undershoot.right ├── [selection] ├── [progress[.pulse]] ╰── [window.popup]
GtkEntry has a main node with the name entry. Depending on the properties of the entry, the style classes .read-only and .flat may appear. The style classes .warning and .error may also be used with entries.
When the entry shows icons, it adds subnodes with the name image and the style class .left or .right, depending on where the icon appears.
When the entry has a selection, it adds a subnode with the name selection.
When the entry shows progress, it adds a subnode with the name progress. The node has the style class .pulse when the shown progress is pulsing.
The CSS node for a context menu is added as a subnode below entry as well.
The undershoot nodes are used to draw the underflow indication when content is scrolled out of view. These nodes get the .left and .right style classes added depending on where the indication is drawn.
When touch is used and touch selection handles are shown, they are using CSS nodes with name cursor-handle. They get the .top or .bottom style class depending on where they are shown in relation to the selection. If there is just a single handle for the text cursor, it gets the style class .insertion-cursor.
The
See moreEntryProtocol
protocol exposes the methods and properties of an underlyingGtkEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntry
. Alternatively, useEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryProtocol : CellEditableProtocol, EditableProtocol
-
The
See moreDrawingAreaClassProtocol
protocol exposes the methods and properties of an underlyingGtkDrawingAreaClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeDrawingAreaClass
. Alternatively, useDrawingAreaClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol DrawingAreaClassProtocol
-
The
See moreEditableInterfaceProtocol
protocol exposes the methods and properties of an underlyingGtkEditableInterface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEditableInterface
. Alternatively, useEditableInterfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EditableInterfaceProtocol
-
The
See moreEntryAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkEntryAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryAccessible
. Alternatively, useEntryAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryAccessibleProtocol : ActionProtocol, EditableTextProtocol, TextProtocol, WidgetAccessibleProtocol
-
The
GtkEntryBuffer
class contains the actual text displayed in aGtkEntry
widget.A single
GtkEntryBuffer
object can be shared by multipleGtkEntry
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.The
See moreEntryBufferProtocol
protocol exposes the methods and properties of an underlyingGtkEntryBuffer
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryBuffer
. Alternatively, useEntryBufferRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryBufferProtocol : ObjectProtocol
-
GtkEntryCompletion
is an auxiliary object to be used in conjunction withGtkEntry
to provide the completion functionality. It implements theGtkCellLayout
interface, to allow the user to add extra cells to theGtkTreeView
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 (seegtk_entry_completion_set_text_column()
), but this can be overridden with a custom match function (seegtk_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 returntrue
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, theGtkEntryCompletion::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 signalsGtkEntryCompletion::match-selected
andGtkEntryCompletion::cursor-on-match
take the original model and an iter pointing to that model as arguments, other callbacks and signals (such asGtkCellLayoutDataFuncs
orGtkCellArea::apply-attributes
) will generally take the filter model as argument. As long as you are only callinggtk_tree_model_get()
, this will make no difference to you. If for some reason, you need the original model, usegtk_tree_model_filter_get_model()
. Don’t forget to usegtk_tree_model_filter_convert_iter_to_child_iter()
to obtain a matching iter.The
See moreEntryCompletionProtocol
protocol exposes the methods and properties of an underlyingGtkEntryCompletion
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryCompletion
. Alternatively, useEntryCompletionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryCompletionProtocol : ObjectProtocol, BuildableProtocol, CellLayoutProtocol
-
The
See moreEntryIconAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkEntryIconAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryIconAccessible
. Alternatively, useEntryIconAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryIconAccessibleProtocol : ActionProtocol, ComponentProtocol, ObjectProtocol
-
The
GtkEventBox
widget is a subclass ofGtkBin
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.The
See moreEventBoxProtocol
protocol exposes the methods and properties of an underlyingGtkEventBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventBox
. Alternatively, useEventBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventBoxProtocol : BinProtocol
-
GtkEventController
is a base, low-level implementation for event controllers. Those react to a series ofGdkEvents
, and possibly trigger actions as a consequence of those.The
See moreEventControllerProtocol
protocol exposes the methods and properties of an underlyingGtkEventController
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventController
. Alternatively, useEventControllerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerProtocol : ObjectProtocol
-
GtkEventControllerKey
is an event controller meant for situations where you need access to key events.This object was added in 3.24.
The
See moreEventControllerKeyProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerKey
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerKey
. Alternatively, useEventControllerKeyRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerKeyProtocol : EventControllerProtocol
-
GtkEventControllerMotion
is an event controller meant for situations where you need to track the position of the pointer.This object was added in 3.24.
The
See moreEventControllerMotionProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerMotion
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerMotion
. Alternatively, useEventControllerMotionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerMotionProtocol : EventControllerProtocol
-
GtkEventControllerScroll
is an event controller meant to handle scroll events from mice and touchpads. It is capable of handling both discrete and continuous scroll events, abstracting them both on theGtkEventControllerScroll::scroll
signal (deltas in the discrete case are multiples of 1).In the case of continuous scroll events,
GtkEventControllerScroll
encloses allGtkEventControllerScroll::scroll
events between twoGtkEventControllerScroll::scroll-begin
andGtkEventControllerScroll::scroll-end
signals.The behavior of the event controller can be modified by the flags given at creation time, or modified at a later point through
gtk_event_controller_scroll_set_flags()
(e.g. because the scrolling conditions of the widget changed).The controller can be set up to emit motion for either/both vertical and horizontal scroll events through
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL
,GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL
andGTK_EVENT_CONTROLLER_SCROLL_BOTH
. If any axis is disabled, the respectiveGtkEventControllerScroll::scroll
delta will be 0. Vertical scroll events will be translated to horizontal motion for the devices incapable of horizontal scrolling.The event controller can also be forced to emit discrete events on all devices through
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE
. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options).The
GTK_EVENT_CONTROLLER_SCROLL_KINETIC
flag toggles the emission of theGtkEventControllerScroll::decelerate
signal, emitted at the end of scrolling with two X/Y velocity arguments that are consistent with the motion that was received.This object was added in 3.24.
The
See moreEventControllerScrollProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerScroll
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerScroll
. Alternatively, useEventControllerScrollRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerScrollProtocol : EventControllerProtocol
-
A
GtkExpander
allows the user to hide or show its child by clicking on an expander triangle similar to the triangles used in aGtkTreeView
.Normally you use an expander as you would use any other descendant of
GtkBin
; you create the child widget and usegtk_container_add()
to add it to the expander. When the expander is toggled, it will take care of showing and hiding the child automatically.Special Usage
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 anGtkExpander:expanded
property which can be used to monitor its expansion state. You should watch this property with a signal connection as follows:(C Language Example):
static void expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data) { GtkExpander *expander; expander = GTK_EXPANDER (object); if (gtk_expander_get_expanded (expander)) { // Show or create widgets } else { // Hide or destroy widgets } } static void create_expander (void) { GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options"); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_callback), NULL); // ... }
GtkExpander as GtkBuildable
The GtkExpander implementation of the GtkBuildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.
An example of a UI definition fragment with GtkExpander:
<object class="GtkExpander"> <child type="label"> <object class="GtkLabel" id="expander-label"/> </child> <child> <object class="GtkEntry" id="expander-content"/> </child> </object>
CSS nodes
(plain Language Example):
expander ├── title │ ├── arrow │ ╰── <label widget> ╰── <child>
GtkExpander has three CSS nodes, the main node with the name expander, a subnode with name title and node below it with name arrow. The arrow of an expander that is showing its child gets the :checked pseudoclass added to it.
The
See moreExpanderProtocol
protocol exposes the methods and properties of an underlyingGtkExpander
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeExpander
. Alternatively, useExpanderRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ExpanderProtocol : BinProtocol
-
The
See moreExpanderAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkExpanderAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeExpanderAccessible
. Alternatively, useExpanderAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ExpanderAccessibleProtocol : ActionProtocol, ContainerAccessibleProtocol
-
The
GtkFileChooserButton
is a widget that lets the user select a file. It implements theGtkFileChooser
interface. Visually, it is a file name with a button to bring up aGtkFileChooserDialog
. The user can then use that dialog to change the file associated with that button. This widget does not support setting theGtkFileChooser:select-multiple
property totrue
.Create a button to let the user select a file in /etc
(C Language Example):
{ GtkWidget *button; button = gtk_file_chooser_button_new (_("Select a file"), GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button), "/etc"); }
The
GtkFileChooserButton
supports theGtkFileChooserActions
GTK_FILE_CHOOSER_ACTION_OPEN
andGTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
.> The
GtkFileChooserButton
will ellipsize the label, and will thus > request little horizontal space. To give the button more space, > you should callgtk_widget_get_preferred_size()
, >gtk_file_chooser_button_set_width_chars()
, or pack the button in > such a way that other interface elements give space to the > widget.CSS nodes
GtkFileChooserButton has a CSS node with name “filechooserbutton”, containing a subnode for the internal button with name “button” and style class “.file”.
The
See moreFileChooserButtonProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserButton
. Alternatively, useFileChooserButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserButtonProtocol : BoxProtocol, FileChooserProtocol
-
The
See moreEntryAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkEntryAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryAccessibleClass
. Alternatively, useEntryAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryAccessibleClassProtocol
-
The
See moreEntryBufferClassProtocol
protocol exposes the methods and properties of an underlyingGtkEntryBufferClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryBufferClass
. Alternatively, useEntryBufferClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryBufferClassProtocol
-
Class structure for
GtkEntry
. All virtual functions have a default implementation. Derived classes may set the virtual function pointers for the signal handlers tonil
, but must keepget_text_area_size
andget_frame_size
non-nil
; either use the default implementation, or provide a custom one.The
See moreEntryClassProtocol
protocol exposes the methods and properties of an underlyingGtkEntryClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryClass
. Alternatively, useEntryClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryClassProtocol
-
The
See moreEntryCompletionClassProtocol
protocol exposes the methods and properties of an underlyingGtkEntryCompletionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEntryCompletionClass
. Alternatively, useEntryCompletionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EntryCompletionClassProtocol
-
The
See moreEventBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkEventBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventBoxClass
. Alternatively, useEventBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventBoxClassProtocol
-
The
See moreEventControllerClassProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerClass
. Alternatively, useEventControllerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerClassProtocol
-
The
See moreEventControllerKeyClassProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerKeyClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerKeyClass
. Alternatively, useEventControllerKeyClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerKeyClassProtocol
-
The
See moreEventControllerMotionClassProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerMotionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerMotionClass
. Alternatively, useEventControllerMotionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerMotionClassProtocol
-
The
See moreEventControllerScrollClassProtocol
protocol exposes the methods and properties of an underlyingGtkEventControllerScrollClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEventControllerScrollClass
. Alternatively, useEventControllerScrollClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EventControllerScrollClassProtocol
-
The
See moreExpanderAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkExpanderAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeExpanderAccessibleClass
. Alternatively, useExpanderAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ExpanderAccessibleClassProtocol
-
The
See moreExpanderClassProtocol
protocol exposes the methods and properties of an underlyingGtkExpanderClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeExpanderClass
. Alternatively, useExpanderClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ExpanderClassProtocol
-
The
See moreFileChooserButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserButtonClass
. Alternatively, useFileChooserButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserButtonClassProtocol
-
GtkFileChooser
is an interface that can be implemented by file selection widgets. In GTK+, the main objects that implement this interface areGtkFileChooserWidget
,GtkFileChooserDialog
, andGtkFileChooserButton
. You do not need to write an object that implements theGtkFileChooser
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:Bookmarks: 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.
Shortcuts: can be provided by the application. For example, a Paint program may want to add a shortcut for a Clipart folder. Shortcuts cannot be modified by the user.
Volumes: are provided by the underlying filesystem abstraction. They are the “roots” of the filesystem.
File Names and Encodings
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 always returned in the character set specified by theG_FILENAME_ENCODING
environment variable. Please see the GLib documentation for more details about this variable.This means that while you can pass the result of
gtk_file_chooser_get_filename()
tog_open()
org_fopen()
, you may not be able to directly set it as the text of aGtkLabel
widget unless you convert it first to UTF-8, which all GTK+ widgets expect. You should useg_filename_to_utf8()
to convert filenames into strings that can be passed to GTK+ widgets.Adding a Preview Widget
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 theGtkFileChooser::update-preview
signal to get notified when you need to update the contents of the preview.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 callgtk_file_chooser_set_preview_widget_active()
with a boolean flag that indicates whether your callback could successfully generate a preview.Example: Using a Preview Widget ##
(C Language Example):
{ 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); }
Adding Extra Widgets
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.An example for adding extra widgets: (C Language Example):
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); }
If you want to set more than one extra widget in the file chooser, you can a container such as a
GtkBox
or aGtkGrid
and include your widgets in it. Then, set the container as the whole extra widget.The
See moreFileChooserProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooser
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooser
. Alternatively, useFileChooserRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserProtocol
-
GtkFontChooser
is an interface that can be implemented by widgets displaying the list of fonts. In GTK+, the main objects that implement this interface areGtkFontChooserWidget
,GtkFontChooserDialog
andGtkFontButton
. The GtkFontChooser interface has been introducted in GTK+ 3.2.The
See moreFontChooserProtocol
protocol exposes the methods and properties of an underlyingGtkFontChooser
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontChooser
. Alternatively, useFontChooserRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontChooserProtocol
-
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.gGtkBox
/GtkHBox
/GtkVBox
orGtkScale
/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.The
See moreOrientableProtocol
protocol exposes the methods and properties of an underlyingGtkOrientable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeOrientable
. Alternatively, useOrientableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol OrientableProtocol
-
GtkFileChooserDialog
is a dialog box suitable for use with “File/Open” or “File/Save as” commands. This widget works by putting aGtkFileChooserWidget
inside aGtkDialog
. It exposes theGtkFileChooser
interface, so you can use all of theGtkFileChooser
functions on the file chooser dialog as well as those forGtkDialog
.Note that
GtkFileChooserDialog
does not have any methods of its own. Instead, you should use the functions that work on aGtkFileChooser
.If you want to integrate well with the platform you should use the
GtkFileChooserNative
API, which will use a platform-specific dialog if available and fall back to GtkFileChooserDialog otherwise.Typical usage ##
In the simplest of cases, you can the following code to use
GtkFileChooserDialog
to select a file for opening:GtkWidget *dialog; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; gint res; dialog = gtk_file_chooser_dialog_new ("Open File", parent_window, action, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Open"), GTK_RESPONSE_ACCEPT, NULL); res = gtk_dialog_run (GTK_DIALOG (dialog)); if (res == GTK_RESPONSE_ACCEPT) { char *filename; GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog); filename = gtk_file_chooser_get_filename (chooser); open_file (filename); g_free (filename); } gtk_widget_destroy (dialog);
To use a dialog for saving, you can use this:
GtkWidget *dialog; GtkFileChooser *chooser; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE; gint res; dialog = gtk_file_chooser_dialog_new ("Save File", parent_window, action, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); chooser = GTK_FILE_CHOOSER (dialog); gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE); if (user_edited_a_new_document) gtk_file_chooser_set_current_name (chooser, _("Untitled document")); else gtk_file_chooser_set_filename (chooser, existing_filename); res = gtk_dialog_run (GTK_DIALOG (dialog)); if (res == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (chooser); save_to_file (filename); g_free (filename); } gtk_widget_destroy (dialog);
Setting up a file chooser dialog ##
There are various cases in which you may need to use a
GtkFileChooserDialog:
To select a file for opening. Use
GTK_FILE_CHOOSER_ACTION_OPEN
.To save a file for the first time. Use
GTK_FILE_CHOOSER_ACTION_SAVE
, and suggest a name such as “Untitled” withgtk_file_chooser_set_current_name()
.To save a file under a different name. Use
GTK_FILE_CHOOSER_ACTION_SAVE
, and set the existing filename withgtk_file_chooser_set_filename()
.To choose a folder instead of a file. Use
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
.
Note that old versions of the file chooser’s documentation suggested using
gtk_file_chooser_set_current_folder()
in various situations, with the intention of letting the application suggest a reasonable default folder. This is no longer considered to be a good policy, as now the file chooser is able to make good suggestions on its own. In general, you should only cause the file chooser to show a specific folder when it is appropriate to usegtk_file_chooser_set_filename()
, i.e. when you are doing a Save As command and you already have a file saved somewhere.Response Codes ##
GtkFileChooserDialog
inherits fromGtkDialog
, so buttons that go in its action area have response codes such asGTK_RESPONSE_ACCEPT
andGTK_RESPONSE_CANCEL
. For example, you could callgtk_file_chooser_dialog_new()
as follows:GtkWidget *dialog; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; dialog = gtk_file_chooser_dialog_new ("Open File", parent_window, action, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Open"), GTK_RESPONSE_ACCEPT, NULL);
This will create buttons for “Cancel” and “Open” that use stock response identifiers from
GtkResponseType
. For most dialog boxes you can use your own custom response codes rather than the ones inGtkResponseType
, butGtkFileChooserDialog
assumes that its “accept”-type action, e.g. an “Open” or “Save” button, will have one of the following response codes:GTK_RESPONSE_ACCEPT
GTK_RESPONSE_OK
GTK_RESPONSE_YES
GTK_RESPONSE_APPLY
This is because
GtkFileChooserDialog
must intercept responses and switch to folders if appropriate, rather than letting the dialog terminate — the implementation uses these known response codes to know which responses can be blocked if appropriate.To summarize, make sure you use a stock response code when you use
GtkFileChooserDialog
to ensure proper operation.The
See moreFileChooserDialogProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserDialog
. Alternatively, useFileChooserDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserDialogProtocol : DialogProtocol, FileChooserProtocol
-
GtkFileChooserNative
is an abstraction of a dialog box suitable for use with “File/Open” or “File/Save as” commands. By default, this just uses aGtkFileChooserDialog
to implement the actual dialog. However, on certain platforms, such as Windows and macOS, the native platform file chooser is used instead. When the application is running in a sandboxed environment without direct filesystem access (such as Flatpak),GtkFileChooserNative
may call the proper APIs (portals) to let the user choose a file and make it available to the application.While the API of
GtkFileChooserNative
closely mirrorsGtkFileChooserDialog
, the main difference is that there is no access to anyGtkWindow
orGtkWidget
for the dialog. This is required, as there may not be one in the case of a platform native dialog. Showing, hiding and running the dialog is handled by theGtkNativeDialog
functions.Typical usage ##
In the simplest of cases, you can the following code to use
GtkFileChooserDialog
to select a file for opening:GtkFileChooserNative *native; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; gint res; native = gtk_file_chooser_native_new ("Open File", parent_window, action, "_Open", "_Cancel"); res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native)); if (res == GTK_RESPONSE_ACCEPT) { char *filename; GtkFileChooser *chooser = GTK_FILE_CHOOSER (native); filename = gtk_file_chooser_get_filename (chooser); open_file (filename); g_free (filename); } g_object_unref (native);
To use a dialog for saving, you can use this:
GtkFileChooserNative *native; GtkFileChooser *chooser; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE; gint res; native = gtk_file_chooser_native_new ("Save File", parent_window, action, "_Save", "_Cancel"); chooser = GTK_FILE_CHOOSER (native); gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE); if (user_edited_a_new_document) gtk_file_chooser_set_current_name (chooser, _("Untitled document")); else gtk_file_chooser_set_filename (chooser, existing_filename); res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native)); if (res == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (chooser); save_to_file (filename); g_free (filename); } g_object_unref (native);
For more information on how to best set up a file dialog, see
GtkFileChooserDialog
.Response Codes ##
GtkFileChooserNative
inherits fromGtkNativeDialog
, which means it will returnGTK_RESPONSE_ACCEPT
if the user accepted, andGTK_RESPONSE_CANCEL
if he pressed cancel. It can also returnGTK_RESPONSE_DELETE_EVENT
if the window was unexpectedly closed.Differences from
GtkFileChooserDialog
##There are a few things in the GtkFileChooser API that are not possible to use with
GtkFileChooserNative
, as such use would prohibit the use of a native dialog.There is no support for the signals that are emitted when the user navigates in the dialog, including:
GtkFileChooser::current-folder-changed
GtkFileChooser::selection-changed
GtkFileChooser::file-activated
GtkFileChooser::confirm-overwrite
You can also not use the methods that directly control user navigation:
gtk_file_chooser_unselect_filename()
gtk_file_chooser_select_all()
gtk_file_chooser_unselect_all()
If you need any of the above you will have to use
GtkFileChooserDialog
directly.No operations that change the the dialog work while the dialog is visible. Set all the properties that are required before showing the dialog.
Win32 details ##
On windows the IFileDialog implementation (added in Windows Vista) is used. It supports many of the features that
GtkFileChooserDialog
does, but there are some things it does not handle:Extra widgets added with
gtk_file_chooser_set_extra_widget()
.Use of custom previews by connecting to
GtkFileChooser::update-preview
.Any
GtkFileFilter
added using a mimetype or custom filter.
If any of these features are used the regular
GtkFileChooserDialog
will be used in place of the native one.Portal details ##
When the org.freedesktop.portal.FileChooser portal is available on the session bus, it is used to bring up an out-of-process file chooser. Depending on the kind of session the application is running in, this may or may not be a GTK+ file chooser. In this situation, the following things are not supported and will be silently ignored:
Extra widgets added with
gtk_file_chooser_set_extra_widget()
.Use of custom previews by connecting to
GtkFileChooser::update-preview
.Any
GtkFileFilter
added with a custom filter.
macOS details ##
On macOS the NSSavePanel and NSOpenPanel classes are used to provide native file chooser dialogs. Some features provided by
GtkFileChooserDialog
are not supported:Extra widgets added with
gtk_file_chooser_set_extra_widget()
, unless the widget is an instance of GtkLabel, in which case the label text will be used to set the NSSavePanel message instance property.Use of custom previews by connecting to
GtkFileChooser::update-preview
.Any
GtkFileFilter
added with a custom filter.Shortcut folders.
The
See moreFileChooserNativeProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserNative
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserNative
. Alternatively, useFileChooserNativeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserNativeProtocol : FileChooserProtocol, NativeDialogProtocol
-
GtkFileChooserWidget
is a widget for choosing files. It exposes theGtkFileChooser
interface, and you should use the methods of this interface to interact with the widget.CSS nodes
GtkFileChooserWidget has a single CSS node with name filechooser.
The
See moreFileChooserWidgetProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserWidget
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserWidget
. Alternatively, useFileChooserWidgetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserWidgetProtocol : BoxProtocol, FileChooserProtocol
-
The
See moreFileChooserWidgetAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserWidgetAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserWidgetAccessible
. Alternatively, useFileChooserWidgetAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserWidgetAccessibleProtocol : ActionProtocol, ContainerAccessibleProtocol
-
A GtkFileFilter can be used to restrict the files being shown in a
GtkFileChooser
. Files can be filtered based on their name (withgtk_file_filter_add_pattern()
), on their mime type (withgtk_file_filter_add_mime_type()
), or by a custom filter function (withgtk_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/*.Normally, filters are used by adding them to a
GtkFileChooser
, seegtk_file_chooser_add_filter()
, but it is also possible to manually use a filter on a file withgtk_file_filter_filter()
.GtkFileFilter as GtkBuildable
The GtkFileFilter implementation of the GtkBuildable interface supports adding rules using the <mime-types>, <patterns> and <applications> elements and listing the rules within. Specifying a <mime-type> or <pattern> has the same effect as as calling
gtk_file_filter_add_mime_type()
orgtk_file_filter_add_pattern()
.An example of a UI definition fragment specifying GtkFileFilter rules:
<object class="GtkFileFilter"> <mime-types> <mime-type>text/plain</mime-type> <mime-type>image/ *</mime-type> </mime-types> <patterns> <pattern>*.txt</pattern> <pattern>*.png</pattern> </patterns> </object>
The
See moreFileFilterProtocol
protocol exposes the methods and properties of an underlyingGtkFileFilter
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileFilter
. Alternatively, useFileFilterRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileFilterProtocol : InitiallyUnownedProtocol, BuildableProtocol
-
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:Themes, which may change widget sizes.
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 a different OS that provides different fonts.
Translation of text into other languages changes its size. Also, display of non-English text will use a different font in many cases.
In addition,
GtkFixed
does not pay attention to text direction and thus may produce unwanted results if your app is run under right-to-left languages such as Hebrew or Arabic. That is: normally GTK+ will order containers appropriately for the text direction, e.g. to put labels to the right of the thing they label when using an RTL language, but it can’t do that withGtkFixed
. So if you need to reorder widgets depending on the text direction, you would need to manually detect it and adjust child positions accordingly.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.See also
GtkLayout
, which shares the ability to perform fixed positioning of child widgets and additionally adds custom drawing and scrollability.The
See moreFixedProtocol
protocol exposes the methods and properties of an underlyingGtkFixed
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFixed
. Alternatively, useFixedRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FixedProtocol : ContainerProtocol
-
A GtkFlowBox positions child widgets in sequence according to its orientation.
For instance, with the horizontal orientation, the widgets will be arranged from left to right, starting a new row under the previous row when necessary. Reducing the width in this case will require more rows, so a larger height will be requested.
Likewise, with the vertical orientation, the widgets will be arranged from top to bottom, starting a new column to the right when necessary. Reducing the height will require more columns, so a larger width will be requested.
The size request of a GtkFlowBox alone may not be what you expect; if you need to be able to shrink it along both axes and dynamically reflow its children, you may have to wrap it in a
GtkScrolledWindow
to enable that.The children of a GtkFlowBox can be dynamically sorted and filtered.
Although a GtkFlowBox must have only
GtkFlowBoxChild
children, you can add any kind of widget to it viagtk_container_add()
, and a GtkFlowBoxChild widget will automatically be inserted between the box and the widget.Also see
GtkListBox
.GtkFlowBox was added in GTK+ 3.12.
CSS nodes
(plain Language Example):
flowbox ├── flowboxchild │ ╰── <child> ├── flowboxchild │ ╰── <child> ┊ ╰── [rubberband]
GtkFlowBox uses a single CSS node with name flowbox. GtkFlowBoxChild uses a single CSS node with name flowboxchild. For rubberband selection, a subnode with name rubberband is used.
The
See moreFlowBoxProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBox
. Alternatively, useFlowBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxProtocol : ContainerProtocol, OrientableProtocol
-
The
See moreFlowBoxAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxAccessible
. Alternatively, useFlowBoxAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxAccessibleProtocol : SelectionProtocol, ContainerAccessibleProtocol
-
The
See moreFlowBoxChildProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxChild
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxChild
. Alternatively, useFlowBoxChildRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxChildProtocol : BinProtocol
-
The
See moreFlowBoxChildAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxChildAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxChildAccessible
. Alternatively, useFlowBoxChildAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxChildAccessibleProtocol : ContainerAccessibleProtocol
-
The
GtkFontButton
is a button which displays the currently selected font an allows to open a font chooser dialog to change the font. It is suitable widget for selecting a font in a preference dialog.CSS nodes
GtkFontButton has a single CSS node with name button and style class .font.
The
See moreFontButtonProtocol
protocol exposes the methods and properties of an underlyingGtkFontButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontButton
. Alternatively, useFontButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontButtonProtocol : ButtonProtocol, FontChooserProtocol
-
The
GtkFontChooserDialog
widget is a dialog for selecting a font. It implements theGtkFontChooser
interface.GtkFontChooserDialog as GtkBuildable
The GtkFontChooserDialog implementation of the
GtkBuildable
interface exposes the buttons with the names “select_button” and “cancel_button”.The
See moreFontChooserDialogProtocol
protocol exposes the methods and properties of an underlyingGtkFontChooserDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontChooserDialog
. Alternatively, useFontChooserDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontChooserDialogProtocol : DialogProtocol, FontChooserProtocol
-
The
GtkFontChooserWidget
widget lists the available fonts, styles and sizes, allowing the user to select a font. It is used in theGtkFontChooserDialog
widget to provide a dialog box for selecting fonts.To set the font which is initially selected, use
gtk_font_chooser_set_font()
orgtk_font_chooser_set_font_desc()
.To get the selected font use
gtk_font_chooser_get_font()
orgtk_font_chooser_get_font_desc()
.To change the text which is shown in the preview area, use
gtk_font_chooser_set_preview_text()
.CSS nodes
GtkFontChooserWidget has a single CSS node with name fontchooser.
The
See moreFontChooserWidgetProtocol
protocol exposes the methods and properties of an underlyingGtkFontChooserWidget
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontChooserWidget
. Alternatively, useFontChooserWidgetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontChooserWidgetProtocol : BoxProtocol, FontChooserProtocol
-
The
See moreFontSelectionProtocol
protocol exposes the methods and properties of an underlyingGtkFontSelection
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontSelection
. Alternatively, useFontSelectionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontSelectionProtocol : BoxProtocol
-
The
See moreFontSelectionDialogProtocol
protocol exposes the methods and properties of an underlyingGtkFontSelectionDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontSelectionDialog
. Alternatively, useFontSelectionDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontSelectionDialogProtocol : DialogProtocol
-
The frame widget is a bin that surrounds its child with a decorative frame and an optional label. If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with
gtk_frame_set_label_align()
.GtkFrame as GtkBuildable
The GtkFrame implementation of the GtkBuildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.
An example of a UI definition fragment with GtkFrame:
<object class="GtkFrame"> <child type="label"> <object class="GtkLabel" id="frame-label"/> </child> <child> <object class="GtkEntry" id="frame-content"/> </child> </object>
CSS nodes
(plain Language Example):
frame ├── border[.flat] ├── <label widget> ╰── <child>
GtkFrame has a main CSS node named “frame” and a subnode named “border”. The “border” node is used to draw the visible border. You can set the appearance of the border using CSS properties like “border-style” on the “border” node.
The border node can be given the style class “.flat”, which is used by themes to disable drawing of the border. To do this from code, call
gtk_frame_set_shadow_type()
withGTK_SHADOW_NONE
to add the “.flat” class or any other shadow type to remove it.The
See moreFrameProtocol
protocol exposes the methods and properties of an underlyingGtkFrame
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFrame
. Alternatively, useFrameRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FrameProtocol : BinProtocol
-
The
See moreFrameAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkFrameAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFrameAccessible
. Alternatively, useFrameAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FrameAccessibleProtocol : ContainerAccessibleProtocol
-
GtkGLArea
is a widget that allows drawing with OpenGL.GtkGLArea
sets up its ownGdkGLContext
for the window it creates, and creates a custom GL framebuffer that the widget will do GL rendering onto. It also ensures that this framebuffer is the default GL rendering target when rendering.In order to draw, you have to connect to the
GtkGLArea::render
signal, or subclassGtkGLArea
and override theGtkGLAreaClass.render
()
virtual function.The
GtkGLArea
widget ensures that theGdkGLContext
is associated with the widget’s drawing area, and it is kept updated when the size and position of the drawing area changes.Drawing with GtkGLArea
The simplest way to draw using OpenGL commands in a
GtkGLArea
is to create a widget instance and connect to theGtkGLArea::render
signal:(C Language Example):
// create a GtkGLArea instance GtkWidget *gl_area = gtk_gl_area_new (); // connect to the "render" signal g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
The
render()
function will be called when theGtkGLArea
is ready for you to draw its content:(C Language Example):
static gboolean render (GtkGLArea *area, GdkGLContext *context) { // inside this function it's safe to use GL; the given // #GdkGLContext has been made current to the drawable // surface used by the #GtkGLArea and the viewport has // already been set to be the size of the allocation // we can start by clearing the buffer glClearColor (0, 0, 0, 0); glClear (GL_COLOR_BUFFER_BIT); // draw your object draw_an_object (); // we completed our drawing; the draw commands will be // flushed at the end of the signal emission chain, and // the buffers will be drawn on the window return TRUE; }
If you need to initialize OpenGL state, e.g. buffer objects or shaders, you should use the
GtkWidget::realize
signal; you can use theGtkWidget::unrealize
signal to clean up. Since theGdkGLContext
creation and initialization may fail, you will need to check for errors, usinggtk_gl_area_get_error()
. An example of how to safely initialize the GL state is:(C Language Example):
static void on_realize (GtkGLarea *area) { // We need to make the context current if we want to // call GL API gtk_gl_area_make_current (area); // If there were errors during the initialization or // when trying to make the context current, this // function will return a #GError for you to catch if (gtk_gl_area_get_error (area) != NULL) return; // You can also use gtk_gl_area_set_error() in order // to show eventual initialization errors on the // GtkGLArea widget itself GError *internal_error = NULL; init_buffer_objects (&error); if (error != NULL) { gtk_gl_area_set_error (area, error); g_error_free (error); return; } init_shaders (&error); if (error != NULL) { gtk_gl_area_set_error (area, error); g_error_free (error); return; } }
If you need to change the options for creating the
GdkGLContext
you should use theGtkGLArea::create-context
signal.The
See moreGLAreaProtocol
protocol exposes the methods and properties of an underlyingGtkGLArea
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGLArea
. Alternatively, useGLAreaRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GLAreaProtocol : WidgetProtocol
-
The
See moreFileChooserDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserDialogClass
. Alternatively, useFileChooserDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserDialogClassProtocol
-
The
See moreFileChooserNativeClassProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserNativeClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserNativeClass
. Alternatively, useFileChooserNativeClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserNativeClassProtocol
-
The
See moreFileChooserWidgetAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserWidgetAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserWidgetAccessibleClass
. Alternatively, useFileChooserWidgetAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserWidgetAccessibleClassProtocol
-
The
See moreFileChooserWidgetClassProtocol
protocol exposes the methods and properties of an underlyingGtkFileChooserWidgetClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileChooserWidgetClass
. Alternatively, useFileChooserWidgetClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileChooserWidgetClassProtocol
-
A
GtkFileFilterInfo-struct
is used to pass information about the tested file togtk_file_filter_filter()
.The
See moreFileFilterInfoProtocol
protocol exposes the methods and properties of an underlyingGtkFileFilterInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFileFilterInfo
. Alternatively, useFileFilterInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FileFilterInfoProtocol
-
The
See moreFixedChildProtocol
protocol exposes the methods and properties of an underlyingGtkFixedChild
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFixedChild
. Alternatively, useFixedChildRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FixedChildProtocol
-
The
See moreFixedClassProtocol
protocol exposes the methods and properties of an underlyingGtkFixedClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFixedClass
. Alternatively, useFixedClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FixedClassProtocol
-
The
See moreFlowBoxAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxAccessibleClass
. Alternatively, useFlowBoxAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxAccessibleClassProtocol
-
The
See moreFlowBoxChildAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxChildAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxChildAccessibleClass
. Alternatively, useFlowBoxChildAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxChildAccessibleClassProtocol
-
The
See moreFlowBoxChildClassProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxChildClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxChildClass
. Alternatively, useFlowBoxChildClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxChildClassProtocol
-
The
See moreFlowBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkFlowBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlowBoxClass
. Alternatively, useFlowBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlowBoxClassProtocol
-
The
See moreFontButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkFontButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontButtonClass
. Alternatively, useFontButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontButtonClassProtocol
-
The
See moreFontChooserDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkFontChooserDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontChooserDialogClass
. Alternatively, useFontChooserDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontChooserDialogClassProtocol
-
The
See moreFontChooserIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkFontChooserIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontChooserIface
. Alternatively, useFontChooserIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontChooserIfaceProtocol
-
The
See moreFontChooserWidgetClassProtocol
protocol exposes the methods and properties of an underlyingGtkFontChooserWidgetClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontChooserWidgetClass
. Alternatively, useFontChooserWidgetClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontChooserWidgetClassProtocol
-
The
See moreFontSelectionClassProtocol
protocol exposes the methods and properties of an underlyingGtkFontSelectionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontSelectionClass
. Alternatively, useFontSelectionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontSelectionClassProtocol
-
The
See moreFontSelectionDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkFontSelectionDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFontSelectionDialogClass
. Alternatively, useFontSelectionDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FontSelectionDialogClassProtocol
-
The
See moreFrameAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkFrameAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFrameAccessibleClass
. Alternatively, useFrameAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FrameAccessibleClassProtocol
-
The
See moreFrameClassProtocol
protocol exposes the methods and properties of an underlyingGtkFrameClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFrameClass
. Alternatively, useFrameClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FrameClassProtocol
-
The
GtkGLAreaClass
structure contains only private data.The
See moreGLAreaClassProtocol
protocol exposes the methods and properties of an underlyingGtkGLAreaClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGLAreaClass
. Alternatively, useGLAreaClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GLAreaClassProtocol
-
GtkGesture
is the base object for gesture recognition, although this object is quite generalized to serve as a base for multi-touch gestures, it is suitable to implement single-touch and pointer-based gestures (using the specialnil
GdkEventSequence
value for these).The number of touches that a
GtkGesture
need to be recognized is controlled by theGtkGesture:n-points
property, if a gesture is keeping track of less or more than that number of sequences, it won’t check wether the gesture is recognized.As soon as the gesture has the expected number of touches, the gesture will run the
GtkGesture::check
signal regularly on input events until the gesture is recognized, the criteria to consider a gesture as “recognized” is left toGtkGesture
subclasses.A recognized gesture will then emit the following signals:
GtkGesture::begin
when the gesture is recognized.- A number of
GtkGesture::update
, whenever an input event is processed. GtkGesture::end
when the gesture is no longer recognized.
Event propagation
In order to receive events, a gesture needs to either set a propagation phase through
gtk_event_controller_set_propagation_phase()
, or feed those manually throughgtk_event_controller_handle_event()
.In the capture phase, events are propagated from the toplevel down to the target widget, and gestures that are attached to containers above the widget get a chance to interact with the event before it reaches the target.
After the capture phase, GTK+ emits the traditional
GtkWidget::button-press-event
,GtkWidget::button-release-event
,GtkWidget::touch-event
, etc signals. Gestures with theGTK_PHASE_TARGET
phase are fed events from the defaultGtkWidget::event
handlers.In the bubble phase, events are propagated up from the target widget to the toplevel, and gestures that are attached to containers above the widget get a chance to interact with events that have not been handled yet.
States of a sequence #
Whenever input interaction happens, a single event may trigger a cascade of
GtkGestures
, both across the parents of the widget receiving the event and in parallel within an individual widget. It is a responsibility of the widgets using those gestures to set the state of touch sequences accordingly in order to enable cooperation of gestures around theGdkEventSequences
triggering those.Within a widget, gestures can be grouped through
gtk_gesture_group()
, grouped gestures synchronize the state of sequences, so callinggtk_gesture_set_sequence_state()
on one will effectively propagate the state throughout the group.By default, all sequences start out in the
GTK_EVENT_SEQUENCE_NONE
state, sequences in this state trigger the gesture event handler, but event propagation will continue unstopped by gestures.If a sequence enters into the
GTK_EVENT_SEQUENCE_DENIED
state, the gesture group will effectively ignore the sequence, letting events go unstopped through the gesture, but the “slot” will still remain occupied while the touch is active.If a sequence enters in the
GTK_EVENT_SEQUENCE_CLAIMED
state, the gesture group will grab all interaction on the sequence, by:- Setting the same sequence to
GTK_EVENT_SEQUENCE_DENIED
on every other gesture group within the widget, and every gesture on parent widgets in the propagation chain. - calling
GtkGesture::cancel
on every gesture in widgets underneath in the propagation chain. - Stopping event propagation after the gesture group handles the event.
Note: if a sequence is set early to
GTK_EVENT_SEQUENCE_CLAIMED
onGDK_TOUCH_BEGIN
/GDK_BUTTON_PRESS
(so those events are captured before reaching the event widget, this impliesGTK_PHASE_CAPTURE
), one similar event will emulated if the sequence changes toGTK_EVENT_SEQUENCE_DENIED
. This way event coherence is preserved before event propagation is unstopped again.Sequence states can’t be changed freely, see
gtk_gesture_set_sequence_state()
to know about the possible lifetimes of aGdkEventSequence
.Touchpad gestures
On the platforms that support it,
GtkGesture
will handle transparently touchpad gesture events. The only precautions users ofGtkGesture
should do to enable this support are:- Enabling
GDK_TOUCHPAD_GESTURE_MASK
on theirGdkWindows
- If the gesture has
GTK_PHASE_NONE
, ensuring events of typeGDK_TOUCHPAD_SWIPE
andGDK_TOUCHPAD_PINCH
are handled by theGtkGesture
The
See moreGestureProtocol
protocol exposes the methods and properties of an underlyingGtkGesture
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGesture
. Alternatively, useGestureRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureProtocol : EventControllerProtocol
-
GtkGestureDrag
is aGtkGesture
implementation that recognizes drag operations. The drag operation itself can be tracked throught theGtkGestureDrag::drag-begin
,GtkGestureDrag::drag-update
andGtkGestureDrag::drag-end
signals, or the relevant coordinates be extracted throughgtk_gesture_drag_get_offset()
andgtk_gesture_drag_get_start_point()
.The
See moreGestureDragProtocol
protocol exposes the methods and properties of an underlyingGtkGestureDrag
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureDrag
. Alternatively, useGestureDragRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureDragProtocol : GestureSingleProtocol
-
GtkGestureLongPress
is aGtkGesture
implementation able to recognize long presses, triggering theGtkGestureLongPress::pressed
after the timeout is exceeded.If the touchpoint is lifted before the timeout passes, or if it drifts too far of the initial press point, the
GtkGestureLongPress::cancelled
signal will be emitted.The
See moreGestureLongPressProtocol
protocol exposes the methods and properties of an underlyingGtkGestureLongPress
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureLongPress
. Alternatively, useGestureLongPressRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureLongPressProtocol : GestureSingleProtocol
-
GtkGestureMultiPress
is aGtkGesture
implementation able to recognize multiple clicks on a nearby zone, which can be listened for through theGtkGestureMultiPress::pressed
signal. Whenever time or distance between clicks exceed the GTK+ defaults,GtkGestureMultiPress::stopped
is emitted, and the click counter is reset.Callers may also restrict the area that is considered valid for a >1 touch/button press through
gtk_gesture_multi_press_set_area()
, so any click happening outside that area is considered to be a first click of its own.The
See moreGestureMultiPressProtocol
protocol exposes the methods and properties of an underlyingGtkGestureMultiPress
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureMultiPress
. Alternatively, useGestureMultiPressRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureMultiPressProtocol : GestureSingleProtocol
-
GtkGesturePan
is aGtkGesture
implementation able to recognize pan gestures, those are drags that are locked to happen along one axis. The axis that aGtkGesturePan
handles is defined at construct time, and can be changed throughgtk_gesture_pan_set_orientation()
.When the gesture starts to be recognized,
GtkGesturePan
will attempt to determine as early as possible whether the sequence is moving in the expected direction, and denying the sequence if this does not happen.Once a panning gesture along the expected axis is recognized, the
GtkGesturePan::pan
signal will be emitted as input events are received, containing the offset in the given axis.The
See moreGesturePanProtocol
protocol exposes the methods and properties of an underlyingGtkGesturePan
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGesturePan
. Alternatively, useGesturePanRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GesturePanProtocol : GestureDragProtocol
-
GtkGestureRotate
is aGtkGesture
implementation able to recognize 2-finger rotations, whenever the angle between both handled sequences changes, theGtkGestureRotate::angle-changed
signal is emitted.The
See moreGestureRotateProtocol
protocol exposes the methods and properties of an underlyingGtkGestureRotate
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureRotate
. Alternatively, useGestureRotateRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureRotateProtocol : GestureProtocol
-
GtkGestureSingle
is a subclass ofGtkGesture
, optimized (although not restricted) for dealing with mouse and single-touch gestures. Under interaction, these gestures stick to the first interacting sequence, which is accessible throughgtk_gesture_single_get_current_sequence()
while the gesture is being interacted with.By default gestures react to both
GDK_BUTTON_PRIMARY
and touch events,gtk_gesture_single_set_touch_only()
can be used to change the touch behavior. Callers may also specify a different mouse button number to interact with throughgtk_gesture_single_set_button()
, or react to any mouse button by setting 0. While the gesture is active, the button being currently pressed can be known throughgtk_gesture_single_get_current_button()
.The
See moreGestureSingleProtocol
protocol exposes the methods and properties of an underlyingGtkGestureSingle
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureSingle
. Alternatively, useGestureSingleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureSingleProtocol : GestureProtocol
-
GtkGestureStylus
is aGtkGesture
implementation specific to stylus input. The provided signals just provide the basic informationThe
See moreGestureStylusProtocol
protocol exposes the methods and properties of an underlyingGtkGestureStylus
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureStylus
. Alternatively, useGestureStylusRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureStylusProtocol : GestureSingleProtocol
-
GtkGestureSwipe
is aGtkGesture
implementation able to recognize swipes, after a press/move/…/move/release sequence happens, theGtkGestureSwipe::swipe
signal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.If the velocity is desired in intermediate points,
gtk_gesture_swipe_get_velocity()
can be called on eg. aGtkGesture::update
handler.All velocities are reported in pixels/sec units.
The
See moreGestureSwipeProtocol
protocol exposes the methods and properties of an underlyingGtkGestureSwipe
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureSwipe
. Alternatively, useGestureSwipeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureSwipeProtocol : GestureSingleProtocol
-
GtkGestureZoom
is aGtkGesture
implementation able to recognize pinch/zoom gestures, whenever the distance between both tracked sequences changes, theGtkGestureZoom::scale-changed
signal is emitted to report the scale factor.The
See moreGestureZoomProtocol
protocol exposes the methods and properties of an underlyingGtkGestureZoom
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureZoom
. Alternatively, useGestureZoomRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureZoomProtocol : GestureProtocol
-
GtkGrid is a container which arranges its child widgets in rows and columns, with arbitrary positions and horizontal/vertical spans.
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, usinggtk_grid_attach_next_to()
. The behaviour of GtkGrid when several children occupy the same grid cell is undefined.GtkGrid can be used like a
GtkBox
by just usinggtk_container_add()
, which will place children next to each other in the direction determined by theGtkOrientable:orientation
property. However, if all you want is a single row or column, thenGtkBox
is the preferred widget.CSS nodes
GtkGrid uses a single CSS node with name grid.
The
See moreGridProtocol
protocol exposes the methods and properties of an underlyingGtkGrid
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGrid
. Alternatively, useGridRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GridProtocol : ContainerProtocol, OrientableProtocol
-
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 ofGtkHBox
children.All children are allocated the same height.
GtkHBox has been deprecated. You can use
GtkBox
instead, which is a very quick and easy change. If you have derived your own classes from GtkHBox, you can simply change the inheritance to derive directly fromGtkBox
. No further changes are needed, since the default value of theGtkOrientable:orientation
property isGTK_ORIENTATION_HORIZONTAL
.If you have a grid-like layout composed of nested boxes, and you don’t need first-child or last-child styling, the recommendation is to switch to
GtkGrid
. For more information about migrating toGtkGrid
, see Migrating from other containers to GtkGrid.The
See moreHBoxProtocol
protocol exposes the methods and properties of an underlyingGtkHBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHBox
. Alternatively, useHBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HBoxProtocol : BoxProtocol
-
The
See moreGestureClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureClass
. Alternatively, useGestureClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureClassProtocol
-
The
See moreGestureDragClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureDragClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureDragClass
. Alternatively, useGestureDragClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureDragClassProtocol
-
The
See moreGestureLongPressClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureLongPressClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureLongPressClass
. Alternatively, useGestureLongPressClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureLongPressClassProtocol
-
The
See moreGestureMultiPressClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureMultiPressClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureMultiPressClass
. Alternatively, useGestureMultiPressClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureMultiPressClassProtocol
-
The
See moreGesturePanClassProtocol
protocol exposes the methods and properties of an underlyingGtkGesturePanClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGesturePanClass
. Alternatively, useGesturePanClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GesturePanClassProtocol
-
The
See moreGestureRotateClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureRotateClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureRotateClass
. Alternatively, useGestureRotateClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureRotateClassProtocol
-
The
See moreGestureSingleClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureSingleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureSingleClass
. Alternatively, useGestureSingleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureSingleClassProtocol
-
The
See moreGestureStylusClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureStylusClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureStylusClass
. Alternatively, useGestureStylusClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureStylusClassProtocol
-
The
See moreGestureSwipeClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureSwipeClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureSwipeClass
. Alternatively, useGestureSwipeClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureSwipeClassProtocol
-
The
See moreGestureZoomClassProtocol
protocol exposes the methods and properties of an underlyingGtkGestureZoomClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGestureZoomClass
. Alternatively, useGestureZoomClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GestureZoomClassProtocol
-
GtkGradient is a boxed type that represents a gradient. It is the result of parsing a gradient expression. To obtain the gradient represented by a GtkGradient, it has to be resolved with
gtk_gradient_resolve()
, which replaces all symbolic color references by the colors they refer to (in a given context) and constructs acairo_pattern_t
value.It is not normally necessary to deal directly with
GtkGradients
, since they are mostly used behind the scenes byGtkStyleContext
andGtkCssProvider
.GtkGradient
is deprecated. It was used internally by GTK’s CSS engine to represent gradients. As its handling is not conforming to modern web standards, it is not used anymore. If you want to use gradients in your own code, please use Cairo directly.The
See moreGradientProtocol
protocol exposes the methods and properties of an underlyingGtkGradient
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGradient
. Alternatively, useGradientRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GradientProtocol
-
The
See moreGridClassProtocol
protocol exposes the methods and properties of an underlyingGtkGridClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeGridClass
. Alternatively, useGridClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol GridClassProtocol
-
The
See moreHBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkHBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHBoxClass
. Alternatively, useHBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HBoxClassProtocol
-
The
See moreHButtonBoxProtocol
protocol exposes the methods and properties of an underlyingGtkHButtonBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHButtonBox
. Alternatively, useHButtonBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HButtonBoxProtocol : ButtonBoxProtocol
-
The HPaned widget is a container widget with two children arranged horizontally. The division between the two panes is adjustable by the user by dragging a handle. See
GtkPaned
for details.GtkHPaned has been deprecated, use
GtkPaned
instead.The
See moreHPanedProtocol
protocol exposes the methods and properties of an underlyingGtkHPaned
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHPaned
. Alternatively, useHPanedRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HPanedProtocol : PanedProtocol
-
GtkHSV
is the “color wheel” part of a complete color selector widget. It allows to select a color by determining its HSV components in an intuitive way. Moving the selection around the outer ring changes the hue, and moving the selection point inside the inner triangle changes value and saturation.GtkHSV
has been deprecated together withGtkColorSelection
, where it was used.The
See moreHSVProtocol
protocol exposes the methods and properties of an underlyingGtkHSV
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHSV
. Alternatively, useHSVRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HSVProtocol : WidgetProtocol
-
The
GtkHScale
widget is used to allow the user to select a value using a horizontal slider. To create one, usegtk_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.GtkHScale has been deprecated, use
GtkScale
instead.The
See moreHScaleProtocol
protocol exposes the methods and properties of an underlyingGtkHScale
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHScale
. Alternatively, useHScaleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HScaleProtocol : ScaleProtocol
-
The
GtkHScrollbar
widget is a widget arranged horizontally creating a scrollbar. SeeGtkScrollbar
for details on scrollbars.GtkAdjustment
pointers may be added to handle the adjustment of the scrollbar or it may be leftnil
in which case one will be created for you. SeeGtkScrollbar
for a description of what the fields in an adjustment represent for a scrollbar.GtkHScrollbar has been deprecated, use
GtkScrollbar
instead.The
See moreHScrollbarProtocol
protocol exposes the methods and properties of an underlyingGtkHScrollbar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHScrollbar
. Alternatively, useHScrollbarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HScrollbarProtocol : ScrollbarProtocol
-
The
GtkHSeparator
widget is a horizontal separator, used to group the widgets within a window. It displays a horizontal line with a shadow to make it appear sunken into the interface.> The
GtkHSeparator
widget is not used as a separator within menus. > To create a separator in a menu create an emptyGtkSeparatorMenuItem
> widget usinggtk_separator_menu_item_new()
and add it to the menu with >gtk_menu_shell_append()
.GtkHSeparator has been deprecated, use
GtkSeparator
instead.The
See moreHSeparatorProtocol
protocol exposes the methods and properties of an underlyingGtkHSeparator
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHSeparator
. Alternatively, useHSeparatorRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HSeparatorProtocol : SeparatorProtocol
-
The
GtkHandleBox
widget allows a portion of a window to be “torn off”. It is a bin widget which displays its child and a handle that the user can drag to tear off a separate window (the “float window”) containing the child widget. A thin “ghost” is drawn in the original location of the handlebox. By dragging the separate window back to its original location, it can be reattached.When reattaching, the ghost and float window, must be aligned along one of the edges, the “snap edge”. This either can be specified by the application programmer explicitly, or GTK+ will pick a reasonable default based on the handle position.
To make detaching and reattaching the handlebox as minimally confusing as possible to the user, it is important to set the snap edge so that the snap edge does not move when the handlebox is deattached. For instance, if the handlebox is packed at the bottom of a VBox, then when the handlebox is detached, the bottom edge of the handlebox’s allocation will remain fixed as the height of the handlebox shrinks, so the snap edge should be set to
GTK_POS_BOTTOM
.>
GtkHandleBox
has been deprecated. It is very specialized, lacks features > to make it useful and most importantly does not fit well into modern > application design. Do not use it. There is no replacement.The
See moreHandleBoxProtocol
protocol exposes the methods and properties of an underlyingGtkHandleBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHandleBox
. Alternatively, useHandleBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HandleBoxProtocol : BinProtocol
-
GtkHeaderBar is similar to a horizontal
GtkBox
. It allows children to be placed at the start or the end. In addition, it allows a title and subtitle to be displayed. The title will be centered with respect to the width of the box, even if the children at either side take up different amounts of space. The height of the titlebar will be set to provide sufficient space for the subtitle, even if none is currently set. If a subtitle is not needed, the space reservation can be turned off withgtk_header_bar_set_has_subtitle()
.GtkHeaderBar can add typical window frame controls, such as minimize, maximize and close buttons, or the window icon.
For these reasons, GtkHeaderBar is the natural choice for use as the custom titlebar widget of a
GtkWindow
(seegtk_window_set_titlebar()
), as it gives features typical of titlebars while allowing the addition of child widgets.The
See moreHeaderBarProtocol
protocol exposes the methods and properties of an underlyingGtkHeaderBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHeaderBar
. Alternatively, useHeaderBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HeaderBarProtocol : ContainerProtocol
-
The
See moreHeaderBarAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkHeaderBarAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHeaderBarAccessible
. Alternatively, useHeaderBarAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HeaderBarAccessibleProtocol : ContainerAccessibleProtocol
-
GtkIMContext
defines the interface for GTK+ input methods. An input method is used by GTK+ text input widgets likeGtkEntry
to map from key events to Unicode character strings.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 Running GTK+ Applications.The
GtkEntry
GtkEntry:im-module
andGtkTextView
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
orGtkIMContextSimple
and exports these four functions:(C Language Example):
void im_module_init(GTypeModule *module);
This function should register the
GType
of theGtkIMContext
subclass which implements the input method by means ofg_type_module_register_type()
. Note thatg_type_register_static()
cannot be used as the type needs to be registered dynamically.(C Language Example):
void im_module_exit(void);
Here goes any cleanup code your input method might require on module unload.
(C Language Example):
void im_module_list(const GtkIMContextInfo ***contexts, int *n_contexts) { *contexts = info_list; *n_contexts = G_N_ELEMENTS (info_list); }
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.(C Language Example):
GtkIMContext * im_module_create(const gchar *context_id);
This function should return a pointer to a newly created instance of the
GtkIMContext
subclass identified bycontext_id
. The context ID is the same as specified in theGtkIMContextInfo
array returned byim_module_list()
.After a new loadable input method module has been installed on the system, the configuration file
gtk.immodules
needs to be regenerated by gtk-query-immodules-3.0, in order for the new input method to become available to GTK+ applications.The
See moreIMContextProtocol
protocol exposes the methods and properties of an underlyingGtkIMContext
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMContext
. Alternatively, useIMContextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMContextProtocol : ObjectProtocol
-
The
See moreHButtonBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkHButtonBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHButtonBoxClass
. Alternatively, useHButtonBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HButtonBoxClassProtocol
-
The
See moreHPanedClassProtocol
protocol exposes the methods and properties of an underlyingGtkHPanedClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHPanedClass
. Alternatively, useHPanedClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HPanedClassProtocol
-
The
See moreHSVClassProtocol
protocol exposes the methods and properties of an underlyingGtkHSVClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHSVClass
. Alternatively, useHSVClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HSVClassProtocol
-
The
See moreHScaleClassProtocol
protocol exposes the methods and properties of an underlyingGtkHScaleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHScaleClass
. Alternatively, useHScaleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HScaleClassProtocol
-
The
See moreHScrollbarClassProtocol
protocol exposes the methods and properties of an underlyingGtkHScrollbarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHScrollbarClass
. Alternatively, useHScrollbarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HScrollbarClassProtocol
-
The
See moreHSeparatorClassProtocol
protocol exposes the methods and properties of an underlyingGtkHSeparatorClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHSeparatorClass
. Alternatively, useHSeparatorClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HSeparatorClassProtocol
-
The
See moreHandleBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkHandleBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHandleBoxClass
. Alternatively, useHandleBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HandleBoxClassProtocol
-
The
See moreHeaderBarAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkHeaderBarAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHeaderBarAccessibleClass
. Alternatively, useHeaderBarAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HeaderBarAccessibleClassProtocol
-
The
See moreHeaderBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkHeaderBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeHeaderBarClass
. Alternatively, useHeaderBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol HeaderBarClassProtocol
-
The
See moreIMContextClassProtocol
protocol exposes the methods and properties of an underlyingGtkIMContextClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMContextClass
. Alternatively, useIMContextClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMContextClassProtocol
-
Bookkeeping information about a loadable input method.
The
See moreIMContextInfoProtocol
protocol exposes the methods and properties of an underlyingGtkIMContextInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMContextInfo
. Alternatively, useIMContextInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMContextInfoProtocol
-
The
See moreIMContextSimpleClassProtocol
protocol exposes the methods and properties of an underlyingGtkIMContextSimpleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMContextSimpleClass
. Alternatively, useIMContextSimpleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMContextSimpleClassProtocol
-
The
See moreIMMulticontextClassProtocol
protocol exposes the methods and properties of an underlyingGtkIMMulticontextClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMMulticontextClass
. Alternatively, useIMMulticontextClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMMulticontextClassProtocol
-
The
See moreIconFactoryClassProtocol
protocol exposes the methods and properties of an underlyingGtkIconFactoryClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconFactoryClass
. Alternatively, useIconFactoryClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconFactoryClassProtocol
-
The
See moreIconInfoClassProtocol
protocol exposes the methods and properties of an underlyingGtkIconInfoClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconInfoClass
. Alternatively, useIconInfoClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconInfoClassProtocol
-
The
See moreIconSetProtocol
protocol exposes the methods and properties of an underlyingGtkIconSet
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconSet
. Alternatively, useIconSetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconSetProtocol
-
The
See moreIconSourceProtocol
protocol exposes the methods and properties of an underlyingGtkIconSource
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconSource
. Alternatively, useIconSourceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconSourceProtocol
-
The
See moreIconThemeClassProtocol
protocol exposes the methods and properties of an underlyingGtkIconThemeClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconThemeClass
. Alternatively, useIconThemeClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconThemeClassProtocol
-
The
See moreIconViewAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkIconViewAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconViewAccessibleClass
. Alternatively, useIconViewAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconViewAccessibleClassProtocol
-
The
See moreIconViewClassProtocol
protocol exposes the methods and properties of an underlyingGtkIconViewClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconViewClass
. Alternatively, useIconViewClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconViewClassProtocol
-
The
See moreImageAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkImageAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageAccessibleClass
. Alternatively, useImageAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageAccessibleClassProtocol
-
The
See moreImageCellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkImageCellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageCellAccessibleClass
. Alternatively, useImageCellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageCellAccessibleClassProtocol
-
The
See moreImageClassProtocol
protocol exposes the methods and properties of an underlyingGtkImageClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageClass
. Alternatively, useImageClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageClassProtocol
-
The
See moreImageMenuItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkImageMenuItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageMenuItemClass
. Alternatively, useImageMenuItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageMenuItemClassProtocol
-
The
See moreInfoBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkInfoBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInfoBarClass
. Alternatively, useInfoBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol InfoBarClassProtocol
-
The
See moreInvisibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkInvisibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInvisibleClass
. Alternatively, useInvisibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol InvisibleClassProtocol
-
The
See moreLabelAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkLabelAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLabelAccessibleClass
. Alternatively, useLabelAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LabelAccessibleClassProtocol
-
GtkIMContextSimple is a simple input method context supporting table-based input methods. It has a built-in table of compose sequences that is derived from the X11 Compose files.
GtkIMContextSimple reads additional compose sequences from the first of the following files that is found: ~/.config/gtk-3.0/Compose, ~/.XCompose, /usr/share/X11/locale/$locale/Compose (for locales that have a nontrivial Compose file). The syntax of these files is described in the
Compose(5)
manual page.Unicode characters
GtkIMContextSimple also supports numeric entry of Unicode characters by typing Ctrl-Shift-u, followed by a hexadecimal Unicode codepoint. For example, Ctrl-Shift-u 1 2 3 Enter yields U+0123 LATIN SMALL LETTER G WITH CEDILLA, i.e. ģ.
The
See moreIMContextSimpleProtocol
protocol exposes the methods and properties of an underlyingGtkIMContextSimple
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMContextSimple
. Alternatively, useIMContextSimpleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMContextSimpleProtocol : IMContextProtocol
-
The
See moreIMMulticontextProtocol
protocol exposes the methods and properties of an underlyingGtkIMMulticontext
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIMMulticontext
. Alternatively, useIMMulticontextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IMMulticontextProtocol : IMContextProtocol
-
An icon factory manages a collection of
GtkIconSet
; aGtkIconSet
manages a set of variants of a particular icon (i.e. aGtkIconSet
contains variants for different sizes and widget states). Icons in an icon factory are named by a stock ID, which is a simple string identifying the icon. EachGtkStyle
has a list ofGtkIconFactory
derived from the current theme; those icon factories are consulted first when searching for an icon. If the theme doesn’t set a particular icon, GTK+ looks for the icon in a list of default icon factories, maintained bygtk_icon_factory_add_default()
andgtk_icon_factory_remove_default()
. Applications with icons should add a default icon factory with their icons, which will allow themes to override the icons for the application.To display an icon, always use
gtk_style_lookup_icon_set()
on the widget that will display the icon, or the convenience functiongtk_widget_render_icon()
. These functions take the theme into account when looking up the icon to use for a given stock ID.GtkIconFactory as GtkBuildable #
GtkIconFactory supports a custom <sources> element, which can contain multiple <source> elements. The following attributes are allowed:
stock-id
The stock id of the source, a string. This attribute is mandatory
filename
The filename of the source, a string. This attribute is optional
icon-name
The icon name for the source, a string. This attribute is optional.
size
Size of the icon, a
GtkIconSize
enum value. This attribute is optional.direction
Direction of the source, a
GtkTextDirection
enum value. This attribute is optional.state
State of the source, a
GtkStateType
enum value. This attribute is optional.
A
GtkIconFactory
UI definition fragment.<object class="GtkIconFactory" id="iconfactory1"> <sources> <source stock-id="apple-red" filename="apple-red.png"/> </sources> </object> <object class="GtkWindow" id="window1"> <child> <object class="GtkButton" id="apple_button"> <property name="label">apple-red</property> <property name="use-stock">True</property> </object> </child> </object>
The
See moreIconFactoryProtocol
protocol exposes the methods and properties of an underlyingGtkIconFactory
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconFactory
. Alternatively, useIconFactoryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconFactoryProtocol : ObjectProtocol, BuildableProtocol
-
Contains information found when looking up an icon in an icon theme.
The
See moreIconInfoProtocol
protocol exposes the methods and properties of an underlyingGtkIconInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconInfo
. Alternatively, useIconInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconInfoProtocol : ObjectProtocol
-
GtkIconTheme
provides a facility for looking up icons by name and size. The main reason for using a name rather than simply providing a filename is to allow different icons to be used depending on what “icon theme” is selected by the user. The operation of icon themes on Linux and Unix follows the Icon Theme Specification There is a fallback icon theme, namedhicolor
, where applications should install their icons, but additional icon themes can be installed as operating system vendors and users choose.Named icons are similar to the deprecated Stock Items, and the distinction between the two may be a bit confusing. A few things to keep in mind:
Stock images usually are used in conjunction with Stock Items, such as
GTK_STOCK_OK
orGTK_STOCK_OPEN
. Named icons are easier to set up and therefore are more useful for new icons that an application wants to add, such as application icons or window icons.Stock images can only be loaded at the symbolic sizes defined by the
GtkIconSize
enumeration, or by custom sizes defined bygtk_icon_size_register()
, while named icons are more flexible and any pixel size can be specified.Because stock images are closely tied to stock items, and thus to actions in the user interface, stock images may come in multiple variants for different widget states or writing directions.
A good rule of thumb is that if there is a stock image for what you want to use, use it, otherwise use a named icon. It turns out that internally stock images are generally defined in terms of one or more named icons. (An example of the more than one case is icons that depend on writing direction;
GTK_STOCK_GO_FORWARD
uses the two themed icons “gtk-stock-go-forward-ltr” and “gtk-stock-go-forward-rtl”.)In many cases, named themes are used indirectly, via
GtkImage
or stock items, rather than directly, but looking up icons directly is also simple. TheGtkIconTheme
object acts as a database of all the icons in the current theme. You can create newGtkIconTheme
objects, but it’s much more efficient to use the standard icon theme for theGdkScreen
so that the icon information is shared with other people looking up icons. (C Language Example):GError *error = NULL; GtkIconTheme *icon_theme; GdkPixbuf *pixbuf; icon_theme = gtk_icon_theme_get_default (); pixbuf = gtk_icon_theme_load_icon (icon_theme, "my-icon-name", // icon name 48, // icon size 0, // flags &error); if (!pixbuf) { g_warning ("Couldn’t load icon: %s", error->message); g_error_free (error); } else { // Use the pixbuf g_object_unref (pixbuf); }
The
See moreIconThemeProtocol
protocol exposes the methods and properties of an underlyingGtkIconTheme
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconTheme
. Alternatively, useIconThemeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconThemeProtocol : ObjectProtocol
-
GtkIconView
provides an alternative view on aGtkTreeModel
. It displays the model as a grid of icons with labels. LikeGtkTreeView
, it allows to select one or multiple items (depending on the selection mode, seegtk_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.CSS nodes
(plain Language Example):
iconview.view ╰── [rubberband]
GtkIconView has a single CSS node with name iconview and style class .view. For rubberband selection, a subnode with name rubberband is used.
The
See moreIconViewProtocol
protocol exposes the methods and properties of an underlyingGtkIconView
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconView
. Alternatively, useIconViewRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconViewProtocol : CellLayoutProtocol, ContainerProtocol, ScrollableProtocol
-
The
See moreIconViewAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkIconViewAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeIconViewAccessible
. Alternatively, useIconViewAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol IconViewAccessibleProtocol : SelectionProtocol, ContainerAccessibleProtocol
-
The
GtkImage
widget displays an image. Various kinds of object can be displayed as an image; most typically, you would load aGdkPixbuf
(“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: (C Language Example):GtkWidget *image; image = gtk_image_new_from_file ("myfile.png");
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 theGtkImage
withgtk_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 ofGtkMisc
, which implies that you can align it (center, left, right) and add padding to it, usingGtkMisc
methods.GtkImage
is a “no window” widget (has noGdkWindow
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 aGtkEventBox
, then connect to the event signals on the event box.Handling button press events on a
GtkImage
.(C Language Example):
static gboolean button_press_callback (GtkWidget *event_box, GdkEventButton *event, gpointer data) { g_print ("Event box clicked at coordinates %f,%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; }
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 “gdk-pixbuf-csource”. This library allows you to convert an image into a C variable declaration, which can then be loaded into a
GdkPixbuf
usinggdk_pixbuf_new_from_inline()
.CSS nodes
GtkImage has a single CSS node with the name image. The style classes may appear on image CSS nodes: .icon-dropshadow, .lowres-icon.
The
See moreImageProtocol
protocol exposes the methods and properties of an underlyingGtkImage
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImage
. Alternatively, useImageRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageProtocol : MiscProtocol
-
The
See moreImageAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkImageAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageAccessible
. Alternatively, useImageAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageAccessibleProtocol : ImageProtocol, WidgetAccessibleProtocol
-
The
See moreImageCellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkImageCellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageCellAccessible
. Alternatively, useImageCellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageCellAccessibleProtocol : ImageProtocol, RendererCellAccessibleProtocol
-
A GtkImageMenuItem is a menu item which has an icon next to the text label.
This is functionally equivalent to:
(C Language Example):
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); GtkWidget *icon = gtk_image_new_from_icon_name ("folder-music-symbolic", GTK_ICON_SIZE_MENU); GtkWidget *label = gtk_label_new ("Music"); GtkWidget *menu_item = gtk_menu_item_new (); gtk_container_add (GTK_CONTAINER (box), icon); gtk_container_add (GTK_CONTAINER (box), label); gtk_container_add (GTK_CONTAINER (menu_item), box); gtk_widget_show_all (menu_item);
Note that the user may disable display of menu icons using the
GtkSettings:gtk-menu-images
setting, so make sure to still fill in the text label. If you want to ensure that your menu items show an icon you are strongly encouraged to use aGtkMenuItem
with aGtkImage
instead.GtkImageMenuItem
has been deprecated since GTK+ 3.10. If you want to display an icon in a menu item, you should useGtkMenuItem
and pack aGtkBox
with aGtkImage
and aGtkLabel
instead. You should also consider usingGtkBuilder
and the XMLGMenu
description for creating menus, by following the GMenu guide. You should consider using icons in menu items only sparingly, and for “objects” (or “nouns”) elements only, like bookmarks, files, and links; “actions” (or “verbs”) should not have icons.Furthermore, if you would like to display keyboard accelerator, you must pack the accel label into the box using
gtk_box_pack_end()
and align the label, otherwise the accelerator will not display correctly. The following code snippet adds a keyboard accelerator to the menu item, with a key binding of Ctrl+M:(C Language Example):
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); GtkWidget *icon = gtk_image_new_from_icon_name ("folder-music-symbolic", GTK_ICON_SIZE_MENU); GtkWidget *label = gtk_accel_label_new ("Music"); GtkWidget *menu_item = gtk_menu_item_new (); GtkAccelGroup *accel_group = gtk_accel_group_new (); gtk_container_add (GTK_CONTAINER (box), icon); gtk_label_set_use_underline (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_add_accelerator (menu_item, "activate", accel_group, GDK_KEY_m, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), menu_item); gtk_box_pack_end (GTK_BOX (box), label, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (menu_item), box); gtk_widget_show_all (menu_item);
The
See moreImageMenuItemProtocol
protocol exposes the methods and properties of an underlyingGtkImageMenuItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeImageMenuItem
. Alternatively, useImageMenuItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ImageMenuItemProtocol : MenuItemProtocol
-
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 toGtkDialog
, which has a action area at the bottom,GtkInfoBar
has an action area at the side.The API of
GtkInfoBar
is very similar toGtkDialog
, allowing you to add buttons to the action area withgtk_info_bar_add_button()
orgtk_info_bar_new_with_buttons()
. The sensitivity of action widgets can be controlled withgtk_info_bar_set_response_sensitive()
. To add widgets to the main content area of aGtkInfoBar
, usegtk_info_bar_get_content_area()
and add your widgets to the container.Similar to
GtkMessageDialog
, the contents of aGtkInfoBar
can by classified as error message, warning, informational message, etc, by usinggtk_info_bar_set_message_type()
. GTK+ may use the message type to determine how the message is displayed.A simple example for using a
GtkInfoBar:
(C Language Example):GtkWidget *widget, *message_label, *content_area; GtkWidget *grid; GtkInfoBar *bar; // set up info bar widget = gtk_info_bar_new (); bar = GTK_INFO_BAR (widget); grid = gtk_grid_new (); gtk_widget_set_no_show_all (widget, TRUE); message_label = gtk_label_new (""); content_area = gtk_info_bar_get_content_area (bar); gtk_container_add (GTK_CONTAINER (content_area), message_label); gtk_info_bar_add_button (bar, _("_OK"), GTK_RESPONSE_OK); g_signal_connect (bar, "response", G_CALLBACK (gtk_widget_hide), NULL); gtk_grid_attach (GTK_GRID (grid), widget, 0, 2, 1, 1); // ... // show an error message gtk_label_set_text (GTK_LABEL (message_label), "An error occurred!"); gtk_info_bar_set_message_type (bar, GTK_MESSAGE_ERROR); gtk_widget_show (bar);
GtkInfoBar as GtkBuildable
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”.
GtkInfoBar supports a custom <action-widgets> element, which can contain multiple <action-widget> 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
).CSS nodes
GtkInfoBar has a single CSS node with name infobar. The node may get one of the style classes .info, .warning, .error or .question, depending on the message type.
The
See moreInfoBarProtocol
protocol exposes the methods and properties of an underlyingGtkInfoBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInfoBar
. Alternatively, useInfoBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol InfoBarProtocol : BoxProtocol
-
The
GtkInvisible
widget is used internally in GTK+, and is probably not very useful for application developers.It is used for reliable pointer grabs and selection handling in the code for drag-and-drop.
The
See moreInvisibleProtocol
protocol exposes the methods and properties of an underlyingGtkInvisible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInvisible
. Alternatively, useInvisibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol InvisibleProtocol : WidgetProtocol
-
The
GtkLabel
widget displays a small amount of text. As the name implies, most labels are used to label another widget such as aGtkButton
, aGtkMenuItem
, or aGtkComboBox
.CSS nodes
(plain Language Example):
label ├── [selection] ├── [link] ┊ ╰── [link]
GtkLabel has a single CSS node with the name label. A wide variety of style classes may be applied to labels, such as .title, .subtitle, .dim-label, etc. In the
GtkShortcutsWindow
, labels are used wth the .keycap style class.If the label has a selection, it gets a subnode with name selection.
If the label has links, there is one subnode per link. These subnodes carry the link or visited state depending on whether they have been visited.
GtkLabel as GtkBuildable
The GtkLabel implementation of the GtkBuildable interface supports a custom <attributes> element, which supports any number of <attribute> elements. The <attribute> element has attributes named “name“, “value“, “start“ and “end“ and allows you to specify
PangoAttribute
values for this label.An example of a UI definition fragment specifying Pango attributes:
<object class="GtkLabel"> <attributes> <attribute name="weight" value="PANGO_WEIGHT_BOLD"/> <attribute name="background" value="red" start="5" end="10"/> </attributes> </object>
The start and end attributes specify the range of characters to which the Pango attribute applies. If start and end are not specified, the attribute is applied to the whole text. Note that specifying ranges does not make much sense with translatable attributes. Use markup embedded in the translatable content instead.
Mnemonics
Labels may contain “mnemonics”. Mnemonics are underlined characters in the label, used for keyboard navigation. Mnemonics are created by providing a string with an underscore before the mnemonic character, such as
"_File"
, to the functionsgtk_label_new_with_mnemonic()
orgtk_label_set_text_with_mnemonic()
.Mnemonics automatically activate any activatable widget the label is inside, such as a
GtkButton
; if the label is not inside the mnemonic’s target widget, you have to tell the label about the target usinggtk_label_set_mnemonic_widget()
. Here’s a simple example where the label is inside a button:(C Language Example):
// Pressing Alt+H will activate this button GtkWidget *button = gtk_button_new (); GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello"); gtk_container_add (GTK_CONTAINER (button), label);
There’s a convenience function to create buttons with a mnemonic label already inside:
(C Language Example):
// Pressing Alt+H will activate this button GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
To create a mnemonic for a widget alongside the label, such as a
GtkEntry
, you have to point the label at the entry withgtk_label_set_mnemonic_widget()
:(C Language Example):
// Pressing Alt+H will focus the entry GtkWidget *entry = gtk_entry_new (); GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
Markup (styled text)
To make it easy to format text in a label (changing colors, fonts, etc.), label text can be provided in a simple markup format.
Here’s how to create a label with a small font: (C Language Example):
GtkWidget *label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
(See complete documentation of available tags in the Pango manual.)
The markup passed to
gtk_label_set_markup()
must be valid; for example, literal <, > and & characters must be escaped as <, >, and &. If you pass text obtained from the user, file, or a network togtk_label_set_markup()
, you’ll want to escape it withg_markup_escape_text()
org_markup_printf_escaped()
.Markup strings are just a convenient way to set the
PangoAttrList
on a label;gtk_label_set_attributes()
may be a simpler way to set attributes in some cases. Be careful though;PangoAttrList
tends to cause internationalization problems, unless you’re applying attributes to the entire string (i.e. unless you set the range of each attribute to [0,G_MAXINT
)). The reason is that specifying the start_index and end_index for aPangoAttribute
requires knowledge of the exact string being displayed, so translations will cause problems.Selectable labels
Labels can be made selectable with
gtk_label_set_selectable()
. Selectable labels allow the user to copy the label contents to the clipboard. Only labels that contain useful-to-copy information — such as error messages — should be made selectable.Text layout #
A label can contain any number of paragraphs, but will have performance problems if it contains more than a small number. Paragraphs are separated by newlines or other paragraph separators understood by Pango.
Labels can automatically wrap text if you call
gtk_label_set_line_wrap()
.gtk_label_set_justify()
sets how the lines in a label align with one another. If you want to set how the label as a whole aligns in its available space, see theGtkWidget:halign
andGtkWidget:valign
properties.The
GtkLabel:width-chars
andGtkLabel:max-width-chars
properties can be used to control the size allocation of ellipsized or wrapped labels. For ellipsizing labels, if either is specified (and less than the actual text size), it is used as the minimum width, and the actual text size is used as the natural width of the label. For wrapping labels, width-chars is used as the minimum width, if specified, and max-width-chars is used as the natural width. Even if max-width-chars specified, wrapping labels will be rewrapped to use all of the available width.Note that the interpretation of
GtkLabel:width-chars
andGtkLabel:max-width-chars
has changed a bit with the introduction of width-for-height geometry management.Links
Since 2.18, GTK+ supports markup for clickable hyperlinks in addition to regular Pango markup. The markup for links is borrowed from HTML, using the
<a>
with “href“ and “title“ attributes. GTK+ renders links similar to the way they appear in web browsers, with colored, underlined text. The “title“ attribute is displayed as a tooltip on the link.An example looks like this:
(C Language Example):
const gchar *text = "Go to the" "<a href=\"http://www.gtk.org title=\"<i>Our</i> website\">" "GTK+ website</a> for more..."; GtkWidget *label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), text);
It is possible to implement custom handling for links and their tooltips with the
GtkLabel::activate-link
signal and thegtk_label_get_current_uri()
function.The
See moreLabelProtocol
protocol exposes the methods and properties of an underlyingGtkLabel
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLabel
. Alternatively, useLabelRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LabelProtocol : MiscProtocol
-
The
See moreLabelAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkLabelAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLabelAccessible
. Alternatively, useLabelAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LabelAccessibleProtocol : HypertextProtocol, TextProtocol, WidgetAccessibleProtocol
-
GtkLayout
is similar toGtkDrawingArea
in that it’s a “blank slate” and doesn’t do anything except paint a blank background by default. It’s different in that it supports scrolling natively due to implementingGtkScrollable
, and can contain child widgets since it’s aGtkContainer
.If you just want to draw, a
GtkDrawingArea
is a better choice since it has lower overhead. If you just need to position child widgets at specific points, thenGtkFixed
provides that functionality on its own.When handling expose events on a
GtkLayout
, you must draw to theGdkWindow
returned bygtk_layout_get_bin_window()
, rather than to the one returned bygtk_widget_get_window()
as you would for aGtkDrawingArea
.The
See moreLayoutProtocol
protocol exposes the methods and properties of an underlyingGtkLayout
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLayout
. Alternatively, useLayoutRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LayoutProtocol : ContainerProtocol, ScrollableProtocol
-
The
GtkLevelBar
is a bar widget that can be used as a level indicator. Typical use cases are displaying the strength of a password, or showing the charge level of a battery.Use
gtk_level_bar_set_value()
to set the current value, andgtk_level_bar_add_offset_value()
to set the value offsets at which the bar will be considered in a different state. GTK will add a few offsets by default on the level bar:GTK_LEVEL_BAR_OFFSET_LOW
,GTK_LEVEL_BAR_OFFSET_HIGH
andGTK_LEVEL_BAR_OFFSET_FULL
, with values 0.25, 0.75 and 1.0 respectively.Note that it is your responsibility to update preexisting offsets when changing the minimum or maximum value. GTK+ will simply clamp them to the new range.
Adding a custom offset on the bar
(C Language Example):
static GtkWidget * create_level_bar (void) { GtkWidget *widget; GtkLevelBar *bar; widget = gtk_level_bar_new (); bar = GTK_LEVEL_BAR (widget); // This changes the value of the default low offset gtk_level_bar_add_offset_value (bar, GTK_LEVEL_BAR_OFFSET_LOW, 0.10); // This adds a new offset to the bar; the application will // be able to change its color CSS like this: // // levelbar block.my-offset { // background-color: magenta; // border-style: solid; // border-color: black; // border-style: 1px; // } gtk_level_bar_add_offset_value (bar, "my-offset", 0.60); return widget; }
The default interval of values is between zero and one, but it’s possible to modify the interval using
gtk_level_bar_set_min_value()
andgtk_level_bar_set_max_value()
. The value will be always drawn in proportion to the admissible interval, i.e. a value of 15 with a specified interval between 10 and 20 is equivalent to a value of 0.5 with an interval between 0 and 1. WhenGTK_LEVEL_BAR_MODE_DISCRETE
is used, the bar level is rendered as a finite number of separated blocks instead of a single one. The number of blocks that will be rendered is equal to the number of units specified by the admissible interval.For instance, to build a bar rendered with five blocks, it’s sufficient to set the minimum value to 0 and the maximum value to 5 after changing the indicator mode to discrete.
GtkLevelBar was introduced in GTK+ 3.6.
GtkLevelBar as GtkBuildable
The GtkLevelBar implementation of the GtkBuildable interface supports a custom <offsets> element, which can contain any number of <offset> elements, each of which must have name and value attributes.
CSS nodes
(plain Language Example):
levelbar[.discrete] ╰── trough ├── block.filled.level-name ┊ ├── block.empty ┊
GtkLevelBar has a main CSS node with name levelbar and one of the style classes .discrete or .continuous and a subnode with name trough. Below the trough node are a number of nodes with name block and style class .filled or .empty. In continuous mode, there is exactly one node of each, in discrete mode, the number of filled and unfilled nodes corresponds to blocks that are drawn. The block.filled nodes also get a style class .level-name corresponding to the level for the current value.
In horizontal orientation, the nodes are always arranged from left to right, regardless of text direction.
The
See moreLevelBarProtocol
protocol exposes the methods and properties of an underlyingGtkLevelBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLevelBar
. Alternatively, useLevelBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LevelBarProtocol : OrientableProtocol, WidgetProtocol
-
The
See moreLevelBarAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkLevelBarAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLevelBarAccessible
. Alternatively, useLevelBarAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LevelBarAccessibleProtocol : ValueProtocol, WidgetAccessibleProtocol
-
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()
orgtk_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 usinggtk_link_button_get_uri()
.By default, GtkLinkButton calls
gtk_show_uri_on_window()
when the button is clicked. This behaviour can be overridden by connecting to theGtkLinkButton::activate-link
signal and returningtrue
from the signal handler.CSS nodes
GtkLinkButton has a single CSS node with name button. To differentiate it from a plain
GtkButton
, it gets the .link style class.The
See moreLinkButtonProtocol
protocol exposes the methods and properties of an underlyingGtkLinkButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLinkButton
. Alternatively, useLinkButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LinkButtonProtocol : ButtonProtocol
-
The
See moreLinkButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkLinkButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLinkButtonAccessible
. Alternatively, useLinkButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LinkButtonAccessibleProtocol : HyperlinkImplProtocol, ButtonAccessibleProtocol
-
A GtkListBox is a vertical container that contains GtkListBoxRow children. These rows can be dynamically sorted and filtered, and headers can be added dynamically depending on the row content. It also allows keyboard and mouse navigation and selection like a typical list.
Using GtkListBox is often an alternative to
GtkTreeView
, especially when the list contents has a more complicated layout than what is allowed by aGtkCellRenderer
, or when the contents is interactive (i.e. has a button in it).Although a
GtkListBox
must have onlyGtkListBoxRow
children you can add any kind of widget to it viagtk_container_add()
, and aGtkListBoxRow
widget will automatically be inserted between the list and the widget.GtkListBoxRows
can be marked as activatable or selectable. If a row is activatable,GtkListBox::row-activated
will be emitted for it when the user tries to activate it. If it is selectable, the row will be marked as selected when the user tries to select it.The GtkListBox widget was added in GTK+ 3.10.
GtkListBox as GtkBuildable
The GtkListBox implementation of the
GtkBuildable
interface supports setting a child as the placeholder by specifying “placeholder” as the “type” attribute of a <child> element. Seegtk_list_box_set_placeholder()
for info.CSS nodes
(plain Language Example):
list ╰── row[.activatable]
GtkListBox uses a single CSS node named list. Each GtkListBoxRow uses a single CSS node named row. The row nodes get the .activatable style class added when appropriate.
The
See moreListBoxProtocol
protocol exposes the methods and properties of an underlyingGtkListBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBox
. Alternatively, useListBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxProtocol : ContainerProtocol
-
The
See moreListBoxAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxAccessible
. Alternatively, useListBoxAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxAccessibleProtocol : SelectionProtocol, ContainerAccessibleProtocol
-
The
See moreListBoxRowProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxRow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxRow
. Alternatively, useListBoxRowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxRowProtocol : ActionableProtocol, BinProtocol
-
The
See moreListBoxRowAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxRowAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxRowAccessible
. Alternatively, useListBoxRowAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxRowAccessibleProtocol : ContainerAccessibleProtocol
-
The
GtkListStore
object is a list model for use with aGtkTreeView
widget. It implements theGtkTreeModel
interface, and consequentialy, can use all of the methods available there. It also implements theGtkTreeSortable
interface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.The
GtkListStore
can accept most GObject types as a column type, though it can’t accept all custom types. Internally, it will keep a copy of data passed in (such as a string or a boxed pointer). Columns that acceptGObjects
are handled a little differently. TheGtkListStore
will keep a reference to the object instead of copying the value. As a result, if the object is modified, it is up to the application writer to callgtk_tree_model_row_changed()
to emit theGtkTreeModel::row_changed
signal. This most commonly affects lists withGdkPixbufs
stored.An example for creating a simple list store: (C Language Example):
enum { COLUMN_STRING, COLUMN_INT, COLUMN_BOOLEAN, N_COLUMNS }; { GtkListStore *list_store; GtkTreePath *path; GtkTreeIter iter; gint i; list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN); for (i = 0; i < 10; i++) { gchar *some_data; some_data = get_some_data (i); // Add a new row to the model gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, COLUMN_STRING, some_data, COLUMN_INT, i, COLUMN_BOOLEAN, FALSE, -1); // As the store will keep a copy of the string internally, // we free some_data. g_free (some_data); } // Modify a particular row path = gtk_tree_path_new_from_string ("4"); gtk_tree_model_get_iter (GTK_TREE_MODEL (list_store), &iter, path); gtk_tree_path_free (path); gtk_list_store_set (list_store, &iter, COLUMN_BOOLEAN, TRUE, -1); }
Performance Considerations
Internally, the
GtkListStore
was implemented with a linked list with a tail pointer prior to GTK+ 2.6. As a result, it was fast at data insertion and deletion, and not fast at random data access. TheGtkListStore
sets theGTK_TREE_MODEL_ITERS_PERSIST
flag, which means thatGtkTreeIters
can be cached while the row exists. Thus, if access to a particular row is needed often and your code is expected to run on older versions of GTK+, it is worth keeping the iter around.Atomic Operations
It is important to note that only the methods
gtk_list_store_insert_with_values()
andgtk_list_store_insert_with_valuesv()
are atomic, in the sense that the row is being appended to the store and the values filled in in a single operation with regard toGtkTreeModel
signaling. In contrast, using e.g.gtk_list_store_append()
and thengtk_list_store_set()
will first create a row, which triggers theGtkTreeModel::row-inserted
signal onGtkListStore
. The row, however, is still empty, and any signal handler connecting toGtkTreeModel::row-inserted
on this particular store should be prepared for the situation that the row might be empty. This is especially important if you are wrapping theGtkListStore
inside aGtkTreeModelFilter
and are using aGtkTreeModelFilterVisibleFunc
. Using any of the non-atomic operations to append rows to theGtkListStore
will cause theGtkTreeModelFilterVisibleFunc
to be visited with an empty row first; the function must be prepared for that.GtkListStore as GtkBuildable
The GtkListStore implementation of the GtkBuildable interface allows to specify the model columns with a <columns> element that may contain multiple <column> elements, each specifying one model column. The “type” attribute specifies the data type for the column.
Additionally, it is possible to specify content for the list store in the UI definition, with the <data> element. It can contain multiple <row> elements, each specifying to content for one row of the list model. Inside a <row>, the <col> elements specify the content for individual cells.
Note that it is probably more common to define your models in the code, and one might consider it a layering violation to specify the content of a list store in a UI definition, data, not presentation, and common wisdom is to separate the two, as far as possible.
An example of a UI Definition fragment for a list store: (C Language Example):
<object class="GtkListStore"> <columns> <column type="gchararray"/> <column type="gchararray"/> <column type="gint"/> </columns> <data> <row> <col id="0">John</col> <col id="1">Doe</col> <col id="2">25</col> </row> <row> <col id="0">Johan</col> <col id="1">Dahlin</col> <col id="2">50</col> </row> </data> </object>
The
See moreListStoreProtocol
protocol exposes the methods and properties of an underlyingGtkListStore
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListStore
. Alternatively, useListStoreRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListStoreProtocol : ObjectProtocol, BuildableProtocol, TreeDragDestProtocol, TreeDragSourceProtocol, TreeSortableProtocol
-
GtkLockButton is a widget that can be used in control panels or preference dialogs to allow users to obtain and revoke authorizations needed to operate the controls. The required authorization is represented by a
GPermission
object. Concrete implementations ofGPermission
may use PolicyKit or some other authorization framework. To obtain a PolicyKit-basedGPermission
, usepolkit_permission_new()
.If the user is not currently allowed to perform the action, but can obtain the permission, the widget looks like this:
and the user can click the button to request the permission. Depending on the platform, this may pop up an authentication dialog or ask the user to authenticate in some other way. Once the user has obtained the permission, the widget changes to this:
and the permission can be dropped again by clicking the button. If the user is not able to obtain the permission at all, the widget looks like this:
If the user has the permission and cannot drop it, the button is hidden.
The text (and tooltips) that are shown in the various cases can be adjusted with the
GtkLockButton:text-lock
,GtkLockButton:text-unlock
,GtkLockButton:tooltip-lock
,GtkLockButton:tooltip-unlock
andGtkLockButton:tooltip-not-authorized
properties.The
See moreLockButtonProtocol
protocol exposes the methods and properties of an underlyingGtkLockButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLockButton
. Alternatively, useLockButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LockButtonProtocol : ButtonProtocol
-
The
See moreLockButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkLockButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLockButtonAccessible
. Alternatively, useLockButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LockButtonAccessibleProtocol : ButtonAccessibleProtocol
-
A
GtkMenu
is aGtkMenuShell
that implements a drop down menu consisting of a list ofGtkMenuItem
objects which can be navigated and activated by the user to perform application functions.A
GtkMenu
is most commonly dropped down by activating aGtkMenuItem
in aGtkMenuBar
or popped up by activating aGtkMenuItem
in anotherGtkMenu
.A
GtkMenu
can also be popped up by activating aGtkComboBox
. Other composite widgets such as theGtkNotebook
can pop up aGtkMenu
as well.Applications can display a
GtkMenu
as a popup menu by calling thegtk_menu_popup()
function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.Connecting the popup signal handler.
(C Language Example):
// connect our handler which will popup the menu g_signal_connect_swapped (window, "button_press_event", G_CALLBACK (my_popup_handler), menu);
Signal handler which displays a popup menu.
(C Language Example):
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 == GDK_BUTTON_SECONDARY) { gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event_button->button, event_button->time); return TRUE; } } return FALSE; }
CSS nodes
(plain Language Example):
menu ├── arrow.top ├── <child> ┊ ├── <child> ╰── arrow.bottom
The main CSS node of GtkMenu has name menu, and there are two subnodes with name arrow, for scrolling menu arrows. These subnodes get the .top and .bottom style classes.
The
See moreMenuProtocol
protocol exposes the methods and properties of an underlyingGtkMenu
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenu
. Alternatively, useMenuRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuProtocol : MenuShellProtocol
-
The
See moreLabelClassProtocol
protocol exposes the methods and properties of an underlyingGtkLabelClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLabelClass
. Alternatively, useLabelClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LabelClassProtocol
-
The
See moreLabelSelectionInfoProtocol
protocol exposes the methods and properties of an underlyingGtkLabelSelectionInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLabelSelectionInfo
. Alternatively, useLabelSelectionInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LabelSelectionInfoProtocol
-
The
See moreLayoutClassProtocol
protocol exposes the methods and properties of an underlyingGtkLayoutClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLayoutClass
. Alternatively, useLayoutClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LayoutClassProtocol
-
The
See moreLevelBarAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkLevelBarAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLevelBarAccessibleClass
. Alternatively, useLevelBarAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LevelBarAccessibleClassProtocol
-
The
See moreLevelBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkLevelBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLevelBarClass
. Alternatively, useLevelBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LevelBarClassProtocol
-
The
See moreLinkButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkLinkButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLinkButtonAccessibleClass
. Alternatively, useLinkButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LinkButtonAccessibleClassProtocol
-
The
GtkLinkButtonClass
contains only private data.The
See moreLinkButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkLinkButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLinkButtonClass
. Alternatively, useLinkButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LinkButtonClassProtocol
-
The
See moreListBoxAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxAccessibleClass
. Alternatively, useListBoxAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxAccessibleClassProtocol
-
The
See moreListBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxClass
. Alternatively, useListBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxClassProtocol
-
The
See moreListBoxRowAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxRowAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxRowAccessibleClass
. Alternatively, useListBoxRowAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxRowAccessibleClassProtocol
-
The
See moreListBoxRowClassProtocol
protocol exposes the methods and properties of an underlyingGtkListBoxRowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListBoxRowClass
. Alternatively, useListBoxRowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListBoxRowClassProtocol
-
The
See moreListStoreClassProtocol
protocol exposes the methods and properties of an underlyingGtkListStoreClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeListStoreClass
. Alternatively, useListStoreClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ListStoreClassProtocol
-
The
See moreLockButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkLockButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLockButtonAccessibleClass
. Alternatively, useLockButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LockButtonAccessibleClassProtocol
-
The
See moreLockButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkLockButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeLockButtonClass
. Alternatively, useLockButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol LockButtonClassProtocol
-
The
See moreMenuAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuAccessibleClass
. Alternatively, useMenuAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuAccessibleClassProtocol
-
The
See moreMenuAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkMenuAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuAccessible
. Alternatively, useMenuAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuAccessibleProtocol : MenuShellAccessibleProtocol
-
The
GtkMenuBar
is a subclass ofGtkMenuShell
which contains one or moreGtkMenuItems
. The result is a standard menu bar which can hold many menu items.CSS nodes
GtkMenuBar has a single CSS node with name menubar.
The
See moreMenuBarProtocol
protocol exposes the methods and properties of an underlyingGtkMenuBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuBar
. Alternatively, useMenuBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuBarProtocol : MenuShellProtocol
-
The
GtkMenuButton
widget is used to display a popup when clicked on. This popup can be provided either as aGtkMenu
, aGtkPopover
or an abstractGMenuModel
.The
GtkMenuButton
widget can hold any valid child widget. That is, it can hold almost any other standardGtkWidget
. The most commonly used child isGtkImage
. If no widget is explicitely added to theGtkMenuButton
, aGtkImage
is automatically created, using an arrow image oriented according toGtkMenuButton:direction
or the generic “open-menu-symbolic” icon if the direction is not set.The positioning of the popup is determined by the
GtkMenuButton:direction
property of the menu button.For menus, the
GtkWidget:halign
andGtkWidget:valign
properties of the menu are also taken into account. For example, when the direction isGTK_ARROW_DOWN
and the horizontal alignment isGTK_ALIGN_START
, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”.Direction = Down
halign = start
halign = center
halign = end
Direction = Up
halign = start
halign = center
halign = end
Direction = Left
valign = start
valign = center
valign = end
Direction = Right
valign = start
valign = center
valign = end
CSS nodes
GtkMenuButton has a single CSS node with name button. To differentiate it from a plain
GtkButton
, it gets the .popup style class.The
See moreMenuButtonProtocol
protocol exposes the methods and properties of an underlyingGtkMenuButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuButton
. Alternatively, useMenuButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuButtonProtocol : ToggleButtonProtocol
-
The
See moreMenuButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkMenuButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuButtonAccessible
. Alternatively, useMenuButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuButtonAccessibleProtocol : ToggleButtonAccessibleProtocol
-
The
GtkMenuItem
widget and the derived widgets are the only valid children for menus. Their function is to correctly handle highlighting, alignment, events and submenus.As a GtkMenuItem derives from
GtkBin
it can hold any valid child widget, although only a few are really useful.By default, a GtkMenuItem sets a
GtkAccelLabel
as its child. GtkMenuItem has direct functions to set the label and its mnemonic. For more advanced label settings, you can fetch the child widget from the GtkBin.An example for setting markup and accelerator on a MenuItem: (C Language Example):
GtkWidget *menu_item = gtk_menu_item_new_with_label ("Example Menu Item"); GtkWidget *child = gtk_bin_get_child (GTK_BIN (menu_item)); gtk_label_set_markup (GTK_LABEL (child), "<i>new label</i> with <b>markup</b>"); gtk_accel_label_set_accel (GTK_ACCEL_LABEL (child), GDK_KEY_1, 0);
GtkMenuItem as GtkBuildable
The GtkMenuItem implementation of the
GtkBuildable
interface supports adding a submenu by specifying “submenu” as the “type” attribute of a <child> element.An example of UI definition fragment with submenus:
<object class="GtkMenuItem"> <child type="submenu"> <object class="GtkMenu"/> </child> </object>
CSS nodes
(plain Language Example):
menuitem ├── <child> ╰── [arrow.right]
GtkMenuItem has a single CSS node with name menuitem. If the menuitem has a submenu, it gets another CSS node with name arrow, which has the .left or .right style class.
The
See moreMenuItemProtocol
protocol exposes the methods and properties of an underlyingGtkMenuItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuItem
. Alternatively, useMenuItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuItemProtocol : ActionableProtocol, ActivatableProtocol, BinProtocol
-
The
See moreMenuItemAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkMenuItemAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuItemAccessible
. Alternatively, useMenuItemAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuItemAccessibleProtocol : ActionProtocol, SelectionProtocol, ContainerAccessibleProtocol
-
A
GtkMenuShell
is the abstract base class used to derive theGtkMenu
andGtkMenuBar
subclasses.A
GtkMenuShell
is a container ofGtkMenuItem
objects arranged in a list which can be navigated, selected, and activated by the user to perform application functions. AGtkMenuItem
can have a submenu associated with it, allowing for nested hierarchical menus.Terminology
A menu item can be “selected”, this means that it is displayed in the prelight state, and if it has a submenu, that submenu will be popped up.
A menu is “active” when it is visible onscreen and the user is selecting from it. A menubar is not active until the user clicks on one of its menuitems. When a menu is active, passing the mouse over a submenu will pop it up.
There is also is a concept of the current menu and a current menu item. The current menu item is the selected menu item that is furthest down in the hierarchy. (Every active menu shell does not necessarily contain a selected menu item, but if it does, then the parent menu shell must also contain a selected menu item.) The current menu is the menu that contains the current menu item. It will always have a GTK grab and receive all key presses.
The
See moreMenuShellProtocol
protocol exposes the methods and properties of an underlyingGtkMenuShell
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuShell
. Alternatively, useMenuShellRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuShellProtocol : ContainerProtocol
-
The
See moreMenuShellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkMenuShellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuShellAccessible
. Alternatively, useMenuShellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuShellAccessibleProtocol : SelectionProtocol, ContainerAccessibleProtocol
-
A
GtkMenuToolButton
is aGtkToolItem
that contains a button and a small additional button with an arrow. When clicked, the arrow button pops up a dropdown menu.Use
gtk_menu_tool_button_new()
to create a newGtkMenuToolButton
.GtkMenuToolButton as GtkBuildable
The GtkMenuToolButton implementation of the GtkBuildable interface supports adding a menu by specifying “menu” as the “type” attribute of a <child> element.
An example for a UI definition fragment with menus:
<object class="GtkMenuToolButton"> <child type="menu"> <object class="GtkMenu"/> </child> </object>
The
See moreMenuToolButtonProtocol
protocol exposes the methods and properties of an underlyingGtkMenuToolButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuToolButton
. Alternatively, useMenuToolButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuToolButtonProtocol : ToolButtonProtocol
-
GtkMessageDialog
presents a dialog with some message text. It’s simply a convenience widget; you could construct the equivalent ofGtkMessageDialog
fromGtkDialog
without too much effort, butGtkMessageDialog
saves typing.One difference from
GtkDialog
is thatGtkMessageDialog
sets theGtkWindow:skip-taskbar-hint
property totrue
, so that the dialog is hidden from the taskbar by default.The easiest way to do a modal message dialog is to use
gtk_dialog_run()
, though you can also pass in theGTK_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.An example for using a modal dialog: (C Language Example):
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog);
You might do a non-modal
GtkMessageDialog
as follows:An example for a non-modal dialog: (C Language Example):
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); // Destroy the dialog when the user responds to it // (e.g. clicks a button) g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
GtkMessageDialog as GtkBuildable
The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name “message_area”.
The
See moreMessageDialogProtocol
protocol exposes the methods and properties of an underlyingGtkMessageDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMessageDialog
. Alternatively, useMessageDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MessageDialogProtocol : DialogProtocol
-
The
GtkMisc
widget is an abstract widget which is not useful itself, but is used to derive subclasses which have alignment and padding attributes.The horizontal and vertical padding attributes allows extra space to be added around the widget.
The horizontal and vertical alignment attributes enable the widget to be positioned within its allocated area. Note that if the widget is added to a container in such a way that it expands automatically to fill its allocated area, the alignment settings will not alter the widget’s position.
Note that the desired effect can in most cases be achieved by using the
GtkWidget:halign
,GtkWidget:valign
andGtkWidget:margin
properties on the child widget, so GtkMisc should not be used in new code. To reflect this fact, allGtkMisc
API has been deprecated.The
See moreMiscProtocol
protocol exposes the methods and properties of an underlyingGtkMisc
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMisc
. Alternatively, useMiscRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MiscProtocol : WidgetProtocol
-
GtkModelButton is a button class that can use a
GAction
as its model. In contrast toGtkToggleButton
orGtkRadioButton
, which can also be backed by aGAction
via theGtkActionable:action-name
property, GtkModelButton will adapt its appearance according to the kind of action it is backed by, and appear either as a plain, check or radio button.Model buttons are used when popovers from a menu model with
gtk_popover_new_from_model()
; they can also be used manually in aGtkPopoverMenu
.When the action is specified via the
GtkActionable:action-name
andGtkActionable:action-target
properties, the role of the button (i.e. whether it is a plain, check or radio button) is determined by the type of the action and doesn’t have to be explicitly specified with theGtkModelButton:role
property.The content of the button is specified by the
GtkModelButton:text
andGtkModelButton:icon
properties.The appearance of model buttons can be influenced with the
GtkModelButton:centered
andGtkModelButton:iconic
properties.Model buttons have built-in support for submenus in
GtkPopoverMenu
. To make a GtkModelButton that opens a submenu when activated, set theGtkModelButton:menu-name
property. To make a button that goes back to the parent menu, you should set theGtkModelButton:inverted
property to place the submenu indicator at the opposite side.Example
<object class="GtkPopoverMenu"> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">view.cut</property> <property name="text" translatable="yes">Cut</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">view.copy</property> <property name="text" translatable="yes">Copy</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">view.paste</property> <property name="text" translatable="yes">Paste</property> </object> </child> </object> </child> </object>
CSS nodes
(plain Language Example):
modelbutton ├── <child> ╰── check
(plain Language Example):
modelbutton ├── <child> ╰── radio
(plain Language Example):
modelbutton ├── <child> ╰── arrow
GtkModelButton has a main CSS node with name modelbutton, and a subnode, which will have the name check, radio or arrow, depending on the role of the button and whether it has a menu name set.
The subnode is positioned before or after the content nodes and gets the .left or .right style class, depending on where it is located.
(plain Language Example):
button.model ├── <child> ╰── check
Iconic model buttons (see
GtkModelButton:iconic
) change the name of their main node to button and add a .model style class to it. The indicator subnode is invisible in this case.The
See moreModelButtonProtocol
protocol exposes the methods and properties of an underlyingGtkModelButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeModelButton
. Alternatively, useModelButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ModelButtonProtocol : ButtonProtocol
-
This should not be accessed directly. Use the accessor functions below.
The
See moreMountOperationProtocol
protocol exposes the methods and properties of an underlyingGtkMountOperation
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMountOperation
. Alternatively, useMountOperationRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MountOperationProtocol : MountOperationProtocol
-
Native dialogs are platform dialogs that don’t use
GtkDialog
orGtkWindow
. They are used in order to integrate better with a platform, by looking the same as other native applications and supporting platform specific features.The
GtkDialog
functions cannot be used on such objects, but we need a similar API in order to drive them. TheGtkNativeDialog
object is an API that allows you to do this. It allows you to set various common properties on the dialog, as well as show and hide it and get aGtkNativeDialog::response
signal when the user finished with the dialog.There is also a
gtk_native_dialog_run()
helper that makes it easy to run any native dialog in a modal way with a recursive mainloop, similar togtk_dialog_run()
.The
See moreNativeDialogProtocol
protocol exposes the methods and properties of an underlyingGtkNativeDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNativeDialog
. Alternatively, useNativeDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NativeDialogProtocol : ObjectProtocol
-
The
See moreMenuBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuBarClass
. Alternatively, useMenuBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuBarClassProtocol
-
The
See moreMenuButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuButtonAccessibleClass
. Alternatively, useMenuButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuButtonAccessibleClassProtocol
-
The
See moreMenuButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuButtonClass
. Alternatively, useMenuButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuButtonClassProtocol
-
The
See moreMenuClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuClass
. Alternatively, useMenuClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuClassProtocol
-
The
See moreMenuItemAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuItemAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuItemAccessibleClass
. Alternatively, useMenuItemAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuItemAccessibleClassProtocol
-
The
See moreMenuItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuItemClass
. Alternatively, useMenuItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuItemClassProtocol
-
The
See moreMenuShellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuShellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuShellAccessibleClass
. Alternatively, useMenuShellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuShellAccessibleClassProtocol
-
The
See moreMenuShellClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuShellClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuShellClass
. Alternatively, useMenuShellClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuShellClassProtocol
-
The
See moreMenuToolButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkMenuToolButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMenuToolButtonClass
. Alternatively, useMenuToolButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MenuToolButtonClassProtocol
-
The
See moreMessageDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkMessageDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMessageDialogClass
. Alternatively, useMessageDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MessageDialogClassProtocol
-
The
See moreMiscClassProtocol
protocol exposes the methods and properties of an underlyingGtkMiscClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMiscClass
. Alternatively, useMiscClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MiscClassProtocol
-
The
See moreMountOperationClassProtocol
protocol exposes the methods and properties of an underlyingGtkMountOperationClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeMountOperationClass
. Alternatively, useMountOperationClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol MountOperationClassProtocol
-
The
See moreNativeDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkNativeDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNativeDialogClass
. Alternatively, useNativeDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NativeDialogClassProtocol
-
The
GtkNotebook
widget is aGtkContainer
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 (seegtk_notebook_set_scrollable()
), and whether there will be a popup menu allowing the users to switch pages. (seegtk_notebook_popup_enable()
,gtk_notebook_popup_disable()
)GtkNotebook as GtkBuildable
The GtkNotebook implementation of the
GtkBuildable
interface supports placing children into tabs by specifying “tab” as the “type” attribute of a <child> 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 <child> type attribute.To add a child widget in the notebooks action area, specify “action-start” or “action-end” as the “type” attribute of the <child> element.
An example of a UI definition fragment with GtkNotebook:
<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>
CSS nodes
(plain Language Example):
notebook ├── header.top │ ├── [<action widget>] │ ├── tabs │ │ ├── [arrow] │ │ ├── tab │ │ │ ╰── <tab label> ┊ ┊ ┊ │ │ ├── tab[.reorderable-page] │ │ │ ╰── <tab label> │ │ ╰── [arrow] │ ╰── [<action widget>] │ ╰── stack ├── <child> ┊ ╰── <child>
GtkNotebook has a main CSS node with name notebook, a subnode with name header and below that a subnode with name tabs which contains one subnode per tab with name tab.
If action widgets are present, their CSS nodes are placed next to the tabs node. If the notebook is scrollable, CSS nodes with name arrow are placed as first and last child of the tabs node.
The main node gets the .frame style class when the notebook has a border (see
gtk_notebook_set_show_border()
).The header node gets one of the style class .top, .bottom, .left or .right, depending on where the tabs are placed. For reorderable pages, the tab node gets the .reorderable-page class.
A tab node gets the .dnd style class while it is moved with drag-and-drop.
The nodes are always arranged from left-to-right, regarldess of text direction.
The
See moreNotebookProtocol
protocol exposes the methods and properties of an underlyingGtkNotebook
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNotebook
. Alternatively, useNotebookRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NotebookProtocol : ContainerProtocol
-
The
See moreNotebookAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkNotebookAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNotebookAccessible
. Alternatively, useNotebookAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NotebookAccessibleProtocol : SelectionProtocol, ContainerAccessibleProtocol
-
The
See moreNotebookPageAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkNotebookPageAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNotebookPageAccessible
. Alternatively, useNotebookPageAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NotebookPageAccessibleProtocol : ComponentProtocol, ObjectProtocol
-
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
; seegtk_numerable_icon_set_style_context()
.Typical numerable icons:
The
See moreNumerableIconProtocol
protocol exposes the methods and properties of an underlyingGtkNumerableIcon
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNumerableIcon
. Alternatively, useNumerableIconRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NumerableIconProtocol : EmblemedIconProtocol
-
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
orGdkPixbuf
.GtkOffscreenWindow derives from
GtkWindow
only as an implementation detail. Applications should not use any API specific toGtkWindow
to operate on this object. It should be treated as aGtkBin
that has no parent widget.When contained offscreen widgets are redrawn, GtkOffscreenWindow will emit a
GtkWidget::damage-event
signal.The
See moreOffscreenWindowProtocol
protocol exposes the methods and properties of an underlyingGtkOffscreenWindow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeOffscreenWindow
. Alternatively, useOffscreenWindowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol OffscreenWindowProtocol : WindowProtocol
-
The
See moreNotebookAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkNotebookAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNotebookAccessibleClass
. Alternatively, useNotebookAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NotebookAccessibleClassProtocol
-
The
See moreNotebookClassProtocol
protocol exposes the methods and properties of an underlyingGtkNotebookClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNotebookClass
. Alternatively, useNotebookClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NotebookClassProtocol
-
The
See moreNotebookPageAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkNotebookPageAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNotebookPageAccessibleClass
. Alternatively, useNotebookPageAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NotebookPageAccessibleClassProtocol
-
The
See moreNumerableIconClassProtocol
protocol exposes the methods and properties of an underlyingGtkNumerableIconClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeNumerableIconClass
. Alternatively, useNumerableIconClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol NumerableIconClassProtocol
-
The
See moreOffscreenWindowClassProtocol
protocol exposes the methods and properties of an underlyingGtkOffscreenWindowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeOffscreenWindowClass
. Alternatively, useOffscreenWindowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol OffscreenWindowClassProtocol
-
The
See moreOrientableIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkOrientableIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeOrientableIface
. Alternatively, useOrientableIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol OrientableIfaceProtocol
-
The
See moreOverlayClassProtocol
protocol exposes the methods and properties of an underlyingGtkOverlayClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeOverlayClass
. Alternatively, useOverlayClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol OverlayClassProtocol
-
Struct defining a pad action entry.
The
See morePadActionEntryProtocol
protocol exposes the methods and properties of an underlyingGtkPadActionEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePadActionEntry
. Alternatively, usePadActionEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PadActionEntryProtocol
-
GtkOverlay is a container which contains a single main child, on top of which it can place “overlay” widgets. The position of each overlay widget is determined by its
GtkWidget:halign
andGtkWidget:valign
properties. E.g. a widget with both alignments set toGTK_ALIGN_START
will be placed at the top left corner of the GtkOverlay container, whereas an overlay with halign set toGTK_ALIGN_CENTER
and valign set toGTK_ALIGN_END
will be placed a the bottom edge of the GtkOverlay, horizontally centered. The position can be adjusted by setting the margin properties of the child to non-zero values.More complicated placement of overlays is possible by connecting to the
GtkOverlay::get-child-position
signal.An overlay’s minimum and natural sizes are those of its main child. The sizes of overlay children are not considered when measuring these preferred sizes.
GtkOverlay as GtkBuildable
The GtkOverlay implementation of the GtkBuildable interface supports placing a child as an overlay by specifying “overlay” as the “type” attribute of a
<child>
element.CSS nodes
GtkOverlay has a single CSS node with the name “overlay”. Overlay children whose alignments cause them to be positioned at an edge get the style classes “.left”, “.right”, “.top”, and/or “.bottom” according to their position.
The
See moreOverlayProtocol
protocol exposes the methods and properties of an underlyingGtkOverlay
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeOverlay
. Alternatively, useOverlayRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol OverlayProtocol : BinProtocol
-
GtkPadController
is an event controller for the pads found in drawing tablets (The collection of buttons and tactile sensors often found around the stylus-sensitive area).These buttons and sensors have no implicit meaning, and by default they perform no action, this event controller is provided to map those to
GAction
objects, thus letting the application give those a more semantic meaning.Buttons and sensors are not constrained to triggering a single action, some
GDK_SOURCE_TABLET_PAD
devices feature multiple “modes”, all these input elements have one current mode, which may determine the final action being triggered. Pad devices often divide buttons and sensors into groups, all elements in a group share the same current mode, but different groups may have different modes. Seegdk_device_pad_get_n_groups()
andgdk_device_pad_get_group_n_modes()
.Each of the actions that a given button/strip/ring performs for a given mode is defined by
GtkPadActionEntry
, it contains an action name that will be looked up in the givenGActionGroup
and activated whenever the specified input element and mode are triggered.A simple example of
GtkPadController
usage, assigning button 1 in all modes and pad devices to an “invert-selection” action:GtkPadActionEntry *pad_actions[] = { { GTK_PAD_ACTION_BUTTON, 1, -1, "Invert selection", "pad-actions.invert-selection" }, … }; … action_group = g_simple_action_group_new (); action = g_simple_action_new ("pad-actions.invert-selection", NULL); g_signal_connect (action, "activate", on_invert_selection_activated, NULL); g_action_map_add_action (G_ACTION_MAP (action_group), action); … pad_controller = gtk_pad_controller_new (window, action_group, NULL);
The actions belonging to rings/strips will be activated with a parameter of type
G_VARIANT_TYPE_DOUBLE
bearing the value of the given axis, it is required that those are made stateful and accepting thisGVariantType
.The
See morePadControllerProtocol
protocol exposes the methods and properties of an underlyingGtkPadController
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePadController
. Alternatively, usePadControllerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PadControllerProtocol : EventControllerProtocol
-
The
See morePadControllerClassProtocol
protocol exposes the methods and properties of an underlyingGtkPadControllerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePadControllerClass
. Alternatively, usePadControllerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PadControllerClassProtocol
-
See also
gtk_print_settings_set_page_ranges()
.The
See morePageRangeProtocol
protocol exposes the methods and properties of an underlyingGtkPageRange
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePageRange
. Alternatively, usePageRangeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PageRangeProtocol
-
The
See morePanedAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkPanedAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePanedAccessibleClass
. Alternatively, usePanedAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PanedAccessibleClassProtocol
-
The
See morePanedClassProtocol
protocol exposes the methods and properties of an underlyingGtkPanedClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePanedClass
. Alternatively, usePanedClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PanedClassProtocol
-
GtkPaperSize handles paper sizes. It uses the standard called PWG 5101.1-2002 PWG: Standard for Media Standardized Names to name the paper sizes (and to get the data for the page sizes). In addition to standard paper sizes, GtkPaperSize allows to construct custom paper sizes with arbitrary dimensions.
The
GtkPaperSize
object stores not only the dimensions (width and height) of a paper size and its name, it also provides default print margins.Printing support has been added in GTK+ 2.10.
The
See morePaperSizeProtocol
protocol exposes the methods and properties of an underlyingGtkPaperSize
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePaperSize
. Alternatively, usePaperSizeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PaperSizeProtocol
-
The
See morePlacesSidebarClassProtocol
protocol exposes the methods and properties of an underlyingGtkPlacesSidebarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePlacesSidebarClass
. Alternatively, usePlacesSidebarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PlacesSidebarClassProtocol
-
The
See morePlugAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkPlugAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePlugAccessibleClass
. Alternatively, usePlugAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PlugAccessibleClassProtocol
-
The
See morePopoverAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkPopoverAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePopoverAccessibleClass
. Alternatively, usePopoverAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PopoverAccessibleClassProtocol
-
The
See morePopoverClassProtocol
protocol exposes the methods and properties of an underlyingGtkPopoverClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePopoverClass
. Alternatively, usePopoverClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PopoverClassProtocol
-
The
See morePopoverMenuClassProtocol
protocol exposes the methods and properties of an underlyingGtkPopoverMenuClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePopoverMenuClass
. Alternatively, usePopoverMenuClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PopoverMenuClassProtocol
-
The
See morePrintOperationClassProtocol
protocol exposes the methods and properties of an underlyingGtkPrintOperationClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePrintOperationClass
. Alternatively, usePrintOperationClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PrintOperationClassProtocol
-
The
See morePrintOperationPreviewIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkPrintOperationPreviewIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePrintOperationPreviewIface
. Alternatively, usePrintOperationPreviewIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PrintOperationPreviewIfaceProtocol
-
The
See moreProgressBarAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkProgressBarAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeProgressBarAccessibleClass
. Alternatively, useProgressBarAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ProgressBarAccessibleClassProtocol
-
The
See moreProgressBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkProgressBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeProgressBarClass
. Alternatively, useProgressBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ProgressBarClassProtocol
-
The
See moreRadioActionClassProtocol
protocol exposes the methods and properties of an underlyingGtkRadioActionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioActionClass
. Alternatively, useRadioActionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioActionClassProtocol
-
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 theGtkPrintSettings
is that these affect the actual layout of the page, and thus need to be set long before user prints.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 minimal size for the layout margins.
To obtain a
GtkPageSetup
usegtk_page_setup_new()
to get the defaults, or usegtk_print_run_page_setup_dialog()
to show the page setup dialog and receive the resulting page setup.A page setup dialog
(C Language Example):
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; }
Printing support was added in GTK+ 2.10.
The
See morePageSetupProtocol
protocol exposes the methods and properties of an underlyingGtkPageSetup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePageSetup
. Alternatively, usePageSetupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PageSetupProtocol : ObjectProtocol
-
GtkPaned
has two panes, arranged either horizontally or vertically. The division between the two panes is adjustable by the user by dragging a handle.Child widgets are added to the panes of the widget with
gtk_paned_pack1()
andgtk_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 toGTK_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
andshrink
. Ifresize
is true, then when theGtkPaned
is resized, that child will expand or shrink along with the paned widget. Ifshrink
is true, then that child can be made smaller than its requisition by the user. Settingshrink
tofalse
allows the application to set a minimum size. Ifresize
is false for both children, then this is treated as ifresize
is true for both children.The application can set the position of the slider as if it were set by the user, by calling
gtk_paned_set_position()
.CSS nodes
(plain Language Example):
paned ├── <child> ├── separator[.wide] ╰── <child>
GtkPaned has a main CSS node with name paned, and a subnode for the separator with name separator. The subnode gets a .wide style class when the paned is supposed to be wide.
In horizontal orientation, the nodes of the children are always arranged from left to right. So :first-child will always select the leftmost child, regardless of text direction.
Creating a paned widget with minimum sizes.
(C Language Example):
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);
The
See morePanedProtocol
protocol exposes the methods and properties of an underlyingGtkPaned
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePaned
. Alternatively, usePanedRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PanedProtocol : ContainerProtocol, OrientableProtocol
-
The
See morePanedAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkPanedAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePanedAccessible
. Alternatively, usePanedAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PanedAccessibleProtocol : ValueProtocol, ContainerAccessibleProtocol
-
GtkPlacesSidebar
is a widget that displays a list of frequently-used places in the file system: the user’s home directory, the user’s bookmarks, and volumes and drives. This widget is used as a sidebar inGtkFileChooser
and may be used by file managers and similar programs.The places sidebar displays drives and volumes, and will automatically mount or unmount them when the user selects them.
Applications can hook to various signals in the places sidebar to customize its behavior. For example, they can add extra commands to the context menu of the sidebar.
While bookmarks are completely in control of the user, the places sidebar also allows individual applications to provide extra shortcut folders that are unique to each application. For example, a Paint program may want to add a shortcut for a Clipart folder. You can do this with
gtk_places_sidebar_add_shortcut()
.To make use of the places sidebar, an application at least needs to connect to the
GtkPlacesSidebar::open-location
signal. This is emitted when the user selects in the sidebar a location to open. The application should also callgtk_places_sidebar_set_location()
when it changes the currently-viewed location.CSS nodes
GtkPlacesSidebar uses a single CSS node with name placessidebar and style class .sidebar.
Among the children of the places sidebar, the following style classes can be used:
- .sidebar-new-bookmark-row for the ‘Add new bookmark’ row
- .sidebar-placeholder-row for a row that is a placeholder
- .has-open-popup when a popup is open for a row
The
See morePlacesSidebarProtocol
protocol exposes the methods and properties of an underlyingGtkPlacesSidebar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePlacesSidebar
. Alternatively, usePlacesSidebarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PlacesSidebarProtocol : ScrolledWindowProtocol
-
The
See morePlugAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkPlugAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePlugAccessible
. Alternatively, usePlugAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PlugAccessibleProtocol : WindowAccessibleProtocol
-
GtkPopover is a bubble-like context window, primarily meant to provide context-dependent information or options. Popovers are attached to a widget, passed at construction time on
gtk_popover_new()
, or updated afterwards throughgtk_popover_set_relative_to()
, by default they will point to the whole widget area, although this behavior can be changed throughgtk_popover_set_pointing_to()
.The position of a popover relative to the widget it is attached to can also be changed through
gtk_popover_set_position()
.By default,
GtkPopover
performs a GTK+ grab, in order to ensure input events get redirected to it while it is shown, and also so the popover is dismissed in the expected situations (clicks outside the popover, or the Esc key being pressed). If no such modal behavior is desired on a popover,gtk_popover_set_modal()
may be called on it to tweak its behavior.GtkPopover as menu replacement
GtkPopover is often used to replace menus. To facilitate this, it supports being populated from a
GMenuModel
, usinggtk_popover_new_from_model()
. In addition to all the regular menu model features, this function supports rendering sections in the model in a more compact form, as a row of icon buttons instead of menu items.To use this rendering, set the ”display-hint” attribute of the section to ”horizontal-buttons” and set the icons of your items with the ”verb-icon” attribute.
<section> <attribute name="display-hint">horizontal-buttons</attribute> <item> <attribute name="label">Cut</attribute> <attribute name="action">app.cut</attribute> <attribute name="verb-icon">edit-cut-symbolic</attribute> </item> <item> <attribute name="label">Copy</attribute> <attribute name="action">app.copy</attribute> <attribute name="verb-icon">edit-copy-symbolic</attribute> </item> <item> <attribute name="label">Paste</attribute> <attribute name="action">app.paste</attribute> <attribute name="verb-icon">edit-paste-symbolic</attribute> </item> </section>
CSS nodes
GtkPopover has a single css node called popover. It always gets the .background style class and it gets the .menu style class if it is menu-like (e.g.
GtkPopoverMenu
or created usinggtk_popover_new_from_model()
.Particular uses of GtkPopover, such as touch selection popups or magnifiers in
GtkEntry
orGtkTextView
get style classes like .touch-selection or .magnifier to differentiate from plain popovers.The
See morePopoverProtocol
protocol exposes the methods and properties of an underlyingGtkPopover
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePopover
. Alternatively, usePopoverRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PopoverProtocol : BinProtocol
-
The
See morePopoverAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkPopoverAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePopoverAccessible
. Alternatively, usePopoverAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PopoverAccessibleProtocol : ContainerAccessibleProtocol
-
GtkPopoverMenu is a subclass of
GtkPopover
that treats its children like menus and allows switching between them. It is meant to be used primarily together withGtkModelButton
, but any widget can be used, such asGtkSpinButton
orGtkScale
. In this respect, GtkPopoverMenu is more flexible than popovers that are created from aGMenuModel
withgtk_popover_new_from_model()
.To add a child as a submenu, set the
GtkPopoverMenu:submenu
child property to the name of the submenu. To let the user open this submenu, add aGtkModelButton
whoseGtkModelButton:menu-name
property is set to the name you’ve given to the submenu.By convention, the first child of a submenu should be a
GtkModelButton
to switch back to the parent menu. Such a button should use theGtkModelButton:inverted
andGtkModelButton:centered
properties to achieve a title-like appearance and place the submenu indicator at the opposite side. To switch back to the main menu, use “main” as the menu name.Example
<object class="GtkPopoverMenu"> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.frob</property> <property name="text" translatable="yes">Frob</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="menu-name">more</property> <property name="text" translatable="yes">More</property> </object> </child> </object> </child> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.foo</property> <property name="text" translatable="yes">Foo</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.bar</property> <property name="text" translatable="yes">Bar</property> </object> </child> </object> <packing> <property name="submenu">more</property> </packing> </child> </object>
Just like normal popovers created using gtk_popover_new_from_model,
GtkPopoverMenu
instances have a single css node called “popover” and get the .menu style class.The
See morePopoverMenuProtocol
protocol exposes the methods and properties of an underlyingGtkPopoverMenu
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePopoverMenu
. Alternatively, usePopoverMenuRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PopoverMenuProtocol : PopoverProtocol
-
A GtkPrintContext encapsulates context information that is required when drawing pages for printing, such as the cairo context and important parameters like page size and resolution. It also lets you easily create
PangoLayout
andPangoContext
objects that match the font metrics of the cairo surface.GtkPrintContext objects gets passed to the
GtkPrintOperation::begin-print
,GtkPrintOperation::end-print
,GtkPrintOperation::request-page-setup
andGtkPrintOperation::draw-page
signals on theGtkPrintOperation
.Using GtkPrintContext in a
GtkPrintOperation::draw-page
callback(C Language Example):
static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, int page_nr) { cairo_t *cr; PangoLayout *layout; PangoFontDescription *desc; cr = gtk_print_context_get_cairo_context (context); // Draw a red rectangle, as wide as the paper (inside the margins) cairo_set_source_rgb (cr, 1.0, 0, 0); cairo_rectangle (cr, 0, 0, gtk_print_context_get_width (context), 50); cairo_fill (cr); // Draw some lines cairo_move_to (cr, 20, 10); cairo_line_to (cr, 40, 20); cairo_arc (cr, 60, 60, 20, 0, M_PI); cairo_line_to (cr, 80, 20); cairo_set_source_rgb (cr, 0, 0, 0); cairo_set_line_width (cr, 5); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND); cairo_stroke (cr); // Draw some text layout = gtk_print_context_create_pango_layout (context); pango_layout_set_text (layout, "Hello World! Printing is easy", -1); desc = pango_font_description_from_string ("sans 28"); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); cairo_move_to (cr, 30, 20); pango_cairo_layout_path (cr, layout); // Font Outline cairo_set_source_rgb (cr, 0.93, 1.0, 0.47); cairo_set_line_width (cr, 0.5); cairo_stroke_preserve (cr); // Font Fill cairo_set_source_rgb (cr, 0, 0.0, 1.0); cairo_fill (cr); g_object_unref (layout); }
Printing support was added in GTK+ 2.10.
The
See morePrintContextProtocol
protocol exposes the methods and properties of an underlyingGtkPrintContext
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePrintContext
. Alternatively, usePrintContextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PrintContextProtocol : ObjectProtocol
-
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, seeGtkPrintUnixDialog
.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, anyGtkPrintSettings
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 theGtkPrintOperation
, the main one beingGtkPrintOperation::draw-page
, which you are supposed to catch and render the page on the providedGtkPrintContext
using Cairo.The high-level printing API
(C Language Example):
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); }
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_preview_render_page()
,gtk_print_operation_preview_end_preview()
andgtk_print_operation_preview_is_selected()
are useful when implementing a print preview.The
See morePrintOperationProtocol
protocol exposes the methods and properties of an underlyingGtkPrintOperation
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePrintOperation
. Alternatively, usePrintOperationRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PrintOperationProtocol : ObjectProtocol, PrintOperationPreviewProtocol
-
A GtkPrintSettings object represents the settings of a print dialog in a system-independent way. The main use for this object is that once you’ve printed you can get a settings object that represents the settings the user chose, and the next time you print you can pass that object in so that the user doesn’t have to re-set all his settings.
Its also possible to enumerate the settings so that you can easily save the settings for the next time your app runs, or even store them in a document. The predefined keys try to use shared values as much as possible so that moving such a document between systems still works.
Printing support was added in GTK+ 2.10.
The
See morePrintSettingsProtocol
protocol exposes the methods and properties of an underlyingGtkPrintSettings
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePrintSettings
. Alternatively, usePrintSettingsRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PrintSettingsProtocol : ObjectProtocol
-
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 modes: percentage mode and activity mode.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 callgtk_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.CSS nodes
(plain Language Example):
progressbar[.osd] ├── [text] ╰── trough[.empty][.full] ╰── progress[.pulse]
GtkProgressBar has a main CSS node with name progressbar and subnodes with names text and trough, of which the latter has a subnode named progress. The text subnode is only present if text is shown. The progress subnode has the style class .pulse when in activity mode. It gets the style classes .left, .right, .top or .bottom added when the progress ‘touches’ the corresponding end of the GtkProgressBar. The .osd class on the progressbar node is for use in overlays like the one Epiphany has for page loading progress.
The
See moreProgressBarProtocol
protocol exposes the methods and properties of an underlyingGtkProgressBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeProgressBar
. Alternatively, useProgressBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ProgressBarProtocol : OrientableProtocol, WidgetProtocol
-
The
See moreProgressBarAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkProgressBarAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeProgressBarAccessible
. Alternatively, useProgressBarAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ProgressBarAccessibleProtocol : ValueProtocol, WidgetAccessibleProtocol
-
A
GtkRadioAction
is similar toGtkRadioMenuItem
. A number of radio actions can be linked together so that only one may be active at any one time.The
See moreRadioActionProtocol
protocol exposes the methods and properties of an underlyingGtkRadioAction
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioAction
. Alternatively, useRadioActionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioActionProtocol : ToggleActionProtocol
-
The
See morePrintOperationPreviewProtocol
protocol exposes the methods and properties of an underlyingGtkPrintOperationPreview
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seePrintOperationPreview
. Alternatively, usePrintOperationPreviewRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol PrintOperationPreviewProtocol
-
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 areGtkRecentChooserWidget
,GtkRecentChooserDialog
andGtkRecentChooserMenu
.Recently used files are supported since GTK+ 2.10.
The
See moreRecentChooserProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooser
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooser
. Alternatively, useRecentChooserRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserProtocol
-
GtkRadioActionEntry
structs are used withgtk_action_group_add_radio_actions()
to construct groups of radio actions.The
See moreRadioActionEntryProtocol
protocol exposes the methods and properties of an underlyingGtkRadioActionEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioActionEntry
. Alternatively, useRadioActionEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioActionEntryProtocol
-
The
See moreRadioButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkRadioButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioButtonAccessibleClass
. Alternatively, useRadioButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioButtonAccessibleClassProtocol
-
The
See moreRadioButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkRadioButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioButtonClass
. Alternatively, useRadioButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioButtonClassProtocol
-
The
See moreRadioMenuItemAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkRadioMenuItemAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioMenuItemAccessibleClass
. Alternatively, useRadioMenuItemAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioMenuItemAccessibleClassProtocol
-
The
See moreRadioMenuItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkRadioMenuItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioMenuItemClass
. Alternatively, useRadioMenuItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioMenuItemClassProtocol
-
The
See moreRadioToolButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkRadioToolButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioToolButtonClass
. Alternatively, useRadioToolButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioToolButtonClassProtocol
-
The
See moreRangeAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkRangeAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRangeAccessibleClass
. Alternatively, useRangeAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RangeAccessibleClassProtocol
-
The
See moreRangeClassProtocol
protocol exposes the methods and properties of an underlyingGtkRangeClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRangeClass
. Alternatively, useRangeClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RangeClassProtocol
-
The
See moreRcContextProtocol
protocol exposes the methods and properties of an underlyingGtkRcContext
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRcContext
. Alternatively, useRcContextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RcContextProtocol
-
Deprecated
The
See moreRcPropertyProtocol
protocol exposes the methods and properties of an underlyingGtkRcProperty
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRcProperty
. Alternatively, useRcPropertyRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RcPropertyProtocol
-
The
See moreRcStyleClassProtocol
protocol exposes the methods and properties of an underlyingGtkRcStyleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRcStyleClass
. Alternatively, useRcStyleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RcStyleClassProtocol
-
The
See moreRecentActionClassProtocol
protocol exposes the methods and properties of an underlyingGtkRecentActionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentActionClass
. Alternatively, useRecentActionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentActionClassProtocol
-
The
See moreRecentChooserDialogClassProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserDialogClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserDialogClass
. Alternatively, useRecentChooserDialogClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserDialogClassProtocol
-
The
See moreRecentChooserIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserIface
. Alternatively, useRecentChooserIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserIfaceProtocol
-
The
See moreRecentChooserMenuClassProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserMenuClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserMenuClass
. Alternatively, useRecentChooserMenuClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserMenuClassProtocol
-
The
See moreRecentChooserWidgetClassProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserWidgetClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserWidgetClass
. Alternatively, useRecentChooserWidgetClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserWidgetClassProtocol
-
Meta-data to be passed to
gtk_recent_manager_add_full()
when registering a recently used resource.The
See moreRecentDataProtocol
protocol exposes the methods and properties of an underlyingGtkRecentData
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentData
. Alternatively, useRecentDataRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentDataProtocol
-
A GtkRecentFilterInfo struct is used to pass information about the tested file to
gtk_recent_filter_filter()
.The
See moreRecentFilterInfoProtocol
protocol exposes the methods and properties of an underlyingGtkRecentFilterInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentFilterInfo
. Alternatively, useRecentFilterInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentFilterInfoProtocol
-
GtkRecentInfo-struct
contains private data only, and should be accessed using the provided API.GtkRecentInfo
constains all the meta-data associated with an entry in the recently used files list.The
See moreRecentInfoProtocol
protocol exposes the methods and properties of an underlyingGtkRecentInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentInfo
. Alternatively, useRecentInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentInfoProtocol
-
GtkRecentManagerClass
contains only private data.The
See moreRecentManagerClassProtocol
protocol exposes the methods and properties of an underlyingGtkRecentManagerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentManagerClass
. Alternatively, useRecentManagerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentManagerClassProtocol
-
The
See moreRendererCellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkRendererCellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRendererCellAccessibleClass
. Alternatively, useRendererCellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RendererCellAccessibleClassProtocol
-
Represents a request of a screen object in a given orientation. These are primarily used in container implementations when allocating a natural size for children calling. See
gtk_distribute_natural_allocation()
.The
See moreRequestedSizeProtocol
protocol exposes the methods and properties of an underlyingGtkRequestedSize
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRequestedSize
. Alternatively, useRequestedSizeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RequestedSizeProtocol
-
A
GtkRequisition-struct
represents the desired size of a widget. See GtkWidget’s geometry management section for more information.The
See moreRequisitionProtocol
protocol exposes the methods and properties of an underlyingGtkRequisition
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRequisition
. Alternatively, useRequisitionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RequisitionProtocol
-
The
See moreRevealerClassProtocol
protocol exposes the methods and properties of an underlyingGtkRevealerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRevealerClass
. Alternatively, useRevealerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RevealerClassProtocol
-
The
See moreScaleAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkScaleAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleAccessibleClass
. Alternatively, useScaleAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleAccessibleClassProtocol
-
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()
, passingnil
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 aGtkRadioButton
that already has a group assigned to it. The convenience functiongtk_radio_button_new_with_label_from_widget()
is also provided.To retrieve the group a
GtkRadioButton
is assigned to, usegtk_radio_button_get_group()
.To remove a
GtkRadioButton
from one group and make it part of a new one, usegtk_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.CSS nodes
(plain Language Example):
radiobutton ├── radio ╰── <child>
A GtkRadioButton with indicator (see
gtk_toggle_button_set_mode()
) has a main CSS node with name radiobutton and a subnode with name radio.(plain Language Example):
button.radio ├── radio ╰── <child>
A GtkRadioButton without indicator changes the name of its main node to button and adds a .radio style class to it. The subnode is invisible in this case.
How to create a group of two radio buttons.
(C Language Example):
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, 2); gtk_box_set_homogeneous (GTK_BOX (box), TRUE); // Create a radio button with a GtkEntry widget radio1 = gtk_radio_button_new (NULL); entry = gtk_entry_new (); gtk_container_add (GTK_CONTAINER (radio1), entry); // Create a radio button with a label radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1), "I’m the second radio button."); // Pack them into a box, then show all the widgets gtk_box_pack_start (GTK_BOX (box), radio1); gtk_box_pack_start (GTK_BOX (box), radio2); gtk_container_add (GTK_CONTAINER (window), box); gtk_widget_show_all (window); return; }
When an unselected button in the group is clicked the clicked button receives the
GtkToggleButton::toggled
signal, as does the previously selected button. Inside theGtkToggleButton::toggled
handler,gtk_toggle_button_get_active()
can be used to determine if the button has been selected or deselected.The
See moreRadioButtonProtocol
protocol exposes the methods and properties of an underlyingGtkRadioButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioButton
. Alternatively, useRadioButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioButtonProtocol : CheckButtonProtocol
-
The
See moreRadioButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkRadioButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioButtonAccessible
. Alternatively, useRadioButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioButtonAccessibleProtocol : ToggleButtonAccessibleProtocol
-
A radio menu item is a check menu item that belongs to a group. At each instant exactly one of the radio menu items from a group is selected.
The group list does not need to be freed, as each
GtkRadioMenuItem
will remove itself and its list item when it is destroyed.The correct way to create a group of radio menu items is approximatively this:
How to create a group of radio menu items.
(C Language Example):
GSList *group = NULL; GtkWidget *item; gint i; for (i = 0; i < 5; i++) { item = gtk_radio_menu_item_new_with_label (group, "This is an example"); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); if (i == 1) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); }
CSS nodes
(plain Language Example):
menuitem ├── radio.left ╰── <child>
GtkRadioMenuItem has a main CSS node with name menuitem, and a subnode with name radio, which gets the .left or .right style class.
The
See moreRadioMenuItemProtocol
protocol exposes the methods and properties of an underlyingGtkRadioMenuItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioMenuItem
. Alternatively, useRadioMenuItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioMenuItemProtocol : CheckMenuItemProtocol
-
The
See moreRadioMenuItemAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkRadioMenuItemAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioMenuItemAccessible
. Alternatively, useRadioMenuItemAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioMenuItemAccessibleProtocol : CheckMenuItemAccessibleProtocol
-
A
GtkRadioToolButton
is aGtkToolItem
that contains a radio button, that is, a button that is part of a group of toggle buttons where only one button can be active at a time.Use
gtk_radio_tool_button_new()
to create a new GtkRadioToolButton. Usegtk_radio_tool_button_new_from_widget()
to create a new GtkRadioToolButton that is part of the same group as an existing GtkRadioToolButton.CSS nodes
GtkRadioToolButton has a single CSS node with name toolbutton.
The
See moreRadioToolButtonProtocol
protocol exposes the methods and properties of an underlyingGtkRadioToolButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRadioToolButton
. Alternatively, useRadioToolButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RadioToolButtonProtocol : ToggleToolButtonProtocol
-
GtkRange
is the common base class for widgets which visualize an adjustment, e.gGtkScale
orGtkScrollbar
.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. Seegtk_range_set_fill_level()
.The
See moreRangeProtocol
protocol exposes the methods and properties of an underlyingGtkRange
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRange
. Alternatively, useRangeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RangeProtocol : OrientableProtocol, WidgetProtocol
-
The
See moreRangeAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkRangeAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRangeAccessible
. Alternatively, useRangeAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RangeAccessibleProtocol : ValueProtocol, WidgetAccessibleProtocol
-
The
GtkRcStyle-struct
is used to represent a set of information about the appearance of a widget. This can later be composited together with otherGtkRcStyle-struct
<!– –>s to form aGtkStyle
.The
See moreRcStyleProtocol
protocol exposes the methods and properties of an underlyingGtkRcStyle
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRcStyle
. Alternatively, useRcStyleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RcStyleProtocol : ObjectProtocol
-
A
GtkRecentAction
represents a list of recently used files, which can be shown by widgets such asGtkRecentChooserDialog
orGtkRecentChooserMenu
.To construct a submenu showing recently used files, use a
GtkRecentAction
as the action for a <menuitem>. To construct a menu toolbutton showing the recently used files in the popup menu, use aGtkRecentAction
as the action for a <toolitem> element.The
See moreRecentActionProtocol
protocol exposes the methods and properties of an underlyingGtkRecentAction
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentAction
. Alternatively, useRecentActionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentActionProtocol : ActionProtocol, RecentChooserProtocol
-
GtkRecentChooserDialog
is a dialog box suitable for displaying the recently used documents. This widgets works by putting aGtkRecentChooserWidget
inside aGtkDialog
. It exposes theGtkRecentChooserIface
interface, so you can use all theGtkRecentChooser
functions on the recent chooser dialog as well as those forGtkDialog
.Note that
GtkRecentChooserDialog
does not have any methods of its own. Instead, you should use the functions that work on aGtkRecentChooser
.Typical usage ##
In the simplest of cases, you can use the following code to use a
GtkRecentChooserDialog
to select a recently used file:(C Language Example):
GtkWidget *dialog; gint res; dialog = gtk_recent_chooser_dialog_new ("Recent Documents", parent_window, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Open"), GTK_RESPONSE_ACCEPT, NULL); res = gtk_dialog_run (GTK_DIALOG (dialog)); if (res == GTK_RESPONSE_ACCEPT) { GtkRecentInfo *info; GtkRecentChooser *chooser = GTK_RECENT_CHOOSER (dialog); info = gtk_recent_chooser_get_current_item (chooser); open_file (gtk_recent_info_get_uri (info)); gtk_recent_info_unref (info); } gtk_widget_destroy (dialog);
Recently used files are supported since GTK+ 2.10.
The
See moreRecentChooserDialogProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserDialog
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserDialog
. Alternatively, useRecentChooserDialogRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserDialogProtocol : DialogProtocol, RecentChooserProtocol
-
GtkRecentChooserMenu
is a widget suitable for displaying recently used files inside a menu. It can be used to set a sub-menu of aGtkMenuItem
usinggtk_menu_item_set_submenu()
, or as the menu of aGtkMenuToolButton
.Note that
GtkRecentChooserMenu
does not have any methods of its own. Instead, you should use the functions that work on aGtkRecentChooser
.Note also that
GtkRecentChooserMenu
does not support multiple filters, as it has no way to let the user choose between them as theGtkRecentChooserWidget
andGtkRecentChooserDialog
widgets do. Thus usinggtk_recent_chooser_add_filter()
on aGtkRecentChooserMenu
widget will yield the same effects as usinggtk_recent_chooser_set_filter()
, replacing any currently set filter with the supplied filter;gtk_recent_chooser_remove_filter()
will remove any currently setGtkRecentFilter
object and will unset the current filter;gtk_recent_chooser_list_filters()
will return a list containing a singleGtkRecentFilter
object.Recently used files are supported since GTK+ 2.10.
The
See moreRecentChooserMenuProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserMenu
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserMenu
. Alternatively, useRecentChooserMenuRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserMenuProtocol : ActivatableProtocol, MenuProtocol, RecentChooserProtocol
-
GtkRecentChooserWidget
is a widget suitable for selecting recently used files. It is the main building block of aGtkRecentChooserDialog
. Most applications will only need to use the latter; you can useGtkRecentChooserWidget
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 aGtkRecentChooser
.Recently used files are supported since GTK+ 2.10.
The
See moreRecentChooserWidgetProtocol
protocol exposes the methods and properties of an underlyingGtkRecentChooserWidget
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentChooserWidget
. Alternatively, useRecentChooserWidgetRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentChooserWidgetProtocol : BoxProtocol, RecentChooserProtocol
-
A
GtkRecentFilter
can be used to restrict the files being shown in aGtkRecentChooser
. Files can be filtered based on their name (withgtk_recent_filter_add_pattern()
), on their mime type (withgtk_file_filter_add_mime_type()
), on the application that has registered them (withgtk_recent_filter_add_application()
), or by a custom filter function (withgtk_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
, seegtk_recent_chooser_add_filter()
, but it is also possible to manually use a filter on a file withgtk_recent_filter_filter()
.Recently used files are supported since GTK+ 2.10.
GtkRecentFilter as GtkBuildable
The GtkRecentFilter implementation of the GtkBuildable interface supports adding rules using the <mime-types>, <patterns> and <applications> elements and listing the rules within. Specifying a <mime-type>, <pattern> or <application> has the same effect as calling
gtk_recent_filter_add_mime_type()
,gtk_recent_filter_add_pattern()
orgtk_recent_filter_add_application()
.An example of a UI definition fragment specifying GtkRecentFilter rules:
<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>
The
See moreRecentFilterProtocol
protocol exposes the methods and properties of an underlyingGtkRecentFilter
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentFilter
. Alternatively, useRecentFilterRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentFilterProtocol : InitiallyUnownedProtocol, BuildableProtocol
-
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.The recently used files list is per user.
The
GtkRecentManager
acts like a database of all the recently used files. You can create newGtkRecentManager
objects, but it is more efficient to use the default manager created by GTK+.Adding a new recently used file is as simple as:
(C Language Example):
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()
:(C Language Example):
GtkRecentManager *manager; GtkRecentInfo *info; GError *error = NULL; manager = gtk_recent_manager_get_default (); info = gtk_recent_manager_lookup_item (manager, file_uri, &error); if (error) { g_warning ("Could not find the file: %s", error->message); g_error_free (error); } else { // Use the info object 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 ofGtkRecentInfo-structs
.A
GtkRecentManager
is the model used to populate the contents of one, or moreGtkRecentChooser
implementations.Note that the maximum age of the recently used files list is controllable through the
GtkSettings:gtk-recent-files-max-age
property.Recently used files are supported since GTK+ 2.10.
The
See moreRecentManagerProtocol
protocol exposes the methods and properties of an underlyingGtkRecentManager
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRecentManager
. Alternatively, useRecentManagerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RecentManagerProtocol : ObjectProtocol
-
The
See moreRendererCellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkRendererCellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRendererCellAccessible
. Alternatively, useRendererCellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RendererCellAccessibleProtocol : CellAccessibleProtocol
-
The GtkRevealer widget is a container which animates the transition of its child from invisible to visible.
The style of transition can be controlled with
gtk_revealer_set_transition_type()
.These animations respect the
GtkSettings:gtk-enable-animations
setting.CSS nodes
GtkRevealer has a single CSS node with name revealer.
The GtkRevealer widget was added in GTK+ 3.10.
The
See moreRevealerProtocol
protocol exposes the methods and properties of an underlyingGtkRevealer
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeRevealer
. Alternatively, useRevealerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol RevealerProtocol : BinProtocol
-
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 usegtk_range_set_value()
. To detect changes to the value, you would normally use theGtkRange::value-changed
signal.Note that using the same upper and lower bounds for the
GtkScale
(through theGtkRange
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).GtkScale as GtkBuildable
GtkScale supports a custom <marks> element, which can contain multiple <mark> 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.CSS nodes
(plain Language Example):
scale[.fine-tune][.marks-before][.marks-after] ├── marks.top │ ├── mark │ ┊ ├── [label] │ ┊ ╰── indicator ┊ ┊ │ ╰── mark ├── [value] ├── contents │ ╰── trough │ ├── slider │ ├── [highlight] │ ╰── [fill] ╰── marks.bottom ├── mark ┊ ├── indicator ┊ ╰── [label] ╰── mark
GtkScale has a main CSS node with name scale and a subnode for its contents, with subnodes named trough and slider.
The main node gets the style class .fine-tune added when the scale is in ‘fine-tuning’ mode.
If the scale has an origin (see
gtk_scale_set_has_origin()
), there is a subnode with name highlight below the trough node that is used for rendering the highlighted part of the trough.If the scale is showing a fill level (see
gtk_range_set_show_fill_level()
), there is a subnode with name fill below the trough node that is used for rendering the filled in part of the trough.If marks are present, there is a marks subnode before or after the contents node, below which each mark gets a node with name mark. The marks nodes get either the .top or .bottom style class.
The mark node has a subnode named indicator. If the mark has text, it also has a subnode named label. When the mark is either above or left of the scale, the label subnode is the first when present. Otherwise, the indicator subnode is the first.
The main CSS node gets the ‘marks-before’ and/or ‘marks-after’ style classes added depending on what marks are present.
If the scale is displaying the value (see
GtkScale:draw-value
), there is subnode with name value.The
See moreScaleProtocol
protocol exposes the methods and properties of an underlyingGtkScale
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScale
. Alternatively, useScaleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleProtocol : RangeProtocol
-
The
See moreScaleAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkScaleAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleAccessible
. Alternatively, useScaleAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleAccessibleProtocol : RangeAccessibleProtocol
-
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 aGtkVolumeButton
subclass that is tailored for this use case.CSS nodes
GtkScaleButton has a single CSS node with name button. To differentiate it from a plain
GtkButton
, it gets the .scale style class.The popup widget that contains the scale has a .scale-popup style class.
The
See moreScaleButtonProtocol
protocol exposes the methods and properties of an underlyingGtkScaleButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleButton
. Alternatively, useScaleButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleButtonProtocol : ButtonProtocol, OrientableProtocol
-
The
See moreScaleButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkScaleButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleButtonAccessible
. Alternatively, useScaleButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleButtonAccessibleProtocol : ValueProtocol, ButtonAccessibleProtocol
-
The
GtkScrollbar
widget is a horizontal or vertical scrollbar, depending on the value of theGtkOrientable:orientation
property.Its position and movement are controlled by the adjustment that is passed to or created by
gtk_scrollbar_new()
. SeeGtkAdjustment
for more details. TheGtkAdjustment:value
field sets the position of the thumb and must be betweenGtkAdjustment:lower
andGtkAdjustment:upper
-GtkAdjustment:page-size
. TheGtkAdjustment:page-size
represents the size of the visible scrollable area. The fieldsGtkAdjustment:step-increment
andGtkAdjustment:page-increment
fields are added to or subtracted from theGtkAdjustment:value
when the user asks to move by a step (using e.g. the cursor arrow keys or, if present, the stepper buttons) or by a page (using e.g. the Page Down/Up keys).CSS nodes
(plain Language Example):
scrollbar[.fine-tune] ╰── contents ├── [button.up] ├── [button.down] ├── trough │ ╰── slider ├── [button.up] ╰── [button.down]
GtkScrollbar has a main CSS node with name scrollbar and a subnode for its contents, with subnodes named trough and slider.
The main node gets the style class .fine-tune added when the scrollbar is in ‘fine-tuning’ mode.
If steppers are enabled, they are represented by up to four additional subnodes with name button. These get the style classes .up and .down to indicate in which direction they are moving.
Other style classes that may be added to scrollbars inside
GtkScrolledWindow
include the positional classes (.left, .right, .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).The
See moreScrollbarProtocol
protocol exposes the methods and properties of an underlyingGtkScrollbar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrollbar
. Alternatively, useScrollbarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrollbarProtocol : RangeProtocol
-
GtkScrolledWindow is a container that accepts a single child widget, makes that child scrollable using either internally added scrollbars or externally associated adjustments, and optionally draws a frame around the child.
Widgets with native scrolling support, i.e. those whose classes implement the
GtkScrollable
interface, are added directly. For other types of widget, the classGtkViewport
acts as an adaptor, giving scrollability to other widgets. GtkScrolledWindow’s implementation ofgtk_container_add()
intelligently accounts for whether or not the added child is aGtkScrollable
. If it isn’t,GtkScrolledWindow
wraps the child in aGtkViewport
and adds that for you. Therefore, you can just add any child widget and not worry about the details.If
gtk_container_add()
has added aGtkViewport
for you, you can remove both your added child widget from theGtkViewport
, and theGtkViewport
from the GtkScrolledWindow, like this:(C Language Example):
GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); GtkWidget *child_widget = gtk_button_new (); // GtkButton is not a GtkScrollable, so GtkScrolledWindow will automatically // add a GtkViewport. gtk_container_add (GTK_CONTAINER (scrolled_window), child_widget); // Either of these will result in child_widget being unparented: gtk_container_remove (GTK_CONTAINER (scrolled_window), child_widget); // or gtk_container_remove (GTK_CONTAINER (scrolled_window), gtk_bin_get_child (GTK_BIN (scrolled_window)));
Unless
GtkScrolledWindow:policy
is GTK_POLICY_NEVER or GTK_POLICY_EXTERNAL, GtkScrolledWindow adds internalGtkScrollbar
widgets around its child. The scroll position of the child, and if applicable the scrollbars, is controlled by theGtkScrolledWindow:hadjustment
andGtkScrolledWindow:vadjustment
that are associated with the GtkScrolledWindow. See the docs onGtkScrollbar
for the details, but note that the “step_increment” and “page_increment” fields are only effective if the policy causes scrollbars to be present.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 aGtkGrid
.Touch support
GtkScrolledWindow has built-in support for touch devices. When a touchscreen is used, swiping will move the scrolled window, and will expose ‘kinetic’ behavior. This can be turned off with the
GtkScrolledWindow:kinetic-scrolling
property if it is undesired.GtkScrolledWindow also displays visual ‘overshoot’ indication when the content is pulled beyond the end, and this situation can be captured with the
GtkScrolledWindow::edge-overshot
signal.If no mouse device is present, the scrollbars will overlayed as narrow, auto-hiding indicators over the content. If traditional scrollbars are desired although no mouse is present, this behaviour can be turned off with the
GtkScrolledWindow:overlay-scrolling
property.CSS nodes
GtkScrolledWindow has a main CSS node with name scrolledwindow.
It uses subnodes with names overshoot and undershoot to draw the overflow and underflow indications. These nodes get the .left, .right, .top or .bottom style class added depending on where the indication is drawn.
GtkScrolledWindow also sets the positional style classes (.left, .right, .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering) on its scrollbars.
If both scrollbars are visible, the area where they meet is drawn with a subnode named junction.
The
See moreScrolledWindowProtocol
protocol exposes the methods and properties of an underlyingGtkScrolledWindow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrolledWindow
. Alternatively, useScrolledWindowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrolledWindowProtocol : BinProtocol
-
The
See moreScrolledWindowAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkScrolledWindowAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrolledWindowAccessible
. Alternatively, useScrolledWindowAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrolledWindowAccessibleProtocol : ContainerAccessibleProtocol
-
GtkSearchBar
is a container made to have a search entry (possibly with additional connex widgets, such as drop-down menus, or buttons) built-in. The search bar would appear when a search is started through typing on the keyboard, or the application’s search mode is toggled on.For keyboard presses to start a search, events will need to be forwarded from the top-level window that contains the search bar. See
gtk_search_bar_handle_event()
for example code. Common shortcuts such as Ctrl+F should be handled as an application action, or through the menu items.You will also need to tell the search bar about which entry you are using as your search entry using
gtk_search_bar_connect_entry()
. The following example shows you how to create a more complex search entry.CSS nodes
GtkSearchBar has a single CSS node with name searchbar.
Creating a search bar
The
See moreSearchBarProtocol
protocol exposes the methods and properties of an underlyingGtkSearchBar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSearchBar
. Alternatively, useSearchBarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SearchBarProtocol : BinProtocol
-
GtkSearchEntry
is a subclass ofGtkEntry
that has been tailored for use as a search entry.It will show an inactive symbolic “find” icon when the search entry is empty, and a symbolic “clear” icon when there is text. Clicking on the “clear” icon will empty the search entry.
Note that the search/clear icon is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.
To make filtering appear more reactive, it is a good idea to not react to every change in the entry text immediately, but only after a short delay. To support this,
GtkSearchEntry
emits theGtkSearchEntry::search-changed
signal which can be used instead of theGtkEditable::changed
signal.The
GtkSearchEntry::previous-match
,GtkSearchEntry::next-match
andGtkSearchEntry::stop-search
signals can be used to implement moving between search results and ending the search.Often, GtkSearchEntry will be fed events by means of being placed inside a
GtkSearchBar
. If that is not the case, you can usegtk_search_entry_handle_event()
to pass events.The
See moreSearchEntryProtocol
protocol exposes the methods and properties of an underlyingGtkSearchEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSearchEntry
. Alternatively, useSearchEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SearchEntryProtocol : EntryProtocol
-
GtkSeparator is a horizontal or vertical separator widget, depending on the value of the
GtkOrientable:orientation
property, used to group the widgets within a window. It displays a line with a shadow to make it appear sunken into the interface.CSS nodes
GtkSeparator has a single CSS node with name separator. The node gets one of the .horizontal or .vertical style classes.
The
See moreSeparatorProtocol
protocol exposes the methods and properties of an underlyingGtkSeparator
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSeparator
. Alternatively, useSeparatorRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SeparatorProtocol : OrientableProtocol, WidgetProtocol
-
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.CSS nodes
GtkSeparatorMenuItem has a single CSS node with name separator.
The
See moreSeparatorMenuItemProtocol
protocol exposes the methods and properties of an underlyingGtkSeparatorMenuItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSeparatorMenuItem
. Alternatively, useSeparatorMenuItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SeparatorMenuItemProtocol : MenuItemProtocol
-
A
GtkSeparatorToolItem
is aGtkToolItem
that separates groups of otherGtkToolItems
. Depending on the theme, aGtkSeparatorToolItem
will often look like a vertical line on horizontally docked toolbars.If the
GtkToolbar
child property “expand” istrue
and the propertyGtkSeparatorToolItem:draw
isfalse
, aGtkSeparatorToolItem
will act as a “spring” that forces other items to the ends of the toolbar.Use
gtk_separator_tool_item_new()
to create a newGtkSeparatorToolItem
.CSS nodes
GtkSeparatorToolItem has a single CSS node with name separator.
The
See moreSeparatorToolItemProtocol
protocol exposes the methods and properties of an underlyingGtkSeparatorToolItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSeparatorToolItem
. Alternatively, useSeparatorToolItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SeparatorToolItemProtocol : ToolItemProtocol
-
GtkSettings provide a mechanism to share global settings between applications.
On the X window system, this sharing is realized by an XSettings 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
settings.ini
files in/etc/gtk-3.0
,$XDG_CONFIG_DIRS/gtk-3.0
and$XDG_CONFIG_HOME/gtk-3.0
. These files must be valid key files (seeGKeyFile
), and have a section called Settings. Themes can also provide default values for settings by installing asettings.ini
file next to theirgtk.css
file.Applications can override system-wide settings by setting the property of the GtkSettings object with
g_object_set()
. 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: (C Language Example):gtk_init (&argc, &argv); // make sure the type is realized g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM)); g_object_set (gtk_settings_get_default (), "gtk-enable-animations", FALSE, NULL);
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 usegtk_widget_get_settings()
.gtk_settings_get_default()
returns the GtkSettings instance for the default screen.The
See moreSettingsProtocol
protocol exposes the methods and properties of an underlyingGtkSettings
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSettings
. Alternatively, useSettingsRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SettingsProtocol : ObjectProtocol, StyleProviderProtocol
-
GtkShortcutLabel
is a widget that represents a single keyboard shortcut or gesture in the user interface.The
See moreShortcutLabelProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutLabel
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutLabel
. Alternatively, useShortcutLabelRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutLabelProtocol : BoxProtocol
-
A GtkShortcutsGroup represents a group of related keyboard shortcuts or gestures. The group has a title. It may optionally be associated with a view of the application, which can be used to show only relevant shortcuts depending on the application context.
This widget is only meant to be used with
GtkShortcutsWindow
.The
See moreShortcutsGroupProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsGroup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsGroup
. Alternatively, useShortcutsGroupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsGroupProtocol : BoxProtocol
-
A GtkShortcutsSection collects all the keyboard shortcuts and gestures for a major application mode. If your application needs multiple sections, you should give each section a unique
GtkShortcutsSection:section-name
and aGtkShortcutsSection:title
that can be shown in the section selector of the GtkShortcutsWindow.The
GtkShortcutsSection:max-height
property can be used to influence how the groups in the section are distributed over pages and columns.This widget is only meant to be used with
GtkShortcutsWindow
.The
See moreShortcutsSectionProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsSection
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsSection
. Alternatively, useShortcutsSectionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsSectionProtocol : BoxProtocol
-
A GtkShortcutsShortcut represents a single keyboard shortcut or gesture with a short text. This widget is only meant to be used with
GtkShortcutsWindow
.The
See moreShortcutsShortcutProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsShortcut
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsShortcut
. Alternatively, useShortcutsShortcutRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsShortcutProtocol : BoxProtocol
-
A GtkShortcutsWindow shows brief information about the keyboard shortcuts and gestures of an application. The shortcuts can be grouped, and you can have multiple sections in this window, corresponding to the major modes of your application.
Additionally, the shortcuts can be filtered by the current view, to avoid showing information that is not relevant in the current application context.
The recommended way to construct a GtkShortcutsWindow is with GtkBuilder, by populating a
GtkShortcutsWindow
with one or moreGtkShortcutsSection
objects, which containGtkShortcutsGroups
that in turn contain objects of classGtkShortcutsShortcut
.A simple example:
This example has as single section. As you can see, the shortcut groups are arranged in columns, and spread across several pages if there are too many to find on a single page.
The .ui file for this example can be found here.
An example with multiple views:
This example shows a
GtkShortcutsWindow
that has been configured to show only the shortcuts relevant to the “stopwatch” view.The .ui file for this example can be found here.
An example with multiple sections:
This example shows a
GtkShortcutsWindow
with two sections, “Editor Shortcuts” and “Terminal Shortcuts”.The .ui file for this example can be found here.
The
See moreShortcutsWindowProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsWindow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsWindow
. Alternatively, useShortcutsWindowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsWindowProtocol : WindowProtocol
-
GtkSizeGroup
provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically useful when you want a column of widgets to have the same size, but you can’t use aGtkGrid
widget.In detail, the size requested for each widget in a
GtkSizeGroup
is the maximum of the sizes that would have been requested for each widget in the size group if they were not in the size group. The mode of the size group (seegtk_size_group_set_mode()
) determines whether this applies to the horizontal size, the vertical size, or both sizes.Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a
GtkSizeGroup
to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include theGTK_FILL
flag.GtkSizeGroup
objects are referenced by each widget in the size group, so once you have added all widgets to aGtkSizeGroup
, you can drop the initial reference to the size group withg_object_unref()
. If the widgets in the size group are subsequently destroyed, then they will be removed from the size group and drop their references on the size group; when all widgets have been removed, the size group will be freed.Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal requisition of all widgets that can be reached from the widget by a chain of size groups of type
GTK_SIZE_GROUP_HORIZONTAL
orGTK_SIZE_GROUP_BOTH
, and the vertical size from the vertical requisition of all widgets that can be reached from the widget by a chain of size groups of typeGTK_SIZE_GROUP_VERTICAL
orGTK_SIZE_GROUP_BOTH
.Note that only non-contextual sizes of every widget are ever consulted by size groups (since size groups have no knowledge of what size a widget will be allocated in one dimension, it cannot derive how much height a widget will receive for a given width). When grouping widgets that trade height for width in mode
GTK_SIZE_GROUP_VERTICAL
orGTK_SIZE_GROUP_BOTH:
the height for the minimum width will be the requested height for all widgets in the group. The same is of course true when horizontally grouping width for height widgets.Widgets that trade height-for-width should set a reasonably large minimum width by way of
GtkLabel:width-chars
for instance. Widgets with static sizes as well as widgets that grow (such as ellipsizing text) need no such considerations.GtkSizeGroup as GtkBuildable
Size groups can be specified in a UI definition by placing an <object> element with
class="GtkSizeGroup"
somewhere in the UI definition. The widgets that belong to the size group are specified by a <widgets> element that may contain multiple <widget> elements, one for each member of the size group. The ”name” attribute gives the id of the widget.An example of a UI definition fragment with GtkSizeGroup:
<object class="GtkSizeGroup"> <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property> <widgets> <widget name="radio1"/> <widget name="radio2"/> </widgets> </object>
The
See moreSizeGroupProtocol
protocol exposes the methods and properties of an underlyingGtkSizeGroup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSizeGroup
. Alternatively, useSizeGroupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SizeGroupProtocol : ObjectProtocol, BuildableProtocol
-
The
See moreSocketAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkSocketAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSocketAccessible
. Alternatively, useSocketAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SocketAccessibleProtocol : ContainerAccessibleProtocol
-
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 aGtkEntry
, 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. Note that GtkSpinButton will by default make its entry large enough to accomodate the lower and upper bounds of the adjustment, which can lead to surprising results. Best practice is to set both theGtkEntry:width-chars
andGtkEntry:max-width-chars
poperties to the desired number of characters to display in the entry.CSS nodes
(plain Language Example):
spinbutton.horizontal ├── undershoot.left ├── undershoot.right ├── entry │ ╰── ... ├── button.down ╰── button.up
(plain Language Example):
spinbutton.vertical ├── undershoot.left ├── undershoot.right ├── button.up ├── entry │ ╰── ... ╰── button.down
GtkSpinButtons main CSS node has the name spinbutton. It creates subnodes for the entry and the two buttons, with these names. The button nodes have the style classes .up and .down. The GtkEntry subnodes (if present) are put below the entry node. The orientation of the spin button is reflected in the .vertical or .horizontal style class on the main node.
Using a GtkSpinButton to get an integer
(C Language Example):
// Provides a function to retrieve an integer value from a GtkSpinButton // and creates a spin button to model percentage values. 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); // creates the spinbutton, with no decimal places button = gtk_spin_button_new (adjustment, 1.0, 0); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); }
Using a GtkSpinButton to get a floating point value
(C Language Example):
// Provides a function to retrieve a floating point value from a // GtkSpinButton, and creates a high precision spin button. 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); // creates the spinbutton, with three decimal places button = gtk_spin_button_new (adjustment, 0.001, 3); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); }
The
See moreSpinButtonProtocol
protocol exposes the methods and properties of an underlyingGtkSpinButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinButton
. Alternatively, useSpinButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinButtonProtocol : EntryProtocol, OrientableProtocol
-
The
See moreSpinButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkSpinButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinButtonAccessible
. Alternatively, useSpinButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinButtonAccessibleProtocol : ValueProtocol, EntryAccessibleProtocol
-
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 usegtk_spinner_stop()
.CSS nodes
GtkSpinner has a single CSS node with the name spinner. When the animation is active, the :checked pseudoclass is added to this node.
The
See moreSpinnerProtocol
protocol exposes the methods and properties of an underlyingGtkSpinner
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinner
. Alternatively, useSpinnerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinnerProtocol : WidgetProtocol
-
The
See moreSpinnerAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkSpinnerAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinnerAccessible
. Alternatively, useSpinnerAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinnerAccessibleProtocol : ImageProtocol, WidgetAccessibleProtocol
-
The GtkStack widget is a container which only shows one of its children at a time. In contrast to GtkNotebook, GtkStack does not provide a means for users to change the visible child. Instead, the
GtkStackSwitcher
widget can be used with GtkStack to provide this functionality.Transitions between pages can be animated as slides or fades. This can be controlled with
gtk_stack_set_transition_type()
. These animations respect theGtkSettings:gtk-enable-animations
setting.The GtkStack widget was added in GTK+ 3.10.
CSS nodes
GtkStack has a single CSS node named stack.
The
See moreStackProtocol
protocol exposes the methods and properties of an underlyingGtkStack
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStack
. Alternatively, useStackRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackProtocol : ContainerProtocol
-
The
See moreStackAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkStackAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackAccessible
. Alternatively, useStackAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackAccessibleProtocol : ContainerAccessibleProtocol
-
A GtkStackSidebar enables you to quickly and easily provide a consistent “sidebar” object for your user interface.
In order to use a GtkStackSidebar, you simply use a GtkStack to organize your UI flow, and add the sidebar to your sidebar area. You can use
gtk_stack_sidebar_set_stack()
to connect theGtkStackSidebar
to theGtkStack
.CSS nodes
GtkStackSidebar has a single CSS node with name stacksidebar and style class .sidebar.
When circumstances require it, GtkStackSidebar adds the .needs-attention style class to the widgets representing the stack pages.
The
See moreStackSidebarProtocol
protocol exposes the methods and properties of an underlyingGtkStackSidebar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackSidebar
. Alternatively, useStackSidebarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackSidebarProtocol : BinProtocol
-
The GtkStackSwitcher widget acts as a controller for a
GtkStack
; it shows a row of buttons to switch between the various pages of the associated stack widget.All the content for the buttons comes from the child properties of the
GtkStack
; the button visibility in aGtkStackSwitcher
widget is controlled by the visibility of the child in theGtkStack
.It is possible to associate multiple
GtkStackSwitcher
widgets with the sameGtkStack
widget.The GtkStackSwitcher widget was added in 3.10.
CSS nodes
GtkStackSwitcher has a single CSS node named stackswitcher and style class .stack-switcher.
When circumstances require it, GtkStackSwitcher adds the .needs-attention style class to the widgets representing the stack pages.
The
See moreStackSwitcherProtocol
protocol exposes the methods and properties of an underlyingGtkStackSwitcher
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackSwitcher
. Alternatively, useStackSwitcherRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackSwitcherProtocol : BoxProtocol
-
The “system tray” or notification area is normally used for transient icons that indicate some special state. For example, a system tray icon might appear to tell the user that they have new mail, or have an incoming instant message, or something along those lines. The basic idea is that creating an icon in the notification area is less annoying than popping up a dialog.
A
GtkStatusIcon
object can be used to display an icon in a “system tray”. The icon can have a tooltip, and the user can interact with it by activating it or popping up a context menu.It is very important to notice that status icons depend on the existence of a notification area being available to the user; you should not use status icons as the only way to convey critical information regarding your application, as the notification area may not exist on the user’s environment, or may have been removed. You should always check that a status icon has been embedded into a notification area by using
gtk_status_icon_is_embedded()
, and gracefully recover if the function returnsfalse
.On X11, the implementation follows the FreeDesktop System Tray Specification. Implementations of the “tray” side of this specification can be found e.g. in the GNOME 2 and KDE panel applications.
Note that a GtkStatusIcon is not a widget, but just a
GObject
. Making it a widget would be impractical, since the system tray on Windows doesn’t allow to embed arbitrary widgets.GtkStatusIcon has been deprecated in 3.14. You should consider using notifications or more modern platform-specific APIs instead. GLib provides the
GNotification
API which works well withGtkApplication
on multiple platforms and environments, and should be the preferred mechanism to notify the users of transient status updates. See this HowDoI for code examples.The
See moreStatusIconProtocol
protocol exposes the methods and properties of an underlyingGtkStatusIcon
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStatusIcon
. Alternatively, useStatusIconRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StatusIconProtocol : ObjectProtocol
-
A
GtkStatusbar
is usually placed along the bottom of an application’s mainGtkWindow
. 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 context id 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 usinggtk_statusbar_remove()
.CSS node
GtkStatusbar has a single CSS node with name statusbar.
The
See moreStatusbarProtocol
protocol exposes the methods and properties of an underlyingGtkStatusbar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStatusbar
. Alternatively, useStatusbarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StatusbarProtocol : BoxProtocol
-
The
See moreStatusbarAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkStatusbarAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStatusbarAccessible
. Alternatively, useStatusbarAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StatusbarAccessibleProtocol : ContainerAccessibleProtocol
-
A
GtkStyle
object encapsulates the information that provides the look and feel for a widget.> In GTK+ 3.0, GtkStyle has been deprecated and replaced by >
GtkStyleContext
.Each
GtkWidget
has an associatedGtkStyle
object that is used when rendering that widget. Also, aGtkStyle
holds information for the five possible widget states though not every widget supports all five states; seeGtkStateType
.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.The
See moreStyleProtocol
protocol exposes the methods and properties of an underlyingGtkStyle
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyle
. Alternatively, useStyleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StyleProtocol : ObjectProtocol
-
GtkStyleContext
is an object that stores styling information affecting a widget defined byGtkWidgetPath
.In order to construct the final style information,
GtkStyleContext
queries information from all attachedGtkStyleProviders
. Style providers can be either attached explicitly to the context throughgtk_style_context_add_provider()
, or to the screen throughgtk_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 bygtk_widget_get_style_context()
will already have aGtkWidgetPath
, aGdkScreen
and RTL/LTR information set. The style context will also be 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 possiblygtk_style_context_set_screen()
. See the “Foreign drawing“ example in gtk3-demo.Style Classes #
Widgets can add style classes to their context, which can be used to associate different styles by class. The documentation for individual widgets lists which style classes it uses itself, and which style classes may be added by applications to affect their appearance.
GTK+ defines macros for a number of style classes.
Style Regions
Widgets can also add regions with flags to their context. This feature is deprecated and will be removed in a future GTK+ update. Please use style classes instead.
GTK+ defines macros for a number of style regions.
Custom styling in UI libraries and applications
If you are developing a library with custom
GtkWidgets
that render differently than standard components, you may need to add aGtkStyleProvider
yourself with theGTK_STYLE_PROVIDER_PRIORITY_FALLBACK
priority, either aGtkCssProvider
or a custom object implementing theGtkStyleProvider
interface. This way themes may still attempt to style your UI elements in a different way if needed so.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 theGTK_STYLE_PROVIDER_PRIORITY_APPLICATION
priority, keep in mind that the user settings inXDG_CONFIG_HOME/gtk-3.0/gtk.css
will still take precedence over your changes, as it uses theGTK_STYLE_PROVIDER_PRIORITY_USER
priority.The
See moreStyleContextProtocol
protocol exposes the methods and properties of an underlyingGtkStyleContext
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyleContext
. Alternatively, useStyleContextRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StyleContextProtocol : ObjectProtocol
-
GtkStyleProperties provides the storage for style information that is used by
GtkStyleContext
and otherGtkStyleProvider
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, asgtk_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 byGtkThemingEngine
instead.GtkStyleProperties
has been deprecated in GTK 3.16. The CSS machinery does not use it anymore and all users of this object have been deprecated.The
See moreStylePropertiesProtocol
protocol exposes the methods and properties of an underlyingGtkStyleProperties
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyleProperties
. Alternatively, useStylePropertiesRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StylePropertiesProtocol : ObjectProtocol, StyleProviderProtocol
-
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.GtkSwitch can also handle situations where the underlying state changes with a delay. See
GtkSwitch::state-set
for details.CSS nodes
(plain Language Example):
switch ╰── slider
GtkSwitch has two css nodes, the main node with the name switch and a subnode named slider. Neither of them is using any style classes.
The
See moreSwitchProtocol
protocol exposes the methods and properties of an underlyingGtkSwitch
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSwitch
. Alternatively, useSwitchRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SwitchProtocol : ActionableProtocol, ActivatableProtocol
-
The
See moreSwitchAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkSwitchAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSwitchAccessible
. Alternatively, useSwitchAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SwitchAccessibleProtocol : ActionProtocol, WidgetAccessibleProtocol
-
The
GtkTable
functions allow the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically.Tables are created with a call to
gtk_table_new()
, the size of which can later be changed withgtk_table_resize()
.Widgets can be added to a table using
gtk_table_attach()
or the more convenient (but slightly less flexible)gtk_table_attach_defaults()
.To alter the space next to a specific row, use
gtk_table_set_row_spacing()
, and for a column,gtk_table_set_col_spacing()
. The gaps between all rows or columns can be changed by callinggtk_table_set_row_spacings()
orgtk_table_set_col_spacings()
respectively. Note that spacing is added between the children, while padding added bygtk_table_attach()
is added on either side of the widget it belongs to.gtk_table_set_homogeneous()
, can be used to set whether all cells in the table will resize themselves to the size of the largest widget in the table.>
GtkTable
has been deprecated. UseGtkGrid
instead. It provides the same > capabilities as GtkTable for arranging widgets in a rectangular grid, but > does support height-for-width geometry management.The
See moreTableProtocol
protocol exposes the methods and properties of an underlyingGtkTable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTable
. Alternatively, useTableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TableProtocol : ContainerProtocol
-
The
See moreScaleButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkScaleButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleButtonAccessibleClass
. Alternatively, useScaleButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleButtonAccessibleClassProtocol
-
The
See moreScaleButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkScaleButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleButtonClass
. Alternatively, useScaleButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleButtonClassProtocol
-
The
See moreScaleClassProtocol
protocol exposes the methods and properties of an underlyingGtkScaleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScaleClass
. Alternatively, useScaleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScaleClassProtocol
-
The
See moreScrollableInterfaceProtocol
protocol exposes the methods and properties of an underlyingGtkScrollableInterface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrollableInterface
. Alternatively, useScrollableInterfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrollableInterfaceProtocol
-
The
See moreScrollbarClassProtocol
protocol exposes the methods and properties of an underlyingGtkScrollbarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrollbarClass
. Alternatively, useScrollbarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrollbarClassProtocol
-
The
See moreScrolledWindowAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkScrolledWindowAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrolledWindowAccessibleClass
. Alternatively, useScrolledWindowAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrolledWindowAccessibleClassProtocol
-
The
See moreScrolledWindowClassProtocol
protocol exposes the methods and properties of an underlyingGtkScrolledWindowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrolledWindowClass
. Alternatively, useScrolledWindowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrolledWindowClassProtocol
-
The
See moreSearchBarClassProtocol
protocol exposes the methods and properties of an underlyingGtkSearchBarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSearchBarClass
. Alternatively, useSearchBarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SearchBarClassProtocol
-
The
See moreSearchEntryClassProtocol
protocol exposes the methods and properties of an underlyingGtkSearchEntryClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSearchEntryClass
. Alternatively, useSearchEntryClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SearchEntryClassProtocol
-
The
See moreSelectionDataProtocol
protocol exposes the methods and properties of an underlyingGtkSelectionData
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSelectionData
. Alternatively, useSelectionDataRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SelectionDataProtocol
-
The
See moreSeparatorClassProtocol
protocol exposes the methods and properties of an underlyingGtkSeparatorClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSeparatorClass
. Alternatively, useSeparatorClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SeparatorClassProtocol
-
The
See moreSeparatorMenuItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkSeparatorMenuItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSeparatorMenuItemClass
. Alternatively, useSeparatorMenuItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SeparatorMenuItemClassProtocol
-
The
See moreSeparatorToolItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkSeparatorToolItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSeparatorToolItemClass
. Alternatively, useSeparatorToolItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SeparatorToolItemClassProtocol
-
The
See moreSettingsClassProtocol
protocol exposes the methods and properties of an underlyingGtkSettingsClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSettingsClass
. Alternatively, useSettingsClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SettingsClassProtocol
-
The
See moreSettingsValueProtocol
protocol exposes the methods and properties of an underlyingGtkSettingsValue
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSettingsValue
. Alternatively, useSettingsValueRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SettingsValueProtocol
-
The
See moreShortcutLabelClassProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutLabelClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutLabelClass
. Alternatively, useShortcutLabelClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutLabelClassProtocol
-
The
See moreShortcutsGroupClassProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsGroupClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsGroupClass
. Alternatively, useShortcutsGroupClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsGroupClassProtocol
-
The
See moreShortcutsSectionClassProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsSectionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsSectionClass
. Alternatively, useShortcutsSectionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsSectionClassProtocol
-
The
See moreShortcutsShortcutClassProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsShortcutClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsShortcutClass
. Alternatively, useShortcutsShortcutClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsShortcutClassProtocol
-
The
See moreShortcutsWindowClassProtocol
protocol exposes the methods and properties of an underlyingGtkShortcutsWindowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeShortcutsWindowClass
. Alternatively, useShortcutsWindowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ShortcutsWindowClassProtocol
-
The
See moreSizeGroupClassProtocol
protocol exposes the methods and properties of an underlyingGtkSizeGroupClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSizeGroupClass
. Alternatively, useSizeGroupClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SizeGroupClassProtocol
-
The
See moreSocketAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkSocketAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSocketAccessibleClass
. Alternatively, useSocketAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SocketAccessibleClassProtocol
-
The
See moreSpinButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkSpinButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinButtonAccessibleClass
. Alternatively, useSpinButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinButtonAccessibleClassProtocol
-
The
See moreSpinButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkSpinButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinButtonClass
. Alternatively, useSpinButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinButtonClassProtocol
-
The
See moreSpinnerAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkSpinnerAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinnerAccessibleClass
. Alternatively, useSpinnerAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinnerAccessibleClassProtocol
-
The
See moreSpinnerClassProtocol
protocol exposes the methods and properties of an underlyingGtkSpinnerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSpinnerClass
. Alternatively, useSpinnerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SpinnerClassProtocol
-
The
See moreStackAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkStackAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackAccessibleClass
. Alternatively, useStackAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackAccessibleClassProtocol
-
The
See moreStackClassProtocol
protocol exposes the methods and properties of an underlyingGtkStackClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackClass
. Alternatively, useStackClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackClassProtocol
-
The
See moreStackSidebarClassProtocol
protocol exposes the methods and properties of an underlyingGtkStackSidebarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackSidebarClass
. Alternatively, useStackSidebarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackSidebarClassProtocol
-
The
See moreStackSwitcherClassProtocol
protocol exposes the methods and properties of an underlyingGtkStackSwitcherClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStackSwitcherClass
. Alternatively, useStackSwitcherClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StackSwitcherClassProtocol
-
The
See moreStatusIconClassProtocol
protocol exposes the methods and properties of an underlyingGtkStatusIconClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStatusIconClass
. Alternatively, useStatusIconClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StatusIconClassProtocol
-
The
See moreStatusbarAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkStatusbarAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStatusbarAccessibleClass
. Alternatively, useStatusbarAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StatusbarAccessibleClassProtocol
-
The
See moreStatusbarClassProtocol
protocol exposes the methods and properties of an underlyingGtkStatusbarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStatusbarClass
. Alternatively, useStatusbarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StatusbarClassProtocol
-
The
See moreStockItemProtocol
protocol exposes the methods and properties of an underlyingGtkStockItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStockItem
. Alternatively, useStockItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StockItemProtocol
-
The
See moreStyleClassProtocol
protocol exposes the methods and properties of an underlyingGtkStyleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyleClass
. Alternatively, useStyleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StyleClassProtocol
-
The
See moreStyleContextClassProtocol
protocol exposes the methods and properties of an underlyingGtkStyleContextClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyleContextClass
. Alternatively, useStyleContextClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StyleContextClassProtocol
-
The
See moreStylePropertiesClassProtocol
protocol exposes the methods and properties of an underlyingGtkStylePropertiesClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStylePropertiesClass
. Alternatively, useStylePropertiesClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StylePropertiesClassProtocol
-
The
See moreStyleProviderIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkStyleProviderIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyleProviderIface
. Alternatively, useStyleProviderIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StyleProviderIfaceProtocol
-
The
See moreSwitchAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkSwitchAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSwitchAccessibleClass
. Alternatively, useSwitchAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SwitchAccessibleClassProtocol
-
The
See moreSwitchClassProtocol
protocol exposes the methods and properties of an underlyingGtkSwitchClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSwitchClass
. Alternatively, useSwitchClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SwitchClassProtocol
-
GtkSymbolicColor is a boxed type that represents a symbolic color. It is the result of parsing a color expression. To obtain the color represented by a GtkSymbolicColor, it has to be resolved with
gtk_symbolic_color_resolve()
, which replaces all symbolic color references by the colors they refer to (in a given context) and evaluates mix, shade and other expressions, resulting in aGdkRGBA
value.It is not normally necessary to deal directly with
GtkSymbolicColors
, since they are mostly used behind the scenes byGtkStyleContext
andGtkCssProvider
.GtkSymbolicColor
is deprecated. Symbolic colors are considered an implementation detail of GTK+.The
See moreSymbolicColorProtocol
protocol exposes the methods and properties of an underlyingGtkSymbolicColor
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSymbolicColor
. Alternatively, useSymbolicColorRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SymbolicColorProtocol
-
The
See moreTableChildProtocol
protocol exposes the methods and properties of an underlyingGtkTableChild
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTableChild
. Alternatively, useTableChildRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TableChildProtocol
-
GtkScrollable
is an interface that is implemented by widgets with native scrolling ability.To implement this interface you should override the
GtkScrollable:hadjustment
andGtkScrollable:vadjustment
properties.Creating a scrollable widget
All scrollable widgets should do the following.
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
andGtkAdjustment:page-size
properties and connect to theGtkAdjustment::value-changed
signal.Because its preferred size is the size for a fully expanded widget, the scrollable widget must be able to cope with underallocations. This means that it must accept any value passed to its
GtkWidgetClass.size_allocate
()
function.When the parent allocates space to the scrollable child widget, the widget should update the adjustments’ properties with new values.
When any of the adjustments emits the
GtkAdjustment::value-changed
signal, the scrollable widget should scroll its contents.
The
See moreScrollableProtocol
protocol exposes the methods and properties of an underlyingGtkScrollable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeScrollable
. Alternatively, useScrollableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ScrollableProtocol
-
GtkStyleProvider is an interface used to provide style information to a
GtkStyleContext
. Seegtk_style_context_add_provider()
andgtk_style_context_add_provider_for_screen()
.The
See moreStyleProviderProtocol
protocol exposes the methods and properties of an underlyingGtkStyleProvider
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeStyleProvider
. Alternatively, useStyleProviderRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol StyleProviderProtocol
-
The
GtkToolShell
interface allows container widgets to provide additional information when embeddingGtkToolItem
widgets.The
See moreToolShellProtocol
protocol exposes the methods and properties of an underlyingGtkToolShell
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolShell
. Alternatively, useToolShellRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolShellProtocol : WidgetProtocol
-
The
See moreTableClassProtocol
protocol exposes the methods and properties of an underlyingGtkTableClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTableClass
. Alternatively, useTableClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TableClassProtocol
-
The
See moreTableRowColProtocol
protocol exposes the methods and properties of an underlyingGtkTableRowCol
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTableRowCol
. Alternatively, useTableRowColRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TableRowColProtocol
-
A
GtkTargetEntry
represents a single type of data than can be supplied for by a widget for a selection or for supplied or received during drag-and-drop.The
See moreTargetEntryProtocol
protocol exposes the methods and properties of an underlyingGtkTargetEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTargetEntry
. Alternatively, useTargetEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TargetEntryProtocol
-
A
GtkTargetList-struct
is a reference counted list ofGtkTargetPair
and should be treated as opaque.The
See moreTargetListProtocol
protocol exposes the methods and properties of an underlyingGtkTargetList
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTargetList
. Alternatively, useTargetListRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TargetListProtocol
-
A
GtkTargetPair
is used to represent the same information as a table ofGtkTargetEntry
, but in an efficient form.The
See moreTargetPairProtocol
protocol exposes the methods and properties of an underlyingGtkTargetPair
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTargetPair
. Alternatively, useTargetPairRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TargetPairProtocol
-
The
See moreTearoffMenuItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkTearoffMenuItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTearoffMenuItemClass
. Alternatively, useTearoffMenuItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TearoffMenuItemClassProtocol
-
The
See moreTextAppearanceProtocol
protocol exposes the methods and properties of an underlyingGtkTextAppearance
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextAppearance
. Alternatively, useTextAppearanceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextAppearanceProtocol
-
Using
GtkTextAttributes
directly should rarely be necessary. It’s primarily useful withgtk_text_iter_get_attributes()
. As with most GTK+ structs, the fields in this struct should only be read, never modified directly.The
See moreTextAttributesProtocol
protocol exposes the methods and properties of an underlyingGtkTextAttributes
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextAttributes
. Alternatively, useTextAttributesRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextAttributesProtocol
-
The
See moreTextBTreeProtocol
protocol exposes the methods and properties of an underlyingGtkTextBTree
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextBTree
. Alternatively, useTextBTreeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextBTreeProtocol
-
The
See moreTextBufferClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextBufferClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextBufferClass
. Alternatively, useTextBufferClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextBufferClassProtocol
-
The
See moreTextCellAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextCellAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextCellAccessibleClass
. Alternatively, useTextCellAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextCellAccessibleClassProtocol
-
The
See moreTextChildAnchorClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextChildAnchorClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextChildAnchorClass
. Alternatively, useTextChildAnchorClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextChildAnchorClassProtocol
-
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
The
See moreTextIterProtocol
protocol exposes the methods and properties of an underlyingGtkTextIter
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextIter
. Alternatively, useTextIterRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextIterProtocol
-
The
See moreTextMarkClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextMarkClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextMarkClass
. Alternatively, useTextMarkClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextMarkClassProtocol
-
The
See moreTextTagClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextTagClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextTagClass
. Alternatively, useTextTagClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextTagClassProtocol
-
The
See moreTextTagTableClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextTagTableClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextTagTableClass
. Alternatively, useTextTagTableClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextTagTableClassProtocol
-
The
See moreTextViewAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextViewAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextViewAccessibleClass
. Alternatively, useTextViewAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextViewAccessibleClassProtocol
-
The
See moreTextViewClassProtocol
protocol exposes the methods and properties of an underlyingGtkTextViewClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextViewClass
. Alternatively, useTextViewClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextViewClassProtocol
-
The
See moreThemeEngineProtocol
protocol exposes the methods and properties of an underlyingGtkThemeEngine
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeThemeEngine
. Alternatively, useThemeEngineRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ThemeEngineProtocol
-
Base class for theming engines.
The
See moreThemingEngineClassProtocol
protocol exposes the methods and properties of an underlyingGtkThemingEngineClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeThemingEngineClass
. Alternatively, useThemingEngineClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ThemingEngineClassProtocol
-
The
See moreToggleActionClassProtocol
protocol exposes the methods and properties of an underlyingGtkToggleActionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleActionClass
. Alternatively, useToggleActionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleActionClassProtocol
-
GtkToggleActionEntry
structs are used withgtk_action_group_add_toggle_actions()
to construct toggle actions.The
See moreToggleActionEntryProtocol
protocol exposes the methods and properties of an underlyingGtkToggleActionEntry
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleActionEntry
. Alternatively, useToggleActionEntryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleActionEntryProtocol
-
The
See moreToggleButtonAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkToggleButtonAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleButtonAccessibleClass
. Alternatively, useToggleButtonAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleButtonAccessibleClassProtocol
-
The
See moreToggleButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkToggleButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleButtonClass
. Alternatively, useToggleButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleButtonClassProtocol
-
The
See moreToggleToolButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkToggleToolButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleToolButtonClass
. Alternatively, useToggleToolButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleToolButtonClassProtocol
-
The
See moreToolButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkToolButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolButtonClass
. Alternatively, useToolButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolButtonClassProtocol
-
The
See moreToolItemClassProtocol
protocol exposes the methods and properties of an underlyingGtkToolItemClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolItemClass
. Alternatively, useToolItemClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolItemClassProtocol
-
The
See moreToolItemGroupClassProtocol
protocol exposes the methods and properties of an underlyingGtkToolItemGroupClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolItemGroupClass
. Alternatively, useToolItemGroupClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolItemGroupClassProtocol
-
The
See moreToolPaletteClassProtocol
protocol exposes the methods and properties of an underlyingGtkToolPaletteClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolPaletteClass
. Alternatively, useToolPaletteClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolPaletteClassProtocol
-
Virtual function table for the
GtkToolShell
interface.The
See moreToolShellIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkToolShellIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolShellIface
. Alternatively, useToolShellIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolShellIfaceProtocol
-
The
See moreToolbarClassProtocol
protocol exposes the methods and properties of an underlyingGtkToolbarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolbarClass
. Alternatively, useToolbarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolbarClassProtocol
-
The
See moreToplevelAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkToplevelAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToplevelAccessibleClass
. Alternatively, useToplevelAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToplevelAccessibleClassProtocol
-
The
See moreTreeDragDestIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkTreeDragDestIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeDragDestIface
. Alternatively, useTreeDragDestIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeDragDestIfaceProtocol
-
The
See moreTreeDragSourceIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkTreeDragSourceIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeDragSourceIface
. Alternatively, useTreeDragSourceIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeDragSourceIfaceProtocol
-
The
GtkTreeIter
is the primary structure for accessing aGtkTreeModel
. Models are expected to put a unique integer in thestamp
member, and put model-specific data in the threeuser_data
members.The
See moreTreeIterProtocol
protocol exposes the methods and properties of an underlyingGtkTreeIter
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeIter
. Alternatively, useTreeIterRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeIterProtocol
-
The
See moreTreeModelFilterClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeModelFilterClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeModelFilterClass
. Alternatively, useTreeModelFilterClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeModelFilterClassProtocol
-
The
See moreTreeModelIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkTreeModelIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeModelIface
. Alternatively, useTreeModelIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeModelIfaceProtocol
-
The
See moreTreeModelSortClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeModelSortClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeModelSortClass
. Alternatively, useTreeModelSortClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeModelSortClassProtocol
-
The
See moreTreePathProtocol
protocol exposes the methods and properties of an underlyingGtkTreePath
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreePath
. Alternatively, useTreePathRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreePathProtocol
-
A GtkTreeRowReference tracks model changes so that it always refers to the same row (a
GtkTreePath
refers to a position, not a fixed row). Create a new GtkTreeRowReference withgtk_tree_row_reference_new()
.The
See moreTreeRowReferenceProtocol
protocol exposes the methods and properties of an underlyingGtkTreeRowReference
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeRowReference
. Alternatively, useTreeRowReferenceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeRowReferenceProtocol
-
The
See moreTreeSelectionClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeSelectionClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeSelectionClass
. Alternatively, useTreeSelectionClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeSelectionClassProtocol
-
The
See moreTreeSortableIfaceProtocol
protocol exposes the methods and properties of an underlyingGtkTreeSortableIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeSortableIface
. Alternatively, useTreeSortableIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeSortableIfaceProtocol
-
The
See moreTreeStoreClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeStoreClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeStoreClass
. Alternatively, useTreeStoreClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeStoreClassProtocol
-
The
See moreTreeViewAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeViewAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeViewAccessibleClass
. Alternatively, useTreeViewAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeViewAccessibleClassProtocol
-
The
See moreTreeViewClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeViewClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeViewClass
. Alternatively, useTreeViewClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeViewClassProtocol
-
The
See moreTreeViewColumnClassProtocol
protocol exposes the methods and properties of an underlyingGtkTreeViewColumnClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeViewColumnClass
. Alternatively, useTreeViewColumnClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeViewColumnClassProtocol
-
The
See moreUIManagerClassProtocol
protocol exposes the methods and properties of an underlyingGtkUIManagerClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeUIManagerClass
. Alternatively, useUIManagerClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol UIManagerClassProtocol
-
A
GtkTearoffMenuItem
is a specialGtkMenuItem
which is used to tear off and reattach its menu.When its menu is shown normally, the
GtkTearoffMenuItem
is drawn as a dotted line indicating that the menu can be torn off. Activating it causes its menu to be torn off and displayed in its own window as a tearoff menu.When its menu is shown as a tearoff menu, the
GtkTearoffMenuItem
is drawn as a dotted line which has a left pointing arrow graphic indicating that the tearoff menu can be reattached. Activating it will erase the tearoff menu window.>
GtkTearoffMenuItem
is deprecated and should not be used in newly > written code. Menus are not meant to be torn around.The
See moreTearoffMenuItemProtocol
protocol exposes the methods and properties of an underlyingGtkTearoffMenuItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTearoffMenuItem
. Alternatively, useTearoffMenuItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TearoffMenuItemProtocol : MenuItemProtocol
-
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
The
See moreTextBufferProtocol
protocol exposes the methods and properties of an underlyingGtkTextBuffer
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextBuffer
. Alternatively, useTextBufferRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextBufferProtocol : ObjectProtocol
-
The
See moreTextCellAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkTextCellAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextCellAccessible
. Alternatively, useTextCellAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextCellAccessibleProtocol : TextProtocol, RendererCellAccessibleProtocol
-
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.The
See moreTextChildAnchorProtocol
protocol exposes the methods and properties of an underlyingGtkTextChildAnchor
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextChildAnchor
. Alternatively, useTextChildAnchorRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextChildAnchorProtocol : ObjectProtocol
-
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
A
GtkTextMark
is like a bookmark in a text buffer; it preserves a position in the text. You can convert the mark to an iterator usinggtk_text_buffer_get_iter_at_mark()
. Unlike iterators, marks remain valid across buffer mutations, because their behavior is defined when text is inserted or deleted. When text containing a mark is deleted, the mark remains in the position originally occupied by the deleted text. When text is inserted at a mark, a mark with “left gravity” will be moved to the beginning of the newly-inserted text, and a mark with “right gravity” will be moved to the end.Note that “left” and “right” here refer to logical direction (left is the toward the start of the buffer); in some languages such as Hebrew the logically-leftmost text is not actually on the left when displayed.
Marks are reference counted, but the reference count only controls the validity of the memory; marks can be deleted from the buffer at any time with
gtk_text_buffer_delete_mark()
. Once deleted from the buffer, a mark is essentially useless.Marks optionally have names; these can be convenient to avoid passing the
GtkTextMark
object around.Marks are typically created using the
gtk_text_buffer_create_mark()
function.The
See moreTextMarkProtocol
protocol exposes the methods and properties of an underlyingGtkTextMark
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextMark
. Alternatively, useTextMarkRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextMarkProtocol : ObjectProtocol
-
You may wish to begin by reading the text widget conceptual overview 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 givenGtkTextBuffer
before using them with that buffer.gtk_text_buffer_create_tag()
is the best way to create tags. See “gtk3-demo” for numerous examples.For each property of
GtkTextTag
, there is a “set” property, e.g. “font-set” corresponds to “font”. These “set” properties reflect whether a property has been set or not. They are maintained by GTK+ and you should not set them independently.The
See moreTextTagProtocol
protocol exposes the methods and properties of an underlyingGtkTextTag
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextTag
. Alternatively, useTextTagRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextTagProtocol : ObjectProtocol
-
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
GtkTextTagTables as GtkBuildable
The GtkTextTagTable implementation of the GtkBuildable interface supports adding tags by specifying “tag” as the “type” attribute of a <child> element.
An example of a UI definition fragment specifying tags:
<object class="GtkTextTagTable"> <child type="tag"> <object class="GtkTextTag"/> </child> </object>
The
See moreTextTagTableProtocol
protocol exposes the methods and properties of an underlyingGtkTextTagTable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextTagTable
. Alternatively, useTextTagTableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextTagTableProtocol : ObjectProtocol, BuildableProtocol
-
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
CSS nodes
(plain Language Example):
textview.view ├── border.top ├── border.left ├── text │ ╰── [selection] ├── border.right ├── border.bottom ╰── [window.popup]
GtkTextView has a main css node with name textview and style class .view, and subnodes for each of the border windows, and the main text area, with names border and text, respectively. The border nodes each get one of the style classes .left, .right, .top or .bottom.
A node representing the selection will appear below the text node.
If a context menu is opened, the window node will appear as a subnode of the main node.
The
See moreTextViewProtocol
protocol exposes the methods and properties of an underlyingGtkTextView
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextView
. Alternatively, useTextViewRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextViewProtocol : ContainerProtocol, ScrollableProtocol
-
The
See moreTextViewAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkTextViewAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTextViewAccessible
. Alternatively, useTextViewAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TextViewAccessibleProtocol : EditableTextProtocol, StreamableContentProtocol, TextProtocol, ContainerAccessibleProtocol
-
GtkThemingEngine
was the object used for rendering themed content in GTK+ widgets. It used to allow overriding GTK+‘s default implementation of rendering functions by allowing engines to be loaded as modules.GtkThemingEngine
has been deprecated in GTK+ 3.14 and will be ignored for rendering. The advancements in CSS theming are good enough to allow themers to achieve their goals without the need to modify source code.The
See moreThemingEngineProtocol
protocol exposes the methods and properties of an underlyingGtkThemingEngine
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeThemingEngine
. Alternatively, useThemingEngineRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ThemingEngineProtocol : ObjectProtocol
-
A
GtkToggleAction
corresponds roughly to aGtkCheckMenuItem
. It has an “active” state specifying whether the action has been checked or not.The
See moreToggleActionProtocol
protocol exposes the methods and properties of an underlyingGtkToggleAction
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleAction
. Alternatively, useToggleActionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleActionProtocol : ActionProtocol
-
A
GtkToggleButton
is aGtkButton
which will remain “pressed-in” when clicked. Clicking again will cause the toggle button to return to its normal state.A toggle button is created by calling either
gtk_toggle_button_new()
orgtk_toggle_button_new_with_label()
. If using the former, it is advisable to pack a widget, (such as aGtkLabel
and/or aGtkImage
), into the toggle button’s container. (SeeGtkButton
for more information).The state of a
GtkToggleButton
can be set specifically usinggtk_toggle_button_set_active()
, and retrieved usinggtk_toggle_button_get_active()
.To simply switch the state of a toggle button, use
gtk_toggle_button_toggled()
.CSS nodes
GtkToggleButton has a single CSS node with name button. To differentiate it from a plain
GtkButton
, it gets the .toggle style class.Creating two
GtkToggleButton
widgets.(C Language Example):
static void output_state (GtkToggleButton *source, gpointer user_data) { printf ("Active: %d\n", gtk_toggle_button_get_active (source)); } void make_toggles (void) { GtkWidget *window, *toggle1, *toggle2; GtkWidget *box; const char *text; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); text = "Hi, I’m a toggle button."; toggle1 = gtk_toggle_button_new_with_label (text); // Makes this toggle button invisible gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), TRUE); g_signal_connect (toggle1, "toggled", G_CALLBACK (output_state), NULL); gtk_container_add (GTK_CONTAINER (box), toggle1); text = "Hi, I’m a toggle button."; toggle2 = gtk_toggle_button_new_with_label (text); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), FALSE); g_signal_connect (toggle2, "toggled", G_CALLBACK (output_state), NULL); gtk_container_add (GTK_CONTAINER (box), toggle2); gtk_container_add (GTK_CONTAINER (window), box); gtk_widget_show_all (window); }
The
See moreToggleButtonProtocol
protocol exposes the methods and properties of an underlyingGtkToggleButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleButton
. Alternatively, useToggleButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleButtonProtocol : ButtonProtocol
-
The
See moreToggleButtonAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkToggleButtonAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleButtonAccessible
. Alternatively, useToggleButtonAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleButtonAccessibleProtocol : ButtonAccessibleProtocol
-
A
GtkToggleToolButton
is aGtkToolItem
that contains a toggle button.Use
gtk_toggle_tool_button_new()
to create a new GtkToggleToolButton.CSS nodes
GtkToggleToolButton has a single CSS node with name togglebutton.
The
See moreToggleToolButtonProtocol
protocol exposes the methods and properties of an underlyingGtkToggleToolButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToggleToolButton
. Alternatively, useToggleToolButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToggleToolButtonProtocol : ToolButtonProtocol
-
GtkToolButtons
areGtkToolItems
containing buttons.Use
gtk_tool_button_new()
to create a newGtkToolButton
.The label of a
GtkToolButton
is determined by the propertiesGtkToolButton:label-widget
,GtkToolButton:label
, andGtkToolButton:stock-id
. IfGtkToolButton:label-widget
is non-nil
, then that widget is used as the label. Otherwise, ifGtkToolButton:label
is non-nil
, that string is used as the label. Otherwise, ifGtkToolButton:stock-id
is non-nil
, the label is determined by the stock item. Otherwise, the button does not have a label.The icon of a
GtkToolButton
is determined by the propertiesGtkToolButton:icon-widget
andGtkToolButton:stock-id
. IfGtkToolButton:icon-widget
is non-nil
, then that widget is used as the icon. Otherwise, ifGtkToolButton:stock-id
is non-nil
, the icon is determined by the stock item. Otherwise, the button does not have a icon.CSS nodes
GtkToolButton has a single CSS node with name toolbutton.
The
See moreToolButtonProtocol
protocol exposes the methods and properties of an underlyingGtkToolButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolButton
. Alternatively, useToolButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolButtonProtocol : ActionableProtocol, ToolItemProtocol
-
GtkToolItems
are widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, usegtk_tool_item_new()
. Usegtk_container_add()
to add a child widget to the tool item.For toolbar items that contain buttons, see the
GtkToolButton
,GtkToggleToolButton
andGtkRadioToolButton
classes.See the
GtkToolbar
class for a description of the toolbar widget, andGtkToolShell
for a description of the tool shell interface.The
See moreToolItemProtocol
protocol exposes the methods and properties of an underlyingGtkToolItem
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolItem
. Alternatively, useToolItemRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolItemProtocol : ActivatableProtocol, BinProtocol
-
A
GtkToolItemGroup
is used together withGtkToolPalette
to addGtkToolItems
to a palette like container with different categories and drag and drop support.CSS nodes
GtkToolItemGroup has a single CSS node named toolitemgroup.
The
See moreToolItemGroupProtocol
protocol exposes the methods and properties of an underlyingGtkToolItemGroup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolItemGroup
. Alternatively, useToolItemGroupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolItemGroupProtocol : ContainerProtocol, ToolShellProtocol
-
A
GtkToolPalette
allows you to addGtkToolItems
to a palette-like container with different categories and drag and drop support.A
GtkToolPalette
is created with a call togtk_tool_palette_new()
.GtkToolItems
cannot be added directly to aGtkToolPalette
- instead they are added to aGtkToolItemGroup
which can than be added to aGtkToolPalette
. To add aGtkToolItemGroup
to aGtkToolPalette
, usegtk_container_add()
.(C Language Example):
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 (NULL, _("_Open")); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
The easiest way to use drag and drop with
GtkToolPalette
is to callgtk_tool_palette_add_drag_dest()
with the desired drag sourcepalette
and the desired drag targetwidget
. Thengtk_tool_palette_get_drag_item()
can be used to get the dragged item in theGtkWidget::drag-data-received
signal handler of the drag target.(C Language Example):
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);
CSS nodes
GtkToolPalette has a single CSS node named toolpalette.
The
See moreToolPaletteProtocol
protocol exposes the methods and properties of an underlyingGtkToolPalette
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolPalette
. Alternatively, useToolPaletteRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolPaletteProtocol : ContainerProtocol, OrientableProtocol, ScrollableProtocol
-
A toolbar is created with a call to
gtk_toolbar_new()
.A toolbar can contain instances of a subclass of
GtkToolItem
. To add aGtkToolItem
to the a toolbar, usegtk_toolbar_insert()
. To remove an item from the toolbar usegtk_container_remove()
. To add a button to the toolbar, add an instance ofGtkToolButton
.Toolbar items can be visually grouped by adding instances of
GtkSeparatorToolItem
to the toolbar. If the GtkToolbar child property “expand” isTRUE
and the propertyGtkSeparatorToolItem:draw
is set toFALSE
, the effect is to force all following items to the end of the toolbar.By default, a toolbar can be shrunk, upon which it will add an arrow button to show an overflow menu offering access to any
GtkToolItem
child that has a proxy menu item. To disable this and request enough size for all children, callgtk_toolbar_set_show_arrow()
to setGtkToolbar:show-arrow
tofalse
.Creating a context menu for the toolbar can be done by connecting to the
GtkToolbar::popup-context-menu
signal.CSS nodes
GtkToolbar has a single CSS node with name toolbar.
The
See moreToolbarProtocol
protocol exposes the methods and properties of an underlyingGtkToolbar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToolbar
. Alternatively, useToolbarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToolbarProtocol : ContainerProtocol, OrientableProtocol, ToolShellProtocol
-
Basic tooltips can be realized simply by using
gtk_widget_set_tooltip_text()
orgtk_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:Set the
GtkWidget:has-tooltip
property totrue
, this will make GTK+ monitor the widget for motion and related events which are needed to determine when and where to show a tooltip.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 likegtk_tooltip_set_icon()
. There are functions for setting the tooltip’s markup, setting an image from a named icon, or even putting in a custom widget.
Return
true
from your query-tooltip handler. This causes the tooltip to be show. If you returnfalse
, it will not be shown.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:Set
GtkWidget:has-tooltip
and connect toGtkWidget::query-tooltip
as before. Usegtk_widget_set_tooltip_window()
to set aGtkWindow
created by you as tooltip window.In the
GtkWidget::query-tooltip
callback you can access your window usinggtk_widget_get_tooltip_window()
and manipulate as you wish. The semantics of the return value are exactly as before, returntrue
to show the window,false
to not show it.
The
See moreTooltipProtocol
protocol exposes the methods and properties of an underlyingGtkTooltip
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTooltip
. Alternatively, useTooltipRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TooltipProtocol : ObjectProtocol
-
The
See moreToplevelAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkToplevelAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeToplevelAccessible
. Alternatively, useToplevelAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ToplevelAccessibleProtocol : ObjectProtocol
-
A
GtkTreeModelFilter
is a tree model which wraps another tree model, and can do the following things: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.
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.
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.
The basic API is similar to
GtkTreeModelSort
. For an example on its usage, see the section onGtkTreeModelSort
.When using
GtkTreeModelFilter
, it is important to realize thatGtkTreeModelFilter
maintains an internal cache of all nodes which are visible in its clients. The cache is likely to be a subtree of the tree exposed by the child model.GtkTreeModelFilter
will not cache the entire child model when unnecessary to not compromise the caching mechanism that is exposed by the reference counting scheme. If the child model implements reference counting, unnecessary signals may not be emitted because of reference counting rule 3, see theGtkTreeModel
documentation. (Note that e.g.GtkTreeStore
does not implement reference counting and will always emit all signals, even when the receiving node is not visible).Because of this, limitations for possible visible functions do apply. In general, visible functions should only use data or properties from the node for which the visibility state must be determined, its siblings or its parents. Usually, having a dependency on the state of any child node is not possible, unless references are taken on these explicitly. When no such reference exists, no signals may be received for these child nodes (see reference couting rule number 3 in the
GtkTreeModel
section).Determining the visibility state of a given node based on the state of its child nodes is a frequently occurring use case. Therefore,
GtkTreeModelFilter
explicitly supports this. For example, when a node does not have any children, you might not want the node to be visible. As soon as the first row is added to the node’s child level (or the last row removed), the node’s visibility should be updated.This introduces a dependency from the node on its child nodes. In order to accommodate this,
GtkTreeModelFilter
must make sure the necessary signals are received from the child model. This is achieved by building, for all nodes which are exposed as visible nodes toGtkTreeModelFilter
‘s clients, the child level (if any) and take a reference on the first node in this level. Furthermore, for every row-inserted, row-changed or row-deleted signal (also these which were not handled because the node was not cached),GtkTreeModelFilter
will check if the visibility state of any parent node has changed.Beware, however, that this explicit support is limited to these two cases. For example, if you want a node to be visible only if two nodes in a child’s child level (2 levels deeper) are visible, you are on your own. In this case, either rely on
GtkTreeStore
to emit all signals because it does not implement reference counting, or for models that do implement reference counting, obtain references on these child levels yourself.The
See moreTreeModelFilterProtocol
protocol exposes the methods and properties of an underlyingGtkTreeModelFilter
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeModelFilter
. Alternatively, useTreeModelFilterRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeModelFilterProtocol : ObjectProtocol, TreeDragSourceProtocol, TreeModelProtocol
-
The
GtkTreeModelSort
is a model which implements theGtkTreeSortable
interface. It does not hold any data itself, but rather is created with a child model and proxies its data. It has identical column types to this child model, and the changes in the child are propagated. The primary purpose of this model is to provide a way to sort a different model without modifying it. Note that the sort function used byGtkTreeModelSort
is not guaranteed to be stable.The use of this is best demonstrated through an example. In the following sample code we create two
GtkTreeView
widgets each with a view of the same data. As the model is wrapped here by aGtkTreeModelSort
, the twoGtkTreeViews
can each sort their view of the data without affecting the other. By contrast, if we simply put the same model in each widget, then sorting the first would sort the second.Using a
GtkTreeModelSort
(C Language Example):
{ GtkTreeView *tree_view1; GtkTreeView *tree_view2; GtkTreeModel *sort_model1; GtkTreeModel *sort_model2; GtkTreeModel *child_model; // get the child model child_model = get_my_model (); // Create the first tree sort_model1 = gtk_tree_model_sort_new_with_model (child_model); tree_view1 = gtk_tree_view_new_with_model (sort_model1); // Create the second tree sort_model2 = gtk_tree_model_sort_new_with_model (child_model); tree_view2 = gtk_tree_view_new_with_model (sort_model2); // Now we can sort the two models independently gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model1), COLUMN_1, GTK_SORT_ASCENDING); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model2), COLUMN_1, GTK_SORT_DESCENDING); }
To demonstrate how to access the underlying child model from the sort model, the next example will be a callback for the
GtkTreeSelection
GtkTreeSelection::changed
signal. In this callback, we get a string from COLUMN_1 of the model. We then modify the string, find the same selected row on the child model, and change the row there.Accessing the child model of in a selection changed callback
(C Language Example):
void selection_changed (GtkTreeSelection *selection, gpointer data) { GtkTreeModel *sort_model = NULL; GtkTreeModel *child_model; GtkTreeIter sort_iter; GtkTreeIter child_iter; char *some_data = NULL; char *modified_data; // Get the current selected row and the model. if (! gtk_tree_selection_get_selected (selection, &sort_model, &sort_iter)) return; // Look up the current value on the selected row and get // a new value to change it to. gtk_tree_model_get (GTK_TREE_MODEL (sort_model), &sort_iter, COLUMN_1, &some_data, -1); modified_data = change_the_data (some_data); g_free (some_data); // Get an iterator on the child model, instead of the sort model. gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (sort_model), &child_iter, &sort_iter); // Get the child model and change the value of the row. In this // example, the child model is a GtkListStore. It could be any other // type of model, though. child_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model)); gtk_list_store_set (GTK_LIST_STORE (child_model), &child_iter, COLUMN_1, &modified_data, -1); g_free (modified_data); }
The
See moreTreeModelSortProtocol
protocol exposes the methods and properties of an underlyingGtkTreeModelSort
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeModelSort
. Alternatively, useTreeModelSortRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeModelSortProtocol : ObjectProtocol, TreeDragSourceProtocol, TreeSortableProtocol
-
The
GtkTreeSelection
object is a helper object to manage the selection for aGtkTreeView
widget. TheGtkTreeSelection
object is automatically created when a newGtkTreeView
widget is created, and cannot exist independently of this widget. The primary reason theGtkTreeSelection
objects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on theGtkTreeView
widget instead of a separate function.The
GtkTreeSelection
object is gotten from aGtkTreeView
by callinggtk_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 aGtkTreeSelection::changed
signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).The
See moreTreeSelectionProtocol
protocol exposes the methods and properties of an underlyingGtkTreeSelection
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeSelection
. Alternatively, useTreeSelectionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeSelectionProtocol : ObjectProtocol
-
The
GtkTreeStore
object is a list model for use with aGtkTreeView
widget. It implements theGtkTreeModel
interface, and consequentially, can use all of the methods available there. It also implements theGtkTreeSortable
interface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.GtkTreeStore as GtkBuildable
The GtkTreeStore implementation of the
GtkBuildable
interface allows to specify the model columns with a <columns> element that may contain multiple <column> elements, each specifying one model column. The “type” attribute specifies the data type for the column.An example of a UI Definition fragment for a tree store:
<object class="GtkTreeStore"> <columns> <column type="gchararray"/> <column type="gchararray"/> <column type="gint"/> </columns> </object>
The
See moreTreeStoreProtocol
protocol exposes the methods and properties of an underlyingGtkTreeStore
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeStore
. Alternatively, useTreeStoreRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeStoreProtocol : ObjectProtocol, BuildableProtocol, TreeDragDestProtocol, TreeDragSourceProtocol, TreeSortableProtocol
-
Widget that displays any object that implements the
GtkTreeModel
interface.Please refer to the tree widget conceptual overview 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:
Coordinate systems in GtkTreeView API:
Widget coordinates: Coordinates relative to the widget (usually
widget->window
).Bin window coordinates: Coordinates relative to the window that GtkTreeView renders to.
Tree coordinates: Coordinates relative to the entire scrollable area of GtkTreeView. These coordinates start at (0, 0) for row 0 of the tree.
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 lattergtk_tree_view_convert_bin_window_to_tree_coords()
(and vice versa).GtkTreeView as GtkBuildable
The GtkTreeView implementation of the GtkBuildable interface accepts
GtkTreeViewColumn
objects as <child> elements and exposes the internalGtkTreeSelection
in UI definitions.An example of a UI definition fragment with GtkTreeView:
<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>
CSS nodes
(plain Language Example):
treeview.view ├── header │ ├── <column header> ┊ ┊ │ ╰── <column header> │ ╰── [rubberband]
GtkTreeView has a main CSS node with name treeview and style class .view. It has a subnode with name header, which is the parent for all the column header widgets’ CSS nodes. For rubberband selection, a subnode with name rubberband is used.
The
See moreTreeViewProtocol
protocol exposes the methods and properties of an underlyingGtkTreeView
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeView
. Alternatively, useTreeViewRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeViewProtocol : ContainerProtocol, ScrollableProtocol
-
The
See moreTreeViewAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkTreeViewAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeViewAccessible
. Alternatively, useTreeViewAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeViewAccessibleProtocol : SelectionProtocol, TableProtocol, CellAccessibleParentProtocol, ContainerAccessibleProtocol
-
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 tree widget conceptual overview for an overview of all the objects and data types related to the tree widget and how they work together.
The
See moreTreeViewColumnProtocol
protocol exposes the methods and properties of an underlyingGtkTreeViewColumn
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeViewColumn
. Alternatively, useTreeViewColumnRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeViewColumnProtocol : InitiallyUnownedProtocol, BuildableProtocol, CellLayoutProtocol
-
> GtkUIManager is deprecated since GTK+ 3.10. To construct user interfaces > from XML definitions, you should use
GtkBuilder
,GMenuModel
, et al. To > work with actions, useGAction
,GtkActionable
et al. These newer classes > support richer functionality and integration with various desktop shells. > It should be possible to migrate most/all functionality from GtkUIManager.A
GtkUIManager
constructs a user interface (menus and toolbars) from one or more UI definitions, which reference actions from one or more action groups.UI Definitions #
The UI definitions are specified in an XML format which can be roughly described by the following DTD.
> Do not confuse the GtkUIManager UI Definitions described here with > the similarly named GtkBuilder UI Definitions.
<!ELEMENT menubar (menuitem|separator|placeholder|menu)* > <!ELEMENT menu (menuitem|separator|placeholder|menu)* > <!ELEMENT popup (menuitem|separator|placeholder|menu)* > <!ELEMENT toolbar (toolitem|separator|placeholder)* > <!ELEMENT placeholder (menuitem|toolitem|separator|placeholder|menu)* > <!ELEMENT menuitem EMPTY > <!ELEMENT toolitem (menu?) > <!ELEMENT separator EMPTY > <!ELEMENT accelerator EMPTY > <!ATTLIST menubar name #IMPLIED action #IMPLIED > <!ATTLIST toolbar name #IMPLIED action #IMPLIED > <!ATTLIST popup name #IMPLIED action #IMPLIED accelerators (true|false) #IMPLIED > <!ATTLIST placeholder name #IMPLIED action #IMPLIED > <!ATTLIST separator name #IMPLIED action #IMPLIED expand (true|false) #IMPLIED > <!ATTLIST menu name #IMPLIED action #REQUIRED position (top|bot) #IMPLIED > <!ATTLIST menuitem name #IMPLIED action #REQUIRED position (top|bot) #IMPLIED always-show-image (true|false) #IMPLIED > <!ATTLIST toolitem name #IMPLIED action #REQUIRED position (top|bot) #IMPLIED > <!ATTLIST accelerator name #IMPLIED action #REQUIRED >
There are some additional restrictions beyond those specified in the DTD, e.g. every toolitem must have a toolbar in its anchestry and every menuitem must have a menubar or popup in its anchestry. Since a
GMarkupParser
is used to parse the UI description, it must not only be valid XML, but valid markup.If a name is not specified, it defaults to the action. If an action is not specified either, the element name is used. The name and action attributes must not contain “/” characters after parsing (since that would mess up path lookup) and must be usable as XML attributes when enclosed in doublequotes, thus they must not “"” characters or references to the “ entity.
A UI definition
<ui> <menubar> <menu name="FileMenu" action="FileMenuAction"> <menuitem name="New" action="New2Action" /> <placeholder name="FileMenuAdditions" /> </menu> <menu name="JustifyMenu" action="JustifyMenuAction"> <menuitem name="Left" action="justify-left"/> <menuitem name="Centre" action="justify-center"/> <menuitem name="Right" action="justify-right"/> <menuitem name="Fill" action="justify-fill"/> </menu> </menubar> <toolbar action="toolbar1"> <placeholder name="JustifyToolItems"> <separator/> <toolitem name="Left" action="justify-left"/> <toolitem name="Centre" action="justify-center"/> <toolitem name="Right" action="justify-right"/> <toolitem name="Fill" action="justify-fill"/> <separator/> </placeholder> </toolbar> </ui>
The constructed widget hierarchy is very similar to the element tree of the XML, with the exception that placeholders are merged into their parents. The correspondence of XML elements to widgets should be almost obvious:
- menubar
a
GtkMenuBar
- toolbar
a
GtkToolbar
- popup
a toplevel
GtkMenu
- menu
a
GtkMenu
attached to a menuitem- menuitem
a
GtkMenuItem
subclass, the exact type depends on the action- toolitem
a
GtkToolItem
subclass, the exact type depends on the action. Note that toolitem elements may contain a menu element, but only if their associated action specifies aGtkMenuToolButton
as proxy.- separator
a
GtkSeparatorMenuItem
orGtkSeparatorToolItem
- accelerator
a keyboard accelerator
The “position” attribute determines where a constructed widget is positioned wrt. to its siblings in the partially constructed tree. If it is “top”, the widget is prepended, otherwise it is appended.
UI Merging #
The most remarkable feature of
GtkUIManager
is that it can overlay a set of menuitems and toolitems over another one, and demerge them later.Merging is done based on the names of the XML elements. Each element is identified by a path which consists of the names of its anchestors, separated by slashes. For example, the menuitem named “Left” in the example above has the path
/ui/menubar/JustifyMenu/Left
and the toolitem with the same name has path/ui/toolbar1/JustifyToolItems/Left
.Accelerators
Every action has an accelerator path. Accelerators are installed together with menuitem proxies, but they can also be explicitly added with <accelerator> elements in the UI definition. This makes it possible to have accelerators for actions even if they have no visible proxies.
Smart Separators #
The separators created by
GtkUIManager
are “smart”, i.e. they do not show up in the UI unless they end up between two visible menu or tool items. Separators which are located at the very beginning or end of the menu or toolbar containing them, or multiple separators next to each other, are hidden. This is a useful feature, since the merging of UI elements from multiple sources can make it hard or impossible to determine in advance whether a separator will end up in such an unfortunate position.For separators in toolbars, you can set
expand="true"
to turn them from a small, visible separator to an expanding, invisible one. Toolitems following an expanding separator are effectively right-aligned.Empty Menus
Submenus pose similar problems to separators inconnection with merging. It is impossible to know in advance whether they will end up empty after merging.
GtkUIManager
offers two ways to treat empty submenus:make them disappear by hiding the menu item they’re attached to
add an insensitive “Empty” item
The behaviour is chosen based on the “hide_if_empty” property of the action to which the submenu is associated.
GtkUIManager as GtkBuildable #
The GtkUIManager implementation of the GtkBuildable interface accepts GtkActionGroup objects as <child> elements in UI definitions.
A GtkUIManager UI definition as described above can be embedded in an GtkUIManager <object> element in a GtkBuilder UI definition.
The widgets that are constructed by a GtkUIManager can be embedded in other parts of the constructed user interface with the help of the “constructor” attribute. See the example below.
An embedded GtkUIManager UI definition
<object class="GtkUIManager" id="uiman"> <child> <object class="GtkActionGroup" id="actiongroup"> <child> <object class="GtkAction" id="file"> <property name="label">_File</property> </object> </child> </object> </child> <ui> <menubar name="menubar1"> <menu action="file"> </menu> </menubar> </ui> </object> <object class="GtkWindow" id="main-window"> <child> <object class="GtkMenuBar" id="menubar1" constructor="uiman"/> </child> </object>
The
See moreUIManagerProtocol
protocol exposes the methods and properties of an underlyingGtkUIManager
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeUIManager
. Alternatively, useUIManagerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol UIManagerProtocol : ObjectProtocol, BuildableProtocol
-
The
See moreTreeDragDestProtocol
protocol exposes the methods and properties of an underlyingGtkTreeDragDest
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeDragDest
. Alternatively, useTreeDragDestRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeDragDestProtocol
-
The
See moreTreeDragSourceProtocol
protocol exposes the methods and properties of an underlyingGtkTreeDragSource
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeDragSource
. Alternatively, useTreeDragSourceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeDragSourceProtocol
-
The
GtkTreeModel
interface defines a generic tree interface for use by theGtkTreeView
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 aGtkTreeView
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 — the
GtkTreeStore
and theGtkListStore
. 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-struct
and theGtkTreeIter-struct
(“iter” is short for iterator). Most of the interface consists of operations on aGtkTreeIter-struct
.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 path0
refers to the root node and the path2:4
refers to the fifth child of the third node.By contrast, a
GtkTreeIter-struct
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 callinggtk_tree_model_get_iter()
. These iterators are the primary way of accessing a model and are similar to the iterators used byGtkTextBuffer
. 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. TheGtkTreeModelSort
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
andGtkListStore
). 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, theGTK_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
3:2:5
. While the first method shown is easier, the second is much more common, as you often get paths from callbacks.Acquiring a
GtkTreeIter-struct
(C Language Example):
// Three ways of getting the iter pointing to the location GtkTreePath *path; GtkTreeIter iter; GtkTreeIter parent_iter; // get the iterator from a string gtk_tree_model_get_iter_from_string (model, &iter, "3:2:5"); // get the iterator from a path path = gtk_tree_path_new_from_string ("3:2:5"); gtk_tree_model_get_iter (model, &iter, path); gtk_tree_path_free (path); // walk the tree to find the iterator gtk_tree_model_iter_nth_child (model, &iter, NULL, 3); parent_iter = iter; gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 2); parent_iter = iter; gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 5);
This second example shows a quick way of iterating through a list and getting a string and an integer from each row. The
populate_model()
function used below is not shown, as it is specific to theGtkListStore
. For information on how to write such a function, see theGtkListStore
documentation.Reading data from a
GtkTreeModel
(C Language Example):
enum { STRING_COLUMN, INT_COLUMN, N_COLUMNS }; ... GtkTreeModel *list_store; GtkTreeIter iter; gboolean valid; gint row_count = 0; // make a new list_store list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT); // Fill the list store with data populate_model (list_store); // Get the first iter in the list, check it is valid and walk // through the list, reading each row. valid = gtk_tree_model_get_iter_first (list_store, &iter); while (valid) { gchar *str_data; gint int_data; // Make sure you terminate calls to gtk_tree_model_get() with a “-1” value gtk_tree_model_get (list_store, &iter, STRING_COLUMN, &str_data, INT_COLUMN, &int_data, -1); // Do something with the data g_print ("Row %d: (%s,%d)\n", row_count, str_data, int_data); g_free (str_data); valid = gtk_tree_model_iter_next (list_store, &iter); row_count++; }
The
GtkTreeModel
interface contains two methods for reference counting:gtk_tree_model_ref_node()
andgtk_tree_model_unref_node()
. These two methods are optional to implement. The reference counting is meant as a way for views to let models know when nodes are being displayed.GtkTreeView
will take a reference on a node when it is visible, which means the node is either in the toplevel or expanded. Being displayed does not mean that the node is currently directly visible to the user in the viewport. Based on this reference counting scheme a caching model, for example, can decide whether or not to cache a node based on the reference count. A file-system based model would not want to keep the entire file hierarchy in memory, but just the folders that are currently expanded in every current view.When working with reference counting, the following rules must be taken into account:
Never take a reference on a node without owning a reference on its parent. This means that all parent nodes of a referenced node must be referenced as well.
Outstanding references on a deleted node are not released. This is not possible because the node has already been deleted by the time the row-deleted signal is received.
Models are not obligated to emit a signal on rows of which none of its siblings are referenced. To phrase this differently, signals are only required for levels in which nodes are referenced. For the root level however, signals must be emitted at all times (however the root level is always referenced when any view is attached).
The
See moreTreeModelProtocol
protocol exposes the methods and properties of an underlyingGtkTreeModel
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeModel
. Alternatively, useTreeModelRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeModelProtocol
-
GtkTreeSortable
is an interface to be implemented by tree models which support sorting. TheGtkTreeView
uses the methods provided by this interface to sort the model.The
See moreTreeSortableProtocol
protocol exposes the methods and properties of an underlyingGtkTreeSortable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTreeSortable
. Alternatively, useTreeSortableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TreeSortableProtocol : TreeModelProtocol
-
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 ofGtkVBox
children.All children are allocated the same width.
GtkVBox has been deprecated. You can use
GtkBox
with aGtkOrientable:orientation
set toGTK_ORIENTATION_VERTICAL
instead when callinggtk_box_new()
, which is a very quick and easy change.If you have derived your own classes from GtkVBox, you can change the inheritance to derive directly from
GtkBox
, and set theGtkOrientable:orientation
property toGTK_ORIENTATION_VERTICAL
in your instance init function, with a call like:(C Language Example):
gtk_orientable_set_orientation (GTK_ORIENTABLE (object), GTK_ORIENTATION_VERTICAL);
If you have a grid-like layout composed of nested boxes, and you don’t need first-child or last-child styling, the recommendation is to switch to
GtkGrid
. For more information about migrating toGtkGrid
, see Migrating from other containers to GtkGrid.The
See moreVBoxProtocol
protocol exposes the methods and properties of an underlyingGtkVBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVBox
. Alternatively, useVBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VBoxProtocol : BoxProtocol
-
The
See moreVButtonBoxProtocol
protocol exposes the methods and properties of an underlyingGtkVButtonBox
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVButtonBox
. Alternatively, useVButtonBoxRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VButtonBoxProtocol : ButtonBoxProtocol
-
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.GtkVPaned has been deprecated, use
GtkPaned
instead.The
See moreVPanedProtocol
protocol exposes the methods and properties of an underlyingGtkVPaned
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVPaned
. Alternatively, useVPanedRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VPanedProtocol : PanedProtocol
-
The
GtkVScale
widget is used to allow the user to select a value using a vertical slider. To create one, usegtk_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.GtkVScale has been deprecated, use
GtkScale
instead.The
See moreVScaleProtocol
protocol exposes the methods and properties of an underlyingGtkVScale
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVScale
. Alternatively, useVScaleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VScaleProtocol : ScaleProtocol
-
The
GtkVScrollbar
widget is a widget arranged vertically creating a scrollbar. SeeGtkScrollbar
for details on scrollbars.GtkAdjustment
pointers may be added to handle the adjustment of the scrollbar or it may be leftnil
in which case one will be created for you. SeeGtkScrollbar
for a description of what the fields in an adjustment represent for a scrollbar.GtkVScrollbar has been deprecated, use
GtkScrollbar
instead.The
See moreVScrollbarProtocol
protocol exposes the methods and properties of an underlyingGtkVScrollbar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVScrollbar
. Alternatively, useVScrollbarRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VScrollbarProtocol : ScrollbarProtocol
-
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.GtkVSeparator has been deprecated, use
GtkSeparator
instead.The
See moreVSeparatorProtocol
protocol exposes the methods and properties of an underlyingGtkVSeparator
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVSeparator
. Alternatively, useVSeparatorRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VSeparatorProtocol : SeparatorProtocol
-
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 asGtkGrid
,GtkBox
, and so on.If a widget has native scrolling abilities, such as
GtkTextView
,GtkTreeView
orGtkIconView
, it can be added to aGtkScrolledWindow
withgtk_container_add()
. If a widget does not, you must first add the widget to aGtkViewport
, then add the viewport to the scrolled window.gtk_container_add()
does this automatically if a child that does not implementGtkScrollable
is added to aGtkScrolledWindow
, 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.
CSS nodes
GtkViewport has a single CSS node with name viewport.
The
See moreViewportProtocol
protocol exposes the methods and properties of an underlyingGtkViewport
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeViewport
. Alternatively, useViewportRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ViewportProtocol : BinProtocol, ScrollableProtocol
-
GtkVolumeButton
is a subclass ofGtkScaleButton
that has been tailored for use as a volume control widget with suitable icons, tooltips and accessible labels.The
See moreVolumeButtonProtocol
protocol exposes the methods and properties of an underlyingGtkVolumeButton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVolumeButton
. Alternatively, useVolumeButtonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VolumeButtonProtocol : ScaleButtonProtocol
-
The
See moreVBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkVBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVBoxClass
. Alternatively, useVBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VBoxClassProtocol
-
The
See moreVButtonBoxClassProtocol
protocol exposes the methods and properties of an underlyingGtkVButtonBoxClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVButtonBoxClass
. Alternatively, useVButtonBoxClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VButtonBoxClassProtocol
-
The
See moreVPanedClassProtocol
protocol exposes the methods and properties of an underlyingGtkVPanedClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVPanedClass
. Alternatively, useVPanedClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VPanedClassProtocol
-
The
See moreVScaleClassProtocol
protocol exposes the methods and properties of an underlyingGtkVScaleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVScaleClass
. Alternatively, useVScaleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VScaleClassProtocol
-
The
See moreVScrollbarClassProtocol
protocol exposes the methods and properties of an underlyingGtkVScrollbarClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVScrollbarClass
. Alternatively, useVScrollbarClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VScrollbarClassProtocol
-
The
See moreVSeparatorClassProtocol
protocol exposes the methods and properties of an underlyingGtkVSeparatorClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVSeparatorClass
. Alternatively, useVSeparatorClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VSeparatorClassProtocol
-
The
See moreViewportClassProtocol
protocol exposes the methods and properties of an underlyingGtkViewportClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeViewportClass
. Alternatively, useViewportClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ViewportClassProtocol
-
The
See moreVolumeButtonClassProtocol
protocol exposes the methods and properties of an underlyingGtkVolumeButtonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeVolumeButtonClass
. Alternatively, useVolumeButtonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol VolumeButtonClassProtocol
-
The
See moreWidgetAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkWidgetAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWidgetAccessibleClass
. Alternatively, useWidgetAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WidgetAccessibleClassProtocol
-
The
See moreWidgetAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkWidgetAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWidgetAccessible
. Alternatively, useWidgetAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WidgetAccessibleProtocol : ComponentProtocol, AccessibleProtocol
-
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,…).
GtkWindow as GtkBuildable
The GtkWindow implementation of the
GtkBuildable
interface supports a custom <accel-groups> element, which supports any number of <group> elements representing theGtkAccelGroup
objects you want to add to your window (synonymous withgtk_window_add_accel_group()
.It also supports the <initial-focus> element, whose name property names the widget to receive the focus when the window is mapped.
An example of a UI definition fragment with accel groups:
<object class="GtkWindow"> <accel-groups> <group name="accelgroup1"/> </accel-groups> <initial-focus name="thunderclap"/> </object> ... <object class="GtkAccelGroup" id="accelgroup1"/>
The GtkWindow implementation of the
GtkBuildable
interface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.CSS nodes
(plain Language Example):
window.background ├── decoration ├── <titlebar child>.titlebar [.default-decoration] ╰── <child>
GtkWindow has a main CSS node with name window and style class .background, and a subnode with name decoration.
Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). GtkWindow also represents window states with the following style classes on the main node: .tiled, .maximized, .fullscreen. Specialized types of window often add their own discriminating style classes, such as .popup or .tooltip.
GtkWindow adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.
The
See moreWindowProtocol
protocol exposes the methods and properties of an underlyingGtkWindow
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindow
. Alternatively, useWindowRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowProtocol : BinProtocol
-
The
See moreWindowAccessibleProtocol
protocol exposes the methods and properties of an underlyingGtkWindowAccessible
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindowAccessible
. Alternatively, useWindowAccessibleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowAccessibleProtocol : WindowProtocol, ContainerAccessibleProtocol
-
A
GtkWindowGroup
restricts the effect of grabs to windows in the same group, thereby making window groups almost behave like separate applications.A window can be a member in at most one window group at a time. Windows that have not been explicitly assigned to a group are implicitly treated like windows of the default window group.
GtkWindowGroup objects are referenced by each window in the group, so once you have added all windows to a GtkWindowGroup, you can drop the initial reference to the window group with
g_object_unref()
. If the windows in the window group are subsequently destroyed, then they will be removed from the window group and drop their references on the window group; when all window have been removed, the window group will be freed.The
See moreWindowGroupProtocol
protocol exposes the methods and properties of an underlyingGtkWindowGroup
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindowGroup
. Alternatively, useWindowGroupRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowGroupProtocol : ObjectProtocol
-
The
See moreWidgetClassProtocol
protocol exposes the methods and properties of an underlyingGtkWidgetClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWidgetClass
. Alternatively, useWidgetClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WidgetClassProtocol
-
The
See moreWidgetClassPrivateProtocol
protocol exposes the methods and properties of an underlyingGtkWidgetClassPrivate
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWidgetClassPrivate
. Alternatively, useWidgetClassPrivateRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WidgetClassPrivateProtocol
-
GtkWidgetPath is a boxed type that represents a widget hierarchy from the topmost widget, typically a toplevel, to any child. This widget path abstraction is used in
GtkStyleContext
on behalf of the real widget in order to query style information.If you are using GTK+ widgets, you probably will not need to use this API directly, as there is
gtk_widget_get_path()
, and the style context returned bygtk_widget_get_style_context()
will be automatically updated on widget hierarchy changes.The widget path generation is generally simple:
Defining a button within a window
(C Language Example):
{ GtkWidgetPath *path; path = gtk_widget_path_new (); gtk_widget_path_append_type (path, GTK_TYPE_WINDOW); gtk_widget_path_append_type (path, GTK_TYPE_BUTTON); }
Although more complex information, such as widget names, or different classes (property that may be used by other widget types) and intermediate regions may be included:
Defining the first tab widget in a notebook
(C Language Example):
{ GtkWidgetPath *path; guint pos; path = gtk_widget_path_new (); pos = gtk_widget_path_append_type (path, GTK_TYPE_NOTEBOOK); gtk_widget_path_iter_add_region (path, pos, "tab", GTK_REGION_EVEN | GTK_REGION_FIRST); pos = gtk_widget_path_append_type (path, GTK_TYPE_LABEL); gtk_widget_path_iter_set_name (path, pos, "first tab label"); }
All this information will be used to match the style information that applies to the described widget.
The
See moreWidgetPathProtocol
protocol exposes the methods and properties of an underlyingGtkWidgetPath
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWidgetPath
. Alternatively, useWidgetPathRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WidgetPathProtocol
-
The
See moreWindowAccessibleClassProtocol
protocol exposes the methods and properties of an underlyingGtkWindowAccessibleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindowAccessibleClass
. Alternatively, useWindowAccessibleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowAccessibleClassProtocol
-
The
See moreWindowClassProtocol
protocol exposes the methods and properties of an underlyingGtkWindowClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindowClass
. Alternatively, useWindowClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowClassProtocol
-
The
See moreWindowGeometryInfoProtocol
protocol exposes the methods and properties of an underlyingGtkWindowGeometryInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindowGeometryInfo
. Alternatively, useWindowGeometryInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowGeometryInfoProtocol
-
The
See moreWindowGroupClassProtocol
protocol exposes the methods and properties of an underlyingGtkWindowGroupClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWindowGroupClass
. Alternatively, useWindowGroupClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WindowGroupClassProtocol
-
Abstract interface type for the D-Bus interface <link linkend=“gdbus-interface-org-Gtk-MountOperationHandler.top_of_page”>org.Gtk.MountOperationHandler</link>.
The
See more_MountOperationHandlerProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandler
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandler
. Alternatively, use_MountOperationHandlerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerProtocol
-
Virtual table for the D-Bus interface <link linkend=“gdbus-interface-org-Gtk-MountOperationHandler.top_of_page”>org.Gtk.MountOperationHandler</link>.
The
See more_MountOperationHandlerIfaceProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerIface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerIface
. Alternatively, use_MountOperationHandlerIfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerIfaceProtocol
-
The
_GtkMountOperationHandlerProxy
structure contains only private data and should only be accessed using the provided API.The
See more_MountOperationHandlerProxyProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerProxy
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerProxy
. Alternatively, use_MountOperationHandlerProxyRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerProxyProtocol
-
Class structure for
_GtkMountOperationHandlerProxy
.The
See more_MountOperationHandlerProxyClassProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerProxyClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerProxyClass
. Alternatively, use_MountOperationHandlerProxyClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerProxyClassProtocol
-
The
See more_MountOperationHandlerProxyPrivateProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerProxyPrivate
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerProxyPrivate
. Alternatively, use_MountOperationHandlerProxyPrivateRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerProxyPrivateProtocol
-
The
_GtkMountOperationHandlerSkeleton
structure contains only private data and should only be accessed using the provided API.The
See more_MountOperationHandlerSkeletonProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerSkeleton
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerSkeleton
. Alternatively, use_MountOperationHandlerSkeletonRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerSkeletonProtocol
-
Class structure for
_GtkMountOperationHandlerSkeleton
.The
See more_MountOperationHandlerSkeletonClassProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerSkeletonClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerSkeletonClass
. Alternatively, use_MountOperationHandlerSkeletonClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerSkeletonClassProtocol
-
The
See more_MountOperationHandlerSkeletonPrivateProtocol
protocol exposes the methods and properties of an underlying_GtkMountOperationHandlerSkeletonPrivate
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_MountOperationHandlerSkeletonPrivate
. Alternatively, use_MountOperationHandlerSkeletonPrivateRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _MountOperationHandlerSkeletonPrivateProtocol