Expand description
§Rust GTK 3 bindings
Rust bindings and wrappers for GTK 3, part of gtk3-rs, a multi-platform GUI toolkit. It is a part of gtk-rs.
GTK 3.22.30 is the lowest supported version for the underlying library.
§Minimum supported Rust version
Currently, the minimum supported Rust version is 1.70.0.
§Building
gtk expects GTK, GLib and Cairo development files to be installed on your system. See the GTK installation page.
§Using
We recommend using crates from crates.io, as demonstrated here.
If you want to track the bleeding edge, use the git dependency instead:
[dependencies]
gtk = { git = "https://github.com/gtk-rs/gtk3-rs.git" }Avoid mixing versioned and git crates like this:
# This will not compile
[dependencies]
gtk = "0.13"
gtk = { git = "https://github.com/gtk-rs/gtk3-rs.git" }§“Hello, World!” example program
//!
GTK needs to be initialized before use by calling init. Creating an
Application will call init for you.
use gtk::prelude::*;
use gtk::{Application, ApplicationWindow};
fn main() {
let app = Application::builder()
.application_id("org.example.HelloWorld")
.build();
app.connect_activate(|app| {
// We create the main window.
let win = ApplicationWindow::builder()
.application(app)
.default_width(320)
.default_height(200)
.title("Hello, World!")
.build();
// Don't forget to make all widgets visible.
win.show_all();
});
app.run();
}§The main loop
In a typical GTK application you set up the UI, assign signal handlers and run the main event loop.
use gtk::prelude::*;
use gtk::{Application, ApplicationWindow, Button};
fn main() {
let application = Application::builder()
.application_id("com.example.FirstGtkApp")
.build();
application.connect_activate(|app| {
let window = ApplicationWindow::builder()
.application(app)
.title("First GTK Program")
.default_width(350)
.default_height(70)
.build();
let button = Button::with_label("Click me!");
button.connect_clicked(|_| {
eprintln!("Clicked!");
});
window.add(&button);
window.show_all();
});
application.run();
}§Threads
GTK is not thread-safe. Accordingly, none of this crate’s structs implement
Send or Sync.
The thread where init was called is considered the main thread. OS X has
its own notion of the main thread and init must be called on that thread.
After successful initialization, calling any gtk or gdk functions
(including init) from other threads will panic.
Any thread can schedule a closure to be run by the main loop on the main
thread via glib::idle_add or glib::timeout_add. While
working with GTK you might need the glib::idle_add_local
or glib::timeout_add_local version without the
Send bound. Those may only be called from the main thread.
§Panics
The gtk and gdk crates have some run-time safety and contract checks.
-
Any constructor or free function will panic if called before
initor on a non-main thread. -
Any
&stror&Pathparameter with an interior null (\0) character will cause a panic. -
Some functions will panic if supplied out-of-range integer parameters. All such cases will be documented individually but they are not yet.
-
A panic in a closure that handles signals or in any other closure passed to a
gtkfunction will abort the process.
§Features
§Library versions
By default this crate provides only GTK 3.22.30 APIs. You can access additional
functionality by selecting one of the v3_24, etc. features.
Cargo.toml example:
[dependencies.gtk]
version = "0.x.y"
features = ["v3_24"]Take care when choosing the version to target: some of your users might not have easy access to the latest ones. The higher the version, the fewer users will have it installed.
§Documentation
Most of this documentation is generated from the C API.
Until all parts of the documentation have been reviewed there will be incongruities with the actual Rust API.
Generate the docs:
> RUSTFLAGS="--cfg docsrs" cargo doc(if the installed GTK+ version is lower than 3.16, adjust the feature name accordingly).
§Contribute
Contributor you’re welcome!
See the general bindings documentation.
Most of the bindings (src/auto) are generated by gir using this configuration file. After editing Gir.toml the sources can be regenerated with
> make girWhen opening a PR please put the changes to the src/auto directory in a separate commit.
You may also wish to run cargo clippy -- -D warnings and check that you’re clean because
otherwise you may be surprised when CI fails.
§See Also
But also:
§License
gtk is available under the MIT License, please refer to it.
Re-exports§
pub use ffi;pub use atk;pub use cairo;pub use gdk;pub use gdk_pixbuf;pub use gio;pub use glib;pub use pango;
Modules§
- builders
- Builder pattern types.
- prelude
- Traits and essential types intended for blanket imports.
- subclass
- xlib
Structs§
- About
Dialog - The GtkAboutDialog offers a simple way to display information about
a program like its logo, name, copyright, website and license. It is
also possible to give credits to the authors, documenters, translators
and artists who have worked on the program. An about dialog is typically
opened when the user selects the
Aboutoption from theHelpmenu. All parts of the dialog are optional. - Accel
Flags - Accelerator flags used with
AccelGroupExtManual::connect_accel_group(). - Accel
Group - A
AccelGrouprepresents a group of keyboard accelerators, typically attached to a toplevelWindow(withGtkWindowExt::add_accel_group()). Usually you won’t need to create aAccelGroupdirectly; instead, when usingGtkUIManager, GTK+ automatically sets up the accelerators for your menus in the ui manager’sAccelGroup. - Accel
Label - The
AccelLabelwidget is a subclass ofLabelthat 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. - Action
Bar - GtkActionBar is designed to present contextual actions. It is expected to be displayed below the content and expand horizontally to fill the area.
- Actionable
- This interface provides a convenient way of associating widgets with
actions on a
ApplicationWindoworApplication. - Adjustment
- The
Adjustmentobject 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, includingSpinButton,Viewport, andRange(which is a base class forScrollbarandScale). - Allocation
- Defines the position and size of a rectangle. It is identical to
cairo_rectangle_int_t. - AppChooser
AppChooseris 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 areAppChooserWidget,AppChooserDialogandAppChooserButton.- AppChooser
Button - The
AppChooserButtonis a widget that lets the user select an application. It implements theAppChooserinterface. - AppChooser
Dialog AppChooserDialogshows aAppChooserWidgetinside aDialog.- AppChooser
Widget AppChooserWidgetis a widget for selecting applications. It is the main building block forAppChooserDialog. 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.- Application
Applicationis a class that handles many important aspects of a GTK+ application in a convenient fashion, without enforcing a one-size-fits-all application model.- Application
Inhibit Flags - Types of user actions that may be blocked by
GtkApplicationExt::inhibit(). - Application
Window ApplicationWindowis aWindowsubclass that offers some extra functionality for better integration withApplicationfeatures. Notably, it can handle both the application menu as well as the menubar. SeeGtkApplicationExt::set_app_menu()andGtkApplicationExt::set_menubar().- Aspect
Frame - The
AspectFrameis 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.AspectFramederives fromFrame, so it can draw a label and a frame around the child. The frame will be “shrink-wrapped” to the size of the child. - Assistant
- A
Assistantis 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. - Bin
- The
Binwidget 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. - Border
- A struct that specifies a border around a rectangular area that can be of different width on each side.
- Box
- The GtkBox widget arranges child widgets into a single row or column,
depending upon the value of its
orientationproperty. Within the other dimension, all children are allocated the same size. Of course, thehalignandvalignproperties can be used on the children to influence their allocation. - Buildable
- GtkBuildable allows objects to extend and customize their deserialization from [GtkBuilder UI descriptions][BUILDER-UI]. The interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects.
- Builder
- 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(),from_resource()orfrom_string(). - Button
- The
Buttonwidget 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. - Button
Box - Properties
- Calendar
Calendaris a widget that displays a Gregorian calendar, one month at a time. It can be created withnew().- Calendar
Display Options - These options can be used to influence the display and behaviour of a
Calendar. - Cell
Area - The
CellAreais an abstract class forCellLayoutwidgets (also referred to as “layouting widgets”) to interface with an arbitrary number ofGtkCellRenderersand interact with the user for a givenTreeModelrow. - Cell
Area Box - The
CellAreaBoxrenders cell renderers into a row or a column depending on itsOrientation. - Cell
Area Context - The
CellAreaContextobject is created by a givenCellAreaimplementation via itsGtkCellAreaClass.create_context()virtual method and is used to store cell sizes and alignments for a series ofTreeModelrows that are requested and rendered in the same context. - Cell
Editable - The
CellEditableinterface must be implemented for widgets to be usable to edit the contents of aTreeViewcell. It provides a way to specify how temporary widgets should be configured for editing, get the new value, etc. - Cell
Layout CellLayoutis an interface to be implemented by all objects which want to provide aTreeViewColumnlike API for packing cells, setting attributes and data funcs.- Cell
Renderer - The
CellRendereris a base class of a set of objects used for rendering a cell to acairo::Context. These objects are used primarily by theTreeViewwidget, though they aren’t tied to them in any specific way. It is worth noting thatCellRendereris not aWidgetand cannot be treated as such. - Cell
Renderer Accel CellRendererAcceldisplays 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.- Cell
Renderer Combo CellRendererComborenders text in a cell likeCellRendererTextfrom which it is derived. But whileCellRendererTextoffers a simple entry to edit the text,CellRendererCombooffers aComboBoxwidget to edit the text. The values to display in the combo box are taken from the tree model specified in themodelproperty.- Cell
Renderer Pixbuf - A
CellRendererPixbufcan be used to render an image in a cell. It allows to render either a givengdk_pixbuf::Pixbuf(set via thepixbufproperty) or a named icon (set via theicon-nameproperty). - Cell
Renderer Progress CellRendererProgressrenders a numeric value as a progress par in a cell. Additionally, it can display a text on top of the progress bar.- Cell
Renderer Spin CellRendererSpinrenders text in a cell likeCellRendererTextfrom which it is derived. But whileCellRendererTextoffers a simple entry to edit the text,CellRendererSpinoffers aSpinButtonwidget. Of course, that means that the text has to be parseable as a floating point number.- Cell
Renderer Spinner - GtkCellRendererSpinner renders a spinning animation in a cell, very
similar to
Spinner. It can often be used as an alternative to aCellRendererProgressfor displaying indefinite activity, instead of actual progress. - Cell
Renderer State - Tells how a cell is to be rendered.
- Cell
Renderer Text - A
CellRendererTextrenders 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 theellipsizeproperty allows it. - Cell
Renderer Toggle CellRendererTogglerenders a toggle button in a cell. The button is drawn as a radio or a checkbutton, depending on theradioproperty. When activated, it emits thetoggledsignal.- Cell
View - A
CellViewdisplays a single row of aTreeModelusing aCellAreaandCellAreaContext. ACellAreaContextcan be provided to theCellViewat 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 ofComboBox). - Check
Button - A
CheckButtonplaces a discreteToggleButtonnext to a widget, (usually aLabel). See the section onToggleButtonwidgets for more information about toggle/check buttons. - Check
Menu Item - A
CheckMenuItemis a menu item that maintains the state of a boolean value in addition to aMenuItemusual role in activating application code. - Clipboard
- The
Clipboardobject represents a clipboard of data shared between different processes or between different widgets in the same process. Each clipboard is identified by a name encoded as agdk::Atom. (Conversion to and from strings can be done withgdk::Atom::intern()andgdk::Atom::name().) The default clipboard corresponds to the “CLIPBOARD” atom; another commonly used clipboard is the “PRIMARY” clipboard, which, in X, traditionally contains the currently selected text. - Color
Button - The
ColorButtonis 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. - Color
Chooser ColorChooseris an interface that is implemented by widgets for choosing colors. Depending on the situation, colors may be allowed to have alpha (translucency).- Color
Chooser Dialog - The
ColorChooserDialogwidget is a dialog for choosing a color. It implements theColorChooserinterface. - Color
Chooser Widget - The
ColorChooserWidgetwidget 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. - Combo
Box - 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.
- Combo
BoxText - A GtkComboBoxText is a simple variant of
ComboBoxthat hides the model-view complexity for simple text-only use cases. - Container
- 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
Windowcontaining aFramecontaining aLabel. If you wanted an image instead of a textual label inside the frame, you might replace theLabelwidget with aImagewidget. - CssProvider
- GtkCssProvider is an object implementing the
StyleProviderinterface. It is able to parse [CSS-like][css-overview] input in order to style widgets. - CssSection
- Defines a part of a CSS document. Because sections are nested into
one another, you can use
parent()to get the containing region. - Dest
Defaults - The
DestDefaultsenumeration specifies the various types of action that will be taken on behalf of the user for a drag destination site. - Dialog
- 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.
- Dialog
Flags - Flags used to influence dialog construction.
- Drawing
Area - The
DrawingAreawidget 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: - Editable
- The
Editableinterface is an interface which should be implemented by text editing widgets, such asEntryandSpinButton. 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. - Entry
- The
Entrywidget 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. - Entry
Buffer - The
EntryBufferclass contains the actual text displayed in aEntrywidget. - Entry
Completion EntryCompletionis an auxiliary object to be used in conjunction withEntryto provide the completion functionality. It implements theCellLayoutinterface, to allow the user to add extra cells to theTreeViewwith completion matches.- Event
Box - The
EventBoxwidget is a subclass ofBinwhich also has its own window. It is useful since it allows you to catch events for widgets which do not have their own window. - Event
Controller EventControlleris a base, low-level implementation for event controllers. Those react to a series ofGdkEvents, and possibly trigger actions as a consequence of those.- Event
Controller Key v3_24 EventControllerKeyis an event controller meant for situations where you need access to key events.- Event
Controller Motion v3_24 EventControllerMotionis an event controller meant for situations where you need to track the position of the pointer.- Event
Controller Scroll v3_24 EventControllerScrollis 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 thescrollsignal (deltas in the discrete case are multiples of 1).- Event
Controller Scroll Flags v3_24 - Describes the behavior of a
EventControllerScroll. - Expander
- A
Expanderallows the user to hide or show its child by clicking on an expander triangle similar to the triangles used in aTreeView. - File
Chooser FileChooseris an interface that can be implemented by file selection widgets. In GTK+, the main objects that implement this interface areFileChooserWidget,FileChooserDialog, andFileChooserButton. You do not need to write an object that implements theFileChooserinterface unless you are trying to adapt an existing file selector to expose a standard programming interface.- File
Chooser Button - The
FileChooserButtonis a widget that lets the user select a file. It implements theFileChooserinterface. Visually, it is a file name with a button to bring up aFileChooserDialog. The user can then use that dialog to change the file associated with that button. This widget does not support setting theselect-multipleproperty totrue. - File
Chooser Dialog FileChooserDialogis a dialog box suitable for use with “File/Open” or “File/Save as” commands. This widget works by putting aFileChooserWidgetinside aDialog. It exposes theFileChooserinterface, so you can use all of theFileChooserfunctions on the file chooser dialog as well as those forDialog.- File
Chooser Native FileChooserNativeis an abstraction of a dialog box suitable for use with “File/Open” or “File/Save as” commands. By default, this just uses aFileChooserDialogto 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),FileChooserNativemay call the proper APIs (portals) to let the user choose a file and make it available to the application.- File
Chooser Widget FileChooserWidgetis a widget for choosing files. It exposes theFileChooserinterface, and you should use the methods of this interface to interact with the widget.- File
Chooser Widget Accessible v3_24_30 - Implements
- File
Filter - A GtkFileFilter can be used to restrict the files being shown in a
FileChooser. Files can be filtered based on their name (withadd_pattern()), on their mime type (withadd_mime_type()), or by a custom filter function (withadd_custom()). - File
Filter Flags - These flags indicate what parts of a
FileFilterInfostruct are filled or need to be filled. - File
Filter Info - A
FileFilterInfo-struct is used to pass information about the tested file toFileFilter::filter(). - Fixed
- The
Fixedwidget is a container which can place child widgets at fixed positions and with fixed sizes, given in pixels.Fixedperforms no automatic layout management. - FlowBox
- A GtkFlowBox positions child widgets in sequence according to its orientation.
- Flow
BoxChild - Signals
- Font
Button - The
FontButtonis 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. - Font
Chooser FontChooseris an interface that can be implemented by widgets displaying the list of fonts. In GTK+, the main objects that implement this interface areFontChooserWidget,FontChooserDialogandFontButton. The GtkFontChooser interface has been introducted in GTK+ 3.2.- Font
Chooser Dialog - The
FontChooserDialogwidget is a dialog for selecting a font. It implements theFontChooserinterface. - Font
Chooser Level v3_24 - This enumeration specifies the granularity of font selection that is desired in a font chooser.
- Font
Chooser Widget - The
FontChooserWidgetwidget lists the available fonts, styles and sizes, allowing the user to select a font. It is used in theFontChooserDialogwidget to provide a dialog box for selecting fonts. - Frame
- 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
FrameExt::set_label_align(). - GLArea
GLAreais a widget that allows drawing with OpenGL.- Gesture
Gestureis 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 specialNonegdk::EventSequencevalue for these).- Gesture
Drag GestureDragis aGestureimplementation that recognizes drag operations. The drag operation itself can be tracked throught thedrag-begin,drag-updateanddrag-endsignals, or the relevant coordinates be extracted throughGestureDragExt::offset()andGestureDragExt::start_point().- Gesture
Long Press GestureLongPressis aGestureimplementation able to recognize long presses, triggering thepressedafter the timeout is exceeded.- Gesture
Multi Press GestureMultiPressis aGestureimplementation able to recognize multiple clicks on a nearby zone, which can be listened for through thepressedsignal. Whenever time or distance between clicks exceed the GTK+ defaults,stoppedis emitted, and the click counter is reset.- Gesture
Pan GesturePanis aGestureimplementation able to recognize pan gestures, those are drags that are locked to happen along one axis. The axis that aGesturePanhandles is defined at construct time, and can be changed throughset_orientation().- Gesture
Rotate GestureRotateis aGestureimplementation able to recognize 2-finger rotations, whenever the angle between both handled sequences changes, theangle-changedsignal is emitted.- Gesture
Single GestureSingleis a subclass ofGesture, 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 throughGestureSingleExt::current_sequence()while the gesture is being interacted with.- Gesture
Stylus v3_24 GestureStylusis aGestureimplementation specific to stylus input. The provided signals just provide the basic information- Gesture
Swipe GestureSwipeis aGestureimplementation able to recognize swipes, after a press/move/…/move/release sequence happens, theswipesignal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.- Gesture
Zoom GestureZoomis aGestureimplementation able to recognize pinch/zoom gestures, whenever the distance between both tracked sequences changes, thescale-changedsignal is emitted to report the scale factor.- Grid
- GtkGrid is a container which arranges its child widgets in rows and columns, with arbitrary positions and horizontal/vertical spans.
- Header
Bar - GtkHeaderBar is similar to a horizontal
Box. 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 withHeaderBarExt::set_has_subtitle(). - Header
BarAccessible v3_24_11 - Implements
- IMContext
IMContextdefines the interface for GTK+ input methods. An input method is used by GTK+ text input widgets likeEntryto map from key events to Unicode character strings.- IMContext
Simple - 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.
- IMMulticontext
- Implements
- Icon
Info - Contains information found when looking up an icon in an icon theme.
- Icon
Lookup Flags - Used to specify options for
IconThemeExt::lookup_icon() - Icon
Theme IconThemeprovides 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.- Icon
View IconViewprovides an alternative view on aTreeModel. It displays the model as a grid of icons with labels. LikeTreeView, it allows to select one or multiple items (depending on the selection mode, seeIconViewExt::set_selection_mode()). In addition to selection with the arrow keys,IconViewsupports rubberband selection, which is controlled by dragging the pointer.- Image
- The
Imagewidget displays an image. Various kinds of object can be displayed as an image; most typically, you would load agdk_pixbuf::Pixbuf(“pixel buffer”) from a file, and then display that. There’s a convenience function to do this,from_file(), used as follows: - InfoBar
InfoBaris 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 toDialog, which has a action area at the bottom,InfoBarhas an action area at the side.- Input
Hints - Describes hints that might be taken into account by input methods
or applications. Note that input methods may already tailor their
behaviour according to the
InputPurposeof the entry. - Invisible
- The
Invisiblewidget is used internally in GTK+, and is probably not very useful for application developers. - Junction
Sides - Describes how a rendered element connects to adjacent elements.
- Label
- The
Labelwidget displays a small amount of text. As the name implies, most labels are used to label another widget such as aButton, aMenuItem, or aComboBox. - Layout
Layoutis similar toDrawingAreain 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 implementingScrollable, and can contain child widgets since it’s aContainer.- Level
Bar - The
LevelBaris 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. - Link
Button - A GtkLinkButton is a
Buttonwith 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. - ListBox
- 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.
- List
BoxRow - Properties
- List
Store - The
ListStoreobject is a list model for use with aTreeViewwidget. It implements theTreeModelinterface, and consequentialy, can use all of the methods available there. It also implements theTreeSortableinterface so it can be sorted by the view. Finally, it also implements the tree [drag and drop][gtk3-GtkTreeView-drag-and-drop] interfaces. - Lock
Button - 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
gio::Permissionobject. Concrete implementations ofgio::Permissionmay use PolicyKit or some other authorization framework. To obtain a PolicyKit-basedgio::Permission, usepolkit_permission_new(). - Menu
- A
Menuis aMenuShellthat implements a drop down menu consisting of a list ofMenuItemobjects which can be navigated and activated by the user to perform application functions. - MenuBar
- The
MenuBaris a subclass ofMenuShellwhich contains one or moreGtkMenuItems. The result is a standard menu bar which can hold many menu items. - Menu
Button - The
MenuButtonwidget is used to display a popup when clicked on. This popup can be provided either as aMenu, aPopoveror an abstractgio::MenuModel. - Menu
Item - The
MenuItemwidget and the derived widgets are the only valid children for menus. Their function is to correctly handle highlighting, alignment, events and submenus. - Menu
Shell - A
MenuShellis the abstract base class used to derive theMenuandMenuBarsubclasses. - Menu
Tool Button - A
MenuToolButtonis aToolItemthat contains a button and a small additional button with an arrow. When clicked, the arrow button pops up a dropdown menu. - Message
Dialog MessageDialogpresents a dialog with some message text. It’s simply a convenience widget; you could construct the equivalent ofMessageDialogfromDialogwithout too much effort, butMessageDialogsaves typing.- Misc
- The
Miscwidget is an abstract widget which is not useful itself, but is used to derive subclasses which have alignment and padding attributes. - Model
Button - GtkModelButton is a button class that can use a
GActionas its model. In contrast toToggleButtonorRadioButton, which can also be backed by aGActionvia theaction-nameproperty, 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. - Mount
Operation - This should not be accessed directly. Use the accessor functions below.
- Native
Dialog - Native dialogs are platform dialogs that don’t use
DialogorWindow. They are used in order to integrate better with a platform, by looking the same as other native applications and supporting platform specific features. - Notebook
- The
Notebookwidget is aContainerwhose children are pages that can be switched between using tab labels along one edge. - Offscreen
Window - GtkOffscreenWindow is strictly intended to be used for obtaining
snapshots of widgets that are not part of a normal widget hierarchy.
Since
OffscreenWindowis a toplevel widget you cannot obtain snapshots of a full window with it since you cannot pack a toplevel widget in another toplevel. - Orientable
- The
Orientableinterface 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.gBox/GtkHBox/GtkVBoxorScale/GtkHScale/GtkVScale).Orientableis more flexible in that it allows the orientation to be changed at runtime, allowing the widgets to “flip”. - Overlay
- 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
halignandvalignproperties. E.g. a widget with both alignments set toAlign::Startwill be placed at the top left corner of the GtkOverlay container, whereas an overlay with halign set toAlign::Centerand valign set toAlign::Endwill 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. - PadAction
Entry - Struct defining a pad action entry.
- PadController
PadControlleris an event controller for the pads found in drawing tablets (The collection of buttons and tactile sensors often found around the stylus-sensitive area).- Page
Range - See also
PrintSettings::set_page_ranges(). - Page
Setup - 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
PrintOperationwhen printing. The benefit of splitting this out of thePrintSettingsis that these affect the actual layout of the page, and thus need to be set long before user prints. - Paned
Panedhas two panes, arranged either horizontally or vertically. The division between the two panes is adjustable by the user by dragging a handle.- Paper
Size - 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.
- Places
Open Flags - These flags serve two purposes. First, the application can call
PlacesSidebar::set_open_flags()using these flags as a bitmask. This tells the sidebar that the application is able to open folders selected from the sidebar in various ways, for example, in new tabs or in new windows in addition to the normal mode. - Places
Sidebar PlacesSidebaris 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 inFileChooserand may be used by file managers and similar programs.- Plug
gdk_backend=x11 - Together with
Socket,Plugprovides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates aSocketwidget and passes the ID of that widget’s window to the other process, which then creates aPlugwith that window ID. Any widgets contained in thePlugthen will appear inside the first application’s window. - Plug
Accessible gdk_backend=x11andv3_24_30 - Implements
- Popover
- 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
new(), or updated afterwards throughPopoverExt::set_relative_to(), by default they will point to the whole widget area, although this behavior can be changed throughPopoverExt::set_pointing_to(). - Popover
Menu - GtkPopoverMenu is a subclass of
Popoverthat treats its children like menus and allows switching between them. It is meant to be used primarily together withModelButton, but any widget can be used, such asSpinButtonorScale. In this respect, GtkPopoverMenu is more flexible than popovers that are created from agio::MenuModelwithPopover::from_model(). - Print
Context - 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
pango::Layoutandpango::Contextobjects that match the font metrics of the cairo surface. - Print
Operation - GtkPrintOperation is the high-level, portable printing API.
It looks a bit different than other GTK+ dialogs such as the
FileChooser, 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. - Print
Operation Preview - Signals
- Print
Settings - 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.
- Progress
Bar - The
ProgressBaris 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. - Radio
Button - A single radio button performs the same basic function as a
CheckButton, 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. - Radio
Menu Item - 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.
- Radio
Tool Button - A
RadioToolButtonis aToolItemthat 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. - Range
Rangeis the common base class for widgets which visualize an adjustment, e.gScaleorScrollbar.- Recent
Chooser RecentChooseris an interface that can be implemented by widgets displaying the list of recently used files. In GTK+, the main objects that implement this interface areRecentChooserWidget,RecentChooserDialogandRecentChooserMenu.- Recent
Chooser Dialog RecentChooserDialogis a dialog box suitable for displaying the recently used documents. This widgets works by putting aRecentChooserWidgetinside aDialog. It exposes theGtkRecentChooserIfaceinterface, so you can use all theRecentChooserfunctions on the recent chooser dialog as well as those forDialog.- Recent
Chooser Menu RecentChooserMenuis a widget suitable for displaying recently used files inside a menu. It can be used to set a sub-menu of aMenuItemusingGtkMenuItemExt::set_submenu(), or as the menu of aMenuToolButton.- Recent
Chooser Widget RecentChooserWidgetis a widget suitable for selecting recently used files. It is the main building block of aRecentChooserDialog. Most applications will only need to use the latter; you can useRecentChooserWidgetas part of a larger window if you have special needs.- Recent
Data - Meta-data to be passed to
RecentManagerExt::add_full()when registering a recently used resource. - Recent
Filter - A
RecentFiltercan be used to restrict the files being shown in aRecentChooser. Files can be filtered based on their name (withadd_pattern()), on their mime type (withFileFilter::add_mime_type()), on the application that has registered them (withadd_application()), or by a custom filter function (withgtk_recent_filter_add_custom()). - Recent
Filter Flags - These flags indicate what parts of a
GtkRecentFilterInfostruct are filled or need to be filled. - Recent
Info RecentInfo-struct contains private data only, and should be accessed using the provided API.- Recent
Manager RecentManagerprovides 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.- Rectangle
- Defines the position and size of a rectangle. It is identical to
cairo_rectangle_int_t. - Region
Flags - Describes a region within a widget.
- Requisition
- A
Requisition-struct represents the desired size of a widget. See [GtkWidget’s geometry management section][geometry-management] for more information. - Revealer
- The GtkRevealer widget is a container which animates the transition of its child from invisible to visible.
- Scale
- 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,
Range, in addition to the methods for GtkScale itself. To set the value of a scale, you would normally useRangeExt::set_value(). To detect changes to the value, you would normally use thevalue-changedsignal. - Scale
Button ScaleButtonprovides a button which pops up a scale widget. This kind of widget is commonly used for volume controls in multimedia applications, and GTK+ provides aVolumeButtonsubclass that is tailored for this use case.- Scrollable
Scrollableis an interface that is implemented by widgets with native scrolling ability.- Scrollbar
- The
Scrollbarwidget is a horizontal or vertical scrollbar, depending on the value of theorientationproperty. - Scrolled
Window - GtkScrolledWindow is a container that accepts a single child widget and makes that child scrollable using either internally added scrollbars or externally associated adjustments.
- Search
Bar SearchBaris 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.- Search
Entry SearchEntryis a subclass ofEntrythat has been tailored for use as a search entry.- Selection
Data - Separator
- GtkSeparator is a horizontal or vertical separator widget, depending on the
value of the
orientationproperty, used to group the widgets within a window. It displays a line with a shadow to make it appear sunken into the interface. - Separator
Menu Item - The
SeparatorMenuItemis 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. - Separator
Tool Item - A
SeparatorToolItemis aToolItemthat separates groups of otherGtkToolItems. Depending on the theme, aSeparatorToolItemwill often look like a vertical line on horizontally docked toolbars. - Settings
- GtkSettings provide a mechanism to share global settings between applications.
- Shortcut
Label ShortcutLabelis a widget that represents a single keyboard shortcut or gesture in the user interface.- Shortcuts
Group - 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.
- Shortcuts
Section - 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
section-nameand atitlethat can be shown in the section selector of the GtkShortcutsWindow. - Shortcuts
Shortcut - A GtkShortcutsShortcut represents a single keyboard shortcut or gesture
with a short text. This widget is only meant to be used with
ShortcutsWindow. - Shortcuts
Window - 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.
- Size
Group SizeGroupprovides 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 aGridwidget.- Socket
gdk_backend=x11 - Together with
Plug,Socketprovides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates aSocketwidget and passes that widget’s window ID to the other process, which then creates aPlugwith that window ID. Any widgets contained in thePlugthen will appear inside the first application’s window. - Socket
Accessible gdk_backend=x11andv3_24_30 - Implements
- Spin
Button - A
SpinButtonis an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into aEntry, 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. - Spinner
- A GtkSpinner widget displays an icon-size spinning animation.
It is often used as an alternative to a
ProgressBarfor displaying indefinite activity, instead of actual progress. - Stack
- 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
StackSwitcherwidget can be used with GtkStack to provide this functionality. - Stack
Sidebar - A GtkStackSidebar enables you to quickly and easily provide a consistent “sidebar” object for your user interface.
- Stack
Switcher - The GtkStackSwitcher widget acts as a controller for a
Stack; it shows a row of buttons to switch between the various pages of the associated stack widget. - State
Flags - Describes a widget state. Widget states are used to match the widget against CSS pseudo-classes. Note that GTK extends the regular CSS classes and sometimes uses different names.
- Statusbar
- A
Statusbaris usually placed along the bottom of an application’s mainWindow. 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). - Style
Context StyleContextis an object that stores styling information affecting a widget defined byWidgetPath.- Style
Context Print Flags - Flags that modify the behavior of
StyleContextExt::to_string(). New values may be added to this enumeration. - Style
Properties - GtkStyleProperties provides the storage for style information
that is used by
StyleContextand otherStyleProviderimplementations. - Style
Provider - GtkStyleProvider is an interface used to provide style information to a
StyleContext. SeeStyleContextExt::add_provider()andStyleContext::add_provider_for_screen(). - Switch
Switchis 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.- Target
Entry - A
TargetEntryrepresents 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. - Target
Flags - The
TargetFlagsenumeration is used to specify constraints on aTargetEntry. - Target
List - A
TargetList-struct is a reference counted list ofGtkTargetPairand should be treated as opaque. - Text
Attributes - Using
TextAttributesdirectly should rarely be necessary. It’s primarily useful withTextIter::is_attributes(). As with most GTK+ structs, the fields in this struct should only be read, never modified directly. - Text
Buffer - 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.
- Text
Child Anchor - A
TextChildAnchoris 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. - Text
Iter - 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.
- Text
Mark - 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.
- Text
Search Flags - Flags affecting how a search is done.
- TextTag
- 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.
- Text
TagTable - 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.
- Text
View - 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.
- Tick
Callback Id - Toggle
Button - A
ToggleButtonis aButtonwhich will remain “pressed-in” when clicked. Clicking again will cause the toggle button to return to its normal state. - Toggle
Tool Button - A
ToggleToolButtonis aToolItemthat contains a toggle button. - Tool
Button GtkToolButtonsareGtkToolItemscontaining buttons.- Tool
Item GtkToolItemsare widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, usenew(). UseContainerExt::add()to add a child widget to the tool item.- Tool
Item Group - A
ToolItemGroupis used together withToolPaletteto addGtkToolItemsto a palette like container with different categories and drag and drop support. - Tool
Palette - A
ToolPaletteallows you to addGtkToolItemsto a palette-like container with different categories and drag and drop support. - Tool
Palette Drag Targets - Flags used to specify the supported drag targets.
- Tool
Shell - The
ToolShellinterface allows container widgets to provide additional information when embeddingToolItemwidgets. - Toolbar
- A toolbar is created with a call to
new(). - Tooltip
- Basic tooltips can be realized simply by using
WidgetExt::set_tooltip_text()orWidgetExt::set_tooltip_markup()without any explicit tooltip object. - Tree
Drag Dest - Implements
- Tree
Drag Source - Implements
- Tree
Iter - The
TreeIteris the primary structure for accessing aTreeModel. Models are expected to put a unique integer in thestampmember, and put model-specific data in the threeuser_datamembers. - Tree
Model - The
TreeModelinterface defines a generic tree interface for use by theTreeViewwidget. 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 aTreeViewwidget. - Tree
Model Filter - A
TreeModelFilteris a tree model which wraps another tree model, and can do the following things: - Tree
Model Flags - These flags indicate various properties of a
TreeModel. - Tree
Model Sort - The
TreeModelSortis a model which implements theTreeSortableinterface. 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 byTreeModelSortis not guaranteed to be stable. - Tree
Path - Tree
RowReference - A GtkTreeRowReference tracks model changes so that it always refers to the
same row (a
TreePathrefers to a position, not a fixed row). Create a new GtkTreeRowReference withnew(). - Tree
Selection - The
TreeSelectionobject is a helper object to manage the selection for aTreeViewwidget. TheTreeSelectionobject is automatically created when a newTreeViewwidget is created, and cannot exist independently of this widget. The primary reason theTreeSelectionobjects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on theTreeViewwidget instead of a separate function. - Tree
Sortable TreeSortableis an interface to be implemented by tree models which support sorting. TheTreeViewuses the methods provided by this interface to sort the model.- Tree
Store - The
TreeStoreobject is a list model for use with aTreeViewwidget. It implements theTreeModelinterface, and consequentially, can use all of the methods available there. It also implements theTreeSortableinterface so it can be sorted by the view. Finally, it also implements the tree [drag and drop][gtk3-GtkTreeView-drag-and-drop] interfaces. - Tree
View - Widget that displays any object that implements the
TreeModelinterface. - Tree
View Column - The GtkTreeViewColumn object represents a visible column in a
TreeViewwidget. 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. - Viewport
- The
Viewportwidget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use GtkViewport to scroll child widgets such asGrid,Box, and so on. - Volume
Button VolumeButtonis a subclass ofScaleButtonthat has been tailored for use as a volume control widget with suitable icons, tooltips and accessible labels.- Widget
- GtkWidget is the base class all widgets in GTK+ derive from. It manages the widget lifecycle, states and style.
- Widget
Path - 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
StyleContexton behalf of the real widget in order to query style information. - Window
- 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,…).
- Window
Group - A
WindowGrouprestricts the effect of grabs to windows in the same group, thereby making window groups almost behave like separate applications.
Enums§
- Align
- Controls how a widget deals with extra space in a single (x or y) dimension.
- Arrow
Type - Used to indicate the direction in which an arrow should point.
- Assistant
Page Type - An enum for determining the page role inside the
Assistant. It’s used to handle buttons sensitivity and visibility. - Baseline
Position - Whenever a container has some form of natural row it may align
children in that row along a common typographical baseline. If
the amount of verical space in the row is taller than the total
requested height of the baseline-aligned children then it can use a
BaselinePositionto select where to put the baseline inside the extra availible space. - Border
Style - Describes how the border of a UI element should be rendered.
- Builder
Error - Error codes that identify various errors that can occur while using
Builder. - Button
BoxStyle - Used to dictate the style that a
ButtonBoxuses to layout the buttons it contains. - Button
Role - The role specifies the desired appearance of a
ModelButton. - Buttons
Type - Prebuilt sets of buttons for the dialog. If
none of these choices are appropriate, simply use
Nonethen callDialogExtManual::add_buttons(). - Cell
Renderer Accel Mode - Determines if the edited accelerators are GTK+ accelerators. If they are, consumed modifiers are suppressed, only accelerators accepted by GTK+ are allowed, and the accelerators are rendered in the same way as they are in menus.
- Cell
Renderer Mode - Identifies how the user can interact with a particular cell.
- Corner
Type - Specifies which corner a child widget should be placed in when packed into
a
ScrolledWindow. This is effectively the opposite of where the scroll bars are placed. - CssProvider
Error - Error codes for
GTK_CSS_PROVIDER_ERROR. - CssSection
Type - The different types of sections indicate parts of a CSS document as parsed by GTK’s CSS parser. They are oriented towards the CSS Grammar, but may contain extensions.
- Delete
Type - See also:
delete-from-cursor. - Direction
Type - Focus movement types.
- Drag
Result - Gives an indication why a drag operation failed.
The value can by obtained by connecting to the
drag-failedsignal. - Entry
Icon Position - Specifies the side of the entry at which an icon is placed.
- Event
Sequence State - Describes the state of a
gdk::EventSequencein aGesture. - File
Chooser Action - Describes whether a
FileChooseris being used to open existing files or to save to a possibly new file. - File
Chooser Confirmation - Used as a return value of handlers for the
confirm-overwritesignal of aFileChooser. This value determines whether the file chooser will present the stock confirmation dialog, accept the user’s choice of a filename, or let the user choose another filename. - File
Chooser Error - These identify the various errors that can occur while calling
FileChooserfunctions. - Icon
Size - Built-in stock icon sizes.
- Icon
Theme Error - Error codes for GtkIconTheme operations.
- Icon
View Drop Position - An enum for determining where a dropped item goes.
- Image
Type - Describes the image data representation used by a
Image. If you want to get the image from the widget, you can only get the currently-stored representation. e.g. if theImageExt::storage_type()returnsPixbuf, then you can callImageExt::pixbuf()but notgtk_image_get_stock(). For empty images, you can request any storage type (call any of the “get” functions), but they will all returnNonevalues. - Input
Purpose - Describes primary purpose of the input widget. This information is useful for on-screen keyboards and similar input methods to decide which keys should be presented to the user.
- Justification
- Used for justifying the text inside a
Labelwidget. (See alsoGtkAlignment). - Level
BarMode - Describes how
LevelBarcontents should be rendered. Note that this enumeration could be extended with additional modes in the future. - License
- The type of license for an application.
- Menu
Direction Type - An enumeration representing directional movements within a menu.
- Message
Type - The type of message being displayed in the dialog.
- Movement
Step - Notebook
Tab - Number
UpLayout - Used to determine the layout of pages on a sheet when printing multiple pages per sheet.
- Orientation
- Represents the orientation of widgets and other objects which can be switched
between horizontal and vertical orientation on the fly, like
ToolbarorGesturePan. - Pack
Direction - Determines how widgets should be packed inside menubars and menuitems contained in menubars.
- Pack
Type - Represents the packing location
Boxchildren. (See:GtkVBox,GtkHBox, andButtonBox). - PadAction
Type - The type of a pad action.
- Page
Orientation - See also
PrintSettings::set_orientation(). - PageSet
- See also
gtk_print_job_set_page_set(). - PanDirection
- Describes the panning direction of a
GesturePan - Policy
Type - Determines how the size should be computed to achieve the one of the visibility mode for the scrollbars.
- Popover
Constraint - Describes constraints to positioning of popovers. More values may be added to this enumeration in the future.
- Position
Type - Describes which edge of a widget a certain feature is positioned at, e.g. the
tabs of a
Notebook, the handle of aGtkHandleBoxor the label of aScale. - Print
Duplex - See also
PrintSettings::set_duplex(). - Print
Error - Error codes that identify various errors that can occur while using the GTK+ printing support.
- Print
Operation Action - The
actionparameter toPrintOperationExt::run()determines what action the print operation should perform. - Print
Operation Result - A value of this type is returned by
PrintOperationExt::run(). - Print
Pages - See also
gtk_print_job_set_pages() - Print
Quality - See also
PrintSettings::set_quality(). - Print
Status - The status gives a rough indication of the completion of a running print operation.
- Propagation
Phase - Describes the stage at which events are fed into a
EventController. - Recent
Chooser Error - These identify the various errors that can occur while calling
RecentChooserfunctions. - Recent
Manager Error - Error codes for
RecentManageroperations - Recent
Sort Type - Used to specify the sorting method to be applyed to the recently used resource list.
- Relief
Style - Indicated the relief to be drawn around a
Button. - Resize
Mode - Response
Type - Predefined values for use as response ids in
DialogExt::add_button(). All predefined values are negative; GTK+ leaves values of 0 or greater for application-defined response ids. - Revealer
Transition Type - These enumeration values describe the possible transitions
when the child of a
Revealerwidget is shown or hidden. - Scroll
Step - Scroll
Type - Scrolling types.
- Scrollable
Policy - Defines the policy to be used in a scrollable widget when updating the scrolled window adjustments in a given orientation.
- Selection
Mode - Used to control what selections users are allowed to make.
- Sensitivity
Type - Determines how GTK+ handles the sensitivity of stepper arrows at the end of range widgets.
- Shadow
Type - Used to change the appearance of an outline typically provided by a
Frame. - Shortcut
Type - GtkShortcutType specifies the kind of shortcut that is being described. More values may be added to this enumeration over time.
- Size
Group Mode - The mode of the size group determines the directions in which the size group affects the requested sizes of its component widgets.
- Size
Request Mode - Specifies a preference for height-for-width or width-for-height geometry management.
- Sort
Column - Sort
Type - Determines the direction of a sort.
- Spin
Button Update Policy - The spin button update policy determines whether the spin button displays
values even if they are outside the bounds of its adjustment.
See
SpinButtonExt::set_update_policy(). - Spin
Type - The values of the GtkSpinType enumeration are used to specify the
change to make in
SpinButtonExt::spin(). - Stack
Transition Type - These enumeration values describe the possible transitions
between pages in a
Stackwidget. - Text
Direction - Reading directions for text.
- Text
Extend Selection - Granularity types that extend the text selection. Use the
extend-selectionsignal to customize the selection. - Text
View Layer - Used to reference the layers of
TextViewfor the purpose of customized drawing with the ::draw_layer vfunc. - Text
Window Type - Used to reference the parts of
TextView. - Toolbar
Style - Used to customize the appearance of a
Toolbar. Note that setting the toolbar style overrides the user’s preferences for the default toolbar style. Note that if the button has only a label set and GTK_TOOLBAR_ICONS is used, the label will be visible, and vice versa. - Tree
View Column Sizing - The sizing method the column uses to determine its width. Please note
that
Autosizeare inefficient for large views, and can make columns appear choppy. - Tree
View Drop Position - An enum for determining where a dropped row goes.
- Tree
View Grid Lines - Used to indicate which grid lines to draw in a tree view.
- Unit
- See also
PrintSettings::set_paper_width(). - Widget
Help Type - Kinds of widget-specific help. Used by the ::show-help signal.
- Window
Position - Window placement can be influenced using this enumeration. Note that
using
CenterAlwaysis almost always a bad idea. It won’t necessarily work well with all window managers or on all windowing systems. - Window
Type - A
Windowcan be one of these types. Most things you’d consider a “window” should have typeToplevel; windows with this type are managed by the window manager and have a frame by default (callGtkWindowExt::set_decorated()to toggle the frame). Windows with typePopupare ignored by the window manager; window manager keybindings won’t work on them, the window manager won’t decorate the window with a frame, many GTK+ features that rely on the window manager will not work (e.g. resize grips and maximization/minimization).Popupis used to implement widgets such asMenuor tooltips that you normally don’t think of as windows per se. Nearly all windows should beToplevel. In particular, do not usePopupjust to turn off the window borders; useGtkWindowExt::set_decorated()for that. - Wrap
Mode - Describes a type of line wrapping.
Constants§
- STYLE_
PROVIDER_ PRIORITY_ APPLICATION - A priority that can be used when adding a
StyleProviderfor application-specific style information. - STYLE_
PROVIDER_ PRIORITY_ FALLBACK - The priority used for default style information that is used in the absence of themes.
- STYLE_
PROVIDER_ PRIORITY_ SETTINGS - The priority used for style information provided
via
Settings. - STYLE_
PROVIDER_ PRIORITY_ THEME - The priority used for style information provided by themes.
- STYLE_
PROVIDER_ PRIORITY_ USER - The priority used for the style information from
XDG_CONFIG_HOME/gtk-3.0/gtk.css.
Statics§
- LEVEL_
BAR_ OFFSET_ FULL - The name used for the stock full offset included by
LevelBar. - LEVEL_
BAR_ OFFSET_ HIGH - The name used for the stock high offset included by
LevelBar. - LEVEL_
BAR_ OFFSET_ LOW - The name used for the stock low offset included by
LevelBar. - PAPER_
NAME_ A3 - Name for the A3 paper size.
- PAPER_
NAME_ A4 - Name for the A4 paper size.
- PAPER_
NAME_ A5 - Name for the A5 paper size.
- PAPER_
NAME_ B5 - Name for the B5 paper size.
- PAPER_
NAME_ EXECUTIVE - Name for the Executive paper size.
- PAPER_
NAME_ LEGAL - Name for the Legal paper size.
- PAPER_
NAME_ LETTER - Name for the Letter paper size.
- PRINT_
SETTINGS_ COLLATE - PRINT_
SETTINGS_ DEFAULT_ SOURCE - PRINT_
SETTINGS_ DITHER - PRINT_
SETTINGS_ DUPLEX - PRINT_
SETTINGS_ FINISHINGS - PRINT_
SETTINGS_ MEDIA_ TYPE - PRINT_
SETTINGS_ NUMBER_ UP - PRINT_
SETTINGS_ NUMBER_ UP_ LAYOUT - PRINT_
SETTINGS_ N_ COPIES - PRINT_
SETTINGS_ ORIENTATION - PRINT_
SETTINGS_ OUTPUT_ BASENAME - The key used by the “Print to file” printer to store the file name of the output without the path to the directory and the file extension.
- PRINT_
SETTINGS_ OUTPUT_ BIN - PRINT_
SETTINGS_ OUTPUT_ DIR - The key used by the “Print to file” printer to store the directory to which the output should be written.
- PRINT_
SETTINGS_ OUTPUT_ FILE_ FORMAT - The key used by the “Print to file” printer to store the format of the output. The supported values are “PS” and “PDF”.
- PRINT_
SETTINGS_ OUTPUT_ URI - The key used by the “Print to file” printer to store the URI to which the output should be written. GTK+ itself supports only “file://” URIs.
- PRINT_
SETTINGS_ PAGE_ RANGES - PRINT_
SETTINGS_ PAGE_ SET - PRINT_
SETTINGS_ PAPER_ FORMAT - PRINT_
SETTINGS_ PAPER_ HEIGHT - PRINT_
SETTINGS_ PAPER_ WIDTH - PRINT_
SETTINGS_ PRINTER - PRINT_
SETTINGS_ PRINTER_ LPI - PRINT_
SETTINGS_ PRINT_ PAGES - PRINT_
SETTINGS_ QUALITY - PRINT_
SETTINGS_ RESOLUTION - PRINT_
SETTINGS_ RESOLUTION_ X - PRINT_
SETTINGS_ RESOLUTION_ Y - PRINT_
SETTINGS_ REVERSE - PRINT_
SETTINGS_ SCALE - PRINT_
SETTINGS_ USE_ COLOR - PRINT_
SETTINGS_ WIN32_ DRIVER_ EXTRA - PRINT_
SETTINGS_ WIN32_ DRIVER_ VERSION - STYLE_
CLASS_ ACCELERATOR - A CSS class to match an accelerator.
- STYLE_
CLASS_ ARROW - A CSS class used when rendering an arrow element.
- STYLE_
CLASS_ BACKGROUND - A CSS class to match the window background.
- STYLE_
CLASS_ BOTTOM - A CSS class to indicate an area at the bottom of a widget.
- STYLE_
CLASS_ BUTTON - A CSS class to match buttons.
- STYLE_
CLASS_ CALENDAR - A CSS class to match calendars.
- STYLE_
CLASS_ CELL - A CSS class to match content rendered in cell views.
- STYLE_
CLASS_ CHECK - A CSS class to match check boxes.
- STYLE_
CLASS_ COMBOBOX_ ENTRY - A CSS class to match combobox entries.
- STYLE_
CLASS_ CONTEXT_ MENU - A CSS class to match context menus.
- STYLE_
CLASS_ CSD - A CSS class that gets added to windows which have client-side decorations.
- STYLE_
CLASS_ CURSOR_ HANDLE - A CSS class used when rendering a drag handle for text selection.
- STYLE_
CLASS_ DEFAULT - A CSS class to match the default widget.
- STYLE_
CLASS_ DESTRUCTIVE_ ACTION - A CSS class used when an action (usually a button) is one that is expected to remove or destroy something visible to the user.
- STYLE_
CLASS_ DIM_ LABEL - A CSS class to match dimmed labels.
- STYLE_
CLASS_ DND - A CSS class for a drag-and-drop indicator.
- STYLE_
CLASS_ DOCK - A CSS class defining a dock area.
- STYLE_
CLASS_ ENTRY - A CSS class to match text entries.
- STYLE_
CLASS_ ERROR - A CSS class for an area displaying an error message, such as those in infobars.
- STYLE_
CLASS_ EXPANDER - A CSS class defining an expander, such as those in treeviews.
- STYLE_
CLASS_ FLAT - A CSS class that is added when widgets that usually have a frame or border (like buttons or entries) should appear without it.
- STYLE_
CLASS_ FRAME - A CSS class defining a frame delimiting content, such as
Frameor the scrolled window frame around the scrollable area. - STYLE_
CLASS_ GRIP - A CSS class defining a resize grip.
- STYLE_
CLASS_ HEADER - A CSS class to match a header element.
- STYLE_
CLASS_ HIGHLIGHT - A CSS class defining a highlighted area, such as headings in assistants and calendars.
- STYLE_
CLASS_ HORIZONTAL - A CSS class for horizontally layered widgets.
- STYLE_
CLASS_ IMAGE - A CSS class defining an image, such as the icon in an entry.
- STYLE_
CLASS_ INFO - A CSS class for an area displaying an informational message, such as those in infobars.
- STYLE_
CLASS_ INLINE_ TOOLBAR - A CSS class to match inline toolbars.
- STYLE_
CLASS_ INSERTION_ CURSOR - A CSS class used when rendering a drag handle for the insertion cursor position.
- STYLE_
CLASS_ LABEL - A CSS class to match labels.
- STYLE_
CLASS_ LEFT - A CSS class to indicate an area at the left of a widget.
- STYLE_
CLASS_ LEVEL_ BAR - A CSS class used when rendering a level indicator, such as a battery charge level, or a password strength.
- STYLE_
CLASS_ LINKED - A CSS class to match a linked area, such as a box containing buttons belonging to the same control.
- STYLE_
CLASS_ LIST - A CSS class to match lists.
- STYLE_
CLASS_ LIST_ ROW - A CSS class to match list rows.
- STYLE_
CLASS_ MARK - A CSS class defining marks in a widget, such as in scales.
- STYLE_
CLASS_ MENU - A CSS class to match menus.
- STYLE_
CLASS_ MENUBAR - A CSS class to menubars.
- STYLE_
CLASS_ MENUITEM - A CSS class to match menu items.
- STYLE_
CLASS_ MESSAGE_ DIALOG - A CSS class that is added to message dialogs.
- STYLE_
CLASS_ MONOSPACE - A CSS class that is added to text view that should use a monospace font.
- STYLE_
CLASS_ NEEDS_ ATTENTION - A CSS class used when an element needs the user attention, for instance a button in a stack switcher corresponding to a hidden page that changed state.
- STYLE_
CLASS_ NOTEBOOK - A CSS class defining a notebook.
- STYLE_
CLASS_ OSD - A CSS class used when rendering an OSD (On Screen Display) element, on top of another container.
- STYLE_
CLASS_ OVERSHOOT - A CSS class that is added on the visual hints that happen when scrolling is attempted past the limits of a scrollable area.
- STYLE_
CLASS_ PANE_ SEPARATOR - A CSS class for a pane separator, such as those in
Paned. - STYLE_
CLASS_ PAPER - A CSS class that is added to areas that should look like paper.
- STYLE_
CLASS_ POPOVER - A CSS class that matches popovers.
- STYLE_
CLASS_ POPUP - A CSS class that is added to the toplevel windows used for menus.
- STYLE_
CLASS_ PRIMARY_ TOOLBAR - A CSS class to match primary toolbars.
- STYLE_
CLASS_ PROGRESSBAR - A CSS class to use when rendering activity as a progressbar.
- STYLE_
CLASS_ PULSE - A CSS class to use when rendering a pulse in an indeterminate progress bar.
- STYLE_
CLASS_ QUESTION - A CSS class for an area displaying a question to the user, such as those in infobars.
- STYLE_
CLASS_ RADIO - A CSS class to match radio buttons.
- STYLE_
CLASS_ RAISED - A CSS class to match a raised control, such as a raised button on a toolbar.
- STYLE_
CLASS_ READ_ ONLY - A CSS class used to indicate a read-only state.
- STYLE_
CLASS_ RIGHT - A CSS class to indicate an area at the right of a widget.
- STYLE_
CLASS_ RUBBERBAND - A CSS class to match the rubberband selection rectangle.
- STYLE_
CLASS_ SCALE - A CSS class to match scale widgets.
- STYLE_
CLASS_ SCALE_ HAS_ MARKS_ ABOVE - A CSS class to match scale widgets with marks attached,
all the marks are above for horizontal
Scale. left for verticalScale. - STYLE_
CLASS_ SCALE_ HAS_ MARKS_ BELOW - A CSS class to match scale widgets with marks attached,
all the marks are below for horizontal
Scale, right for verticalScale. - STYLE_
CLASS_ SCROLLBAR - A CSS class to match scrollbars.
- STYLE_
CLASS_ SCROLLBARS_ JUNCTION - A CSS class to match the junction area between an horizontal and vertical scrollbar, when they’re both shown.
- STYLE_
CLASS_ SEPARATOR - A CSS class for a separator.
- STYLE_
CLASS_ SIDEBAR - A CSS class defining a sidebar, such as the left side in a file chooser.
- STYLE_
CLASS_ SLIDER - A CSS class to match sliders.
- STYLE_
CLASS_ SPINBUTTON - A CSS class defining an spinbutton.
- STYLE_
CLASS_ SPINNER - A CSS class to use when rendering activity as a “spinner”.
- STYLE_
CLASS_ STATUSBAR - A CSS class to match statusbars.
- STYLE_
CLASS_ SUBTITLE - A CSS class used for the subtitle label in a titlebar in a toplevel window.
- STYLE_
CLASS_ SUGGESTED_ ACTION - A CSS class used when an action (usually a button) is the primary suggested action in a specific context.
- STYLE_
CLASS_ TITLE - A CSS class used for the title label in a titlebar in a toplevel window.
- STYLE_
CLASS_ TITLEBAR - A CSS class used when rendering a titlebar in a toplevel window.
- STYLE_
CLASS_ TOOLBAR - A CSS class to match toolbars.
- STYLE_
CLASS_ TOOLTIP - A CSS class to match tooltip windows.
- STYLE_
CLASS_ TOP - A CSS class to indicate an area at the top of a widget.
- STYLE_
CLASS_ TOUCH_ SELECTION - A CSS class for touch selection popups on entries and text views.
- STYLE_
CLASS_ TROUGH - A CSS class to match troughs, as in scrollbars and progressbars.
- STYLE_
CLASS_ UNDERSHOOT - A CSS class that is added on the visual hints that happen where content is ‘scrolled off’ and can be made visible by scrolling.
- STYLE_
CLASS_ VERTICAL - A CSS class for vertically layered widgets.
- STYLE_
CLASS_ VIEW - A CSS class defining a view, such as iconviews or treeviews.
- STYLE_
CLASS_ WARNING - A CSS class for an area displaying a warning message, such as those in infobars.
- STYLE_
CLASS_ WIDE - A CSS class to indicate that a UI element should be ‘wide’.
Used by
Paned. - STYLE_
PROPERTY_ BACKGROUND_ COLOR - A property holding the background color of rendered elements as a
gdk::RGBA. - STYLE_
PROPERTY_ BACKGROUND_ IMAGE - A property holding the element’s background as a
cairo_pattern_t. - STYLE_
PROPERTY_ BORDER_ COLOR - A property holding the element’s border color as a
gdk::RGBA. - STYLE_
PROPERTY_ BORDER_ RADIUS - A property holding the rendered element’s border radius in pixels as a
gint. - STYLE_
PROPERTY_ BORDER_ STYLE - A property holding the element’s border style as a
BorderStyle. - STYLE_
PROPERTY_ BORDER_ WIDTH - A property holding the rendered element’s border width in pixels as
a
Border. The border is the intermediary spacing property of the padding/border/margin series. - STYLE_
PROPERTY_ COLOR - A property holding the foreground color of rendered elements as a
gdk::RGBA. - STYLE_
PROPERTY_ FONT - A property holding the font properties used when rendering text
as a
pango::FontDescription. - STYLE_
PROPERTY_ MARGIN - A property holding the rendered element’s margin as a
Border. The margin is defined as the spacing between the border of the element and its surrounding elements. It is external toWidget’s size allocations, and the most external spacing property of the padding/border/margin series. - STYLE_
PROPERTY_ PADDING - A property holding the rendered element’s padding as a
Border. The padding is defined as the spacing between the inner part of the element border and its child. It’s the innermost spacing property of the padding/border/margin series.
Traits§
Functions§
- accel_
groups_ activate - Finds the first accelerator in any
AccelGroupattached toobjectthat matchesaccel_keyandaccel_mods, and activates that accelerator. - accel_
groups_ from_ object - Gets a list of all accel groups which are attached to
object. - accelerator_
get_ default_ mod_ mask - Gets the modifier mask.
- accelerator_
get_ label - Converts an accelerator keyval and modifier mask into a string which can be used to represent the accelerator to the user.
- accelerator_
get_ label_ with_ keycode - Converts an accelerator keyval and modifier mask
into a (possibly translated) string that can be displayed to
a user, similarly to
accelerator_get_label(), but handling keycodes. - accelerator_
name - Converts an accelerator keyval and modifier mask into a string
parseable by
accelerator_parse(). For example, if you pass inGDK_KEY_qandgdk::ModifierType::CONTROL_MASK, this function returns “<Control>q”. - accelerator_
name_ with_ keycode - Converts an accelerator keyval and modifier mask
into a string parseable by
accelerator_parse_with_keycode(), similarly toaccelerator_name()but handling keycodes. This is only useful for system-level components, applications should useaccelerator_parse()instead. - accelerator_
parse - Parses a string representing an accelerator. The format looks like
“
<Control>a” or “<Shift>``<Alt>F1” or “<Release>z” (the last one is for key release). - accelerator_
parse_ with_ keycode - Parses a string representing an accelerator, similarly to
accelerator_parse()but handles keycodes as well. This is only useful for system-level components, applications should useaccelerator_parse()instead. - accelerator_
set_ default_ mod_ mask - Sets the modifiers that will be considered significant for keyboard
accelerators. The default mod mask depends on the GDK backend in use,
but will typically include
gdk::ModifierType::CONTROL_MASK|gdk::ModifierType::SHIFT_MASK|gdk::ModifierType::MOD1_MASK|gdk::ModifierType::SUPER_MASK|gdk::ModifierType::HYPER_MASK|gdk::ModifierType::META_MASK. In other words, Control, Shift, Alt, Super, Hyper and Meta. Other modifiers will by default be ignored byAccelGroup. - accelerator_
valid - Determines whether a given keyval and modifier mask constitute
a valid keyboard accelerator. For example, the
GDK_KEY_akeyval plusgdk::ModifierType::CONTROL_MASKis valid - this is a “Ctrl+a” accelerator. But, you can’t, for instance, use theGDK_KEY_Control_Lkeyval as an accelerator. - binary_
age - Returns the binary age as passed to
libtoolwhen building the GTK+ library the process is running against. Iflibtoolmeans nothing to you, don’t worry about it. - bindings_
activate - Find a key binding matching
keyvalandmodifiersand activate the binding onobject. - bindings_
activate_ event - Looks up key bindings for
objectto find one matchingevent, and if one was found, activate it. - cairo_
should_ draw_ window - This function is supposed to be called in
drawimplementations for widgets that support multiple windows.crmust be untransformed from invoking of the draw function. This function will returntrueif the contents of the givenwindoware supposed to be drawn andfalseotherwise. Note that when the drawing was not initiated by the windowing system this function will returntruefor all windows, so you need to draw the bottommost window first. Also, do not use “else if” statements to check which window should be drawn. - cairo_
transform_ to_ window - Transforms the given cairo context
crthat fromwidget-relative coordinates towindow-relative coordinates. If thewidget’s window is not an ancestor ofwindow, no modification will be applied. - check_
version - Checks that the GTK+ library in use is compatible with the
given version. Generally you would pass in the constants
GTK_MAJOR_VERSION,GTK_MINOR_VERSION,GTK_MICRO_VERSIONas the three arguments to this function; that produces a check that the library in use is compatible with the version of GTK+ the application or module was compiled against. - current_
event - Obtains a copy of the event currently being processed by GTK+.
- current_
event_ device - If there is a current event and it has a device, return that
device, otherwise return
None. - current_
event_ state - If there is a current event and it has a state field, place
that state field in
stateand returntrue, otherwise returnfalse. - current_
event_ time - If there is a current event and it has a timestamp,
return that timestamp, otherwise return
GDK_CURRENT_TIME. - debug_
flags - Returns the GTK+ debug flags.
- default_
language - Returns the
pango::Languagefor the default language currently in effect. (Note that this can change over the life of an application.) The default language is derived from the current locale. It determines, for example, whether GTK+ uses the right-to-left or left-to-right text direction. - device_
grab_ add - Adds a GTK+ grab on
device, so all the events ondeviceand its associated pointer or keyboard (if any) are delivered towidget. If theblock_othersparameter istrue, any other devices will be unable to interact withwidgetduring the grab. - device_
grab_ remove - Removes a device grab from the given widget.
- disable_
setlocale - Prevents
gtk_init(),gtk_init_check(),gtk_init_with_args()andgtk_parse_args()from automatically callingsetlocale (LC_ALL, ""). You would want to use this function if you wanted to set the locale for your program to something other than the user’s locale, or if you wanted to set different values for different locale categories. - event_
widget - If
eventisNoneor the event was not associated with any widget, returnsNone, otherwise returns the widget that received the event originally. - events_
pending - Checks if any events are pending.
- false_
- grab_
get_ current - Queries the current grab of the default window group.
- init
- Tries to initialize GTK+.
- interface_
age - Returns the interface age as passed to
libtoolwhen building the GTK+ library the process is running against. Iflibtoolmeans nothing to you, don’t worry about it. - is_
initialized - Returns
trueif GTK has been initialized. - is_
initialized_ main_ thread - Returns
trueif GTK has been initialized and this is the main thread. - locale_
direction - Get the direction of the current locale. This is the expected reading direction for text and UI.
- main
- Runs the main loop until
gtk_main_quit()is called. - main_
do_ event - Processes a single GDK event.
- main_
iteration - Runs a single iteration of the mainloop.
- main_
iteration_ do - Runs a single iteration of the mainloop.
If no events are available either return or block depending on
the value of
blocking. - main_
level - Asks for the current nesting level of the main loop.
- main_
quit - major_
version - Returns the major version number of the GTK+ library. (e.g. in GTK+ version 3.1.5 this is 3.)
- micro_
version - Returns the micro version number of the GTK+ library. (e.g. in GTK+ version 3.1.5 this is 5.)
- minor_
version - Returns the minor version number of the GTK+ library. (e.g. in GTK+ version 3.1.5 this is 1.)
- print_
run_ page_ setup_ dialog - Runs a page setup dialog, letting the user modify the values from
page_setup. If the user cancels the dialog, the returnedPageSetupis identical to the passed inpage_setup, otherwise it contains the modifications done in the dialog. - print_
run_ page_ setup_ dialog_ async - Runs a page setup dialog, letting the user modify the values from
page_setup. - propagate_
event - Sends an event to a widget, propagating the event to parent widgets if the event remains unhandled.
- render_
activity - Renders an activity indicator (such as in
Spinner). The stateStateFlags::CHECKEDdetermines whether there is activity going on. - render_
arrow - Renders an arrow pointing to
angle. - render_
background - Renders the background of an element.
- render_
background_ get_ clip - Returns the area that will be affected (i.e. drawn to) when
calling
render_background()for the givencontextand rectangle. - render_
check - Renders a checkmark (as in a
CheckButton). - render_
expander - Renders an expander (as used in
TreeViewandExpander) in the area defined byx,y,width,height. The stateStateFlags::CHECKEDdetermines whether the expander is collapsed or expanded. - render_
extension - Renders a extension (as in a
Notebooktab) in the rectangle defined byx,y,width,height. The side where the extension connects to is defined bygap_side. - render_
focus - Renders a focus indicator on the rectangle determined by
x,y,width,height. - render_
frame - Renders a frame around the rectangle defined by
x,y,width,height. - render_
frame_ gap Deprecated - Renders a frame around the rectangle defined by (
x,y,width,height), leaving a gap on one side.xy0_gapandxy1_gapwill mean X coordinates forPositionType::TopandPositionType::Bottomgap sides, and Y coordinates forPositionType::LeftandPositionType::Right. - render_
handle - Renders a handle (as in
GtkHandleBox,PanedandWindow’s resize grip), in the rectangle determined byx,y,width,height. - render_
icon - Renders the icon in
pixbufat the specifiedxandycoordinates. - render_
icon_ surface - Renders the icon in
surfaceat the specifiedxandycoordinates. - render_
insertion_ cursor - Draws a text caret on
crat the specified index oflayout. - render_
layout - Renders
layouton the coordinatesx,y - render_
line - Renders a line from (x0, y0) to (x1, y1).
- render_
option - Renders an option mark (as in a
RadioButton), theStateFlags::CHECKEDstate will determine whether the option is on or off, andStateFlags::INCONSISTENTwhether it should be marked as undefined. - render_
slider - Renders a slider (as in
Scale) in the rectangle defined byx,y,width,height.orientationdefines whether the slider is vertical or horizontal. - rgb_
to_ hsv - Converts a color from RGB space to HSV.
- selection_
add_ target - Appends a specified target to the list of supported targets for a given widget and selection.
- selection_
clear_ targets - Remove all targets registered for the given selection for the widget.
- selection_
convert - Requests the contents of a selection. When received, a “selection-received” signal will be generated.
- selection_
owner_ set - Claims ownership of a given selection for a particular widget,
or, if
widgetisNone, release ownership of the selection. - selection_
owner_ set_ for_ display - Claim ownership of a given selection for a particular widget, or,
if
widgetisNone, release ownership of the selection. - selection_
remove_ all - Removes all handlers and unsets ownership of all selections for a widget. Called when widget is being destroyed. This function will not generally be called by applications.
- set_
debug_ flags - Sets the GTK+ debug flags.
- set_
initialized ⚠ - Informs this crate that GTK has been initialized and the current thread is the main one.
- show_
uri_ on_ window - This is a convenience function for launching the default application to show the uri. The uri must be of a form understood by GIO (i.e. you need to install gvfs to get support for uri schemes such as http:// or ftp://, as only local files are handled by GIO itself). Typical examples are
- targets_
include_ image - Determines if any of the targets in
targetscan be used to provide agdk_pixbuf::Pixbuf. - targets_
include_ rich_ text - Determines if any of the targets in
targetscan be used to provide rich text. - targets_
include_ text - Determines if any of the targets in
targetscan be used to provide text. - targets_
include_ uri - Determines if any of the targets in
targetscan be used to provide an uri list. - test_
find_ label - This function will search
widgetand all its descendants for a GtkLabel widget with a text string matchinglabel_pattern. Thelabel_patternmay contain asterisks “*” and question marks “?” as placeholders,g_pattern_match()is used for the matching. Note that locales other than “C“ tend to alter (translate” label strings, so this function is genrally only useful in test programs with predetermined locales, seegtk_test_init()for more details. - test_
find_ sibling - This function will search siblings of
base_widgetand siblings of its ancestors for all widgets matchingwidget_type. Of the matching widgets, the one that is geometrically closest tobase_widgetwill be returned. The general purpose of this function is to find the most likely “action” widget, relative to another labeling widget. Such as finding a button or text entry widget, given its corresponding label widget. - test_
find_ widget - This function will search the descendants of
widgetfor a widget of typewidget_typethat has a label matchinglabel_patternnext to it. This is most useful for automated GUI testing, e.g. to find the “OK” button in a dialog and synthesize clicks on it. However seetest_find_label(),test_find_sibling()andgtk_test_widget_click()for possible caveats involving the search of such widgets and synthesizing widget events. - test_
register_ all_ types - Force registration of all core Gtk+ and Gdk object types.
This allowes to refer to any of those object types via
g_type_from_name()after calling this function. - test_
widget_ send_ key - This function will generate keyboard press and release events in
the middle of the first GdkWindow found that belongs to
widget. For windowless widgets likeButton(which returnsfalsefromWidgetExt::has_window()), this will often be an input-only event window. For other widgets, this is usually widget->window. Certain caveats should be considered when using this function, in particular because the mouse pointer is warped to the key press location, seegdk_test_simulate_key()for details. - test_
widget_ wait_ for_ draw - Enters the main loop and waits for
widgetto be “drawn”. In this context that means it waits for the frame clock ofwidgetto have run a full styling, layout and drawing cycle. - tree_
get_ row_ drag_ data - Obtains a
tree_modelandpathfrom selection data of target typeGTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. This function can only be used ifselection_dataoriginates from the same process that’s calling this function, because a pointer to the tree model is being passed around. If you aren’t in the same process, then you’ll get memory corruption. In theTreeDragDestdrag_data_received handler, you can assume that selection data of typeGTK_TREE_MODEL_ROWis in from the current process. The returned path must be freed withgtk_tree_path_free(). - tree_
set_ row_ drag_ data - Sets selection data of target type
GTK_TREE_MODEL_ROW. Normally used in a drag_data_get handler. - true_