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.92.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 gtk_sys as 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 - 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); ]|
- 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 - label ╰── accelerator ]|
- 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 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, the [Builder`]crate::Builder must have been given the gettext domain to use.- 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
- ` tag has been added to the format allowing one to define a widget class’s components. See the [GtkWidget documentation][composite-templates] for details.
- 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 - iter); } } } } return have_focus; } ]|
- 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 - static void my_combo_box_init (MyComboBox *b) { GtkCellRenderer *cell;
- 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 - ]|
- Check
Menu Item - ]|
- 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 - combobox ├── box.linked │ ├── entry.combo │ ╰── button.combo │ ╰── box │ ╰── arrow ╰── window.popup ]|
- Combo
BoxText - combobox ╰── box.linked ├── entry.combo ├── button.combo ╰── window.popup ]|
- Container
- ]|
- 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
Flags - Flags used to influence dialog construction.
- Drawing
Area - color);
- Editable
- ;
- Entry
- entry[.read-only][.flat][.warning][.error] ├── image.left ├── image.right ├── undershoot.left ├── undershoot.right ├── [selection] ├── [progress[.pulse]] ╰── [window.popup] ]|
- 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
- ]|
- File
Chooser - GtkWidget *toggle;
- File
Chooser Button - widget.
- 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
Filter - ]|
- 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
- ┊ ╰── [rubberband] ]|
- 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
- ]|
- GLArea
- error); if (error != NULL) { gtk_gl_area_set_error (area, error); g_error_free (error); return; } } ]|
- 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 - 1
touch/button press through
set_area(), so any click happening outside that area is considered to be a first click of its own. - 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(). - IMContext
- GtkIMContext * im_module_create(const gchar *context_id);
]|
This function should return a pointer to a newly created instance of the
IMContextsubclass identified bycontext_id. The context ID is the same as specified in theGtkIMContextInfoarray returned byim_module_list(). - 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 - message); g_error_free (error); } else { // Use the pixbuf g_object_unref (pixbuf); } ]|
- Icon
View - iconview.view ╰── [rubberband] ]|
- Image
- y);
- InfoBar
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 dialogsaction_area`).- 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
- for more…“; GtkWidget *label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), text); ]|
- 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 - levelbar[.discrete] ╰── trough ├── block.filled.level-name ┊ ├── block.empty ┊ ]|
- 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
- list ╰── row[.activatable] ]|
- List
BoxRow - Properties
- List
Store - ]|
- 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
- ╰── arrow.bottom ]|
- 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 - ╰── [arrow.right] ]|
- Menu
Shell - A
MenuShellis the abstract base class used to derive theMenuandMenuBarsubclasses. - Menu
Tool Button - ]|
- Message
Dialog - 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)); - 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 - ╰── check ]|
- 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
- ]|
- 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
- ` element.
- 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 - static GtkPrintSettings *settings = NULL; static GtkPageSetup *page_setup = NULL;
- Paned
- 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);
- 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. - Popover
- ]|
- Popover
Menu - ]|
- Print
Context - static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, int page_nr) { cairo_t *cr; PangoLayout *layout; PangoFontDescription *desc;
- Print
Operation - static GtkPrintSettings *settings = NULL;
- 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 - progressbar[.osd] ├── [text] ╰── trough[.empty][.full] ╰── progress[.pulse] ]|
- Radio
Button - void create_radio_buttons (void) {
- Radio
Menu Item - ]|
- 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 - GtkWidget *dialog; gint res;
- 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 - ]|
- 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 - message); g_error_free (error); } else { // Use the info object gtk_recent_info_unref (info); } ]|
- 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
- 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 ]|
- 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
- scrollbar[.fine-tune] ╰── contents ├── [button.up] ├── [button.down] ├── trough │ ╰── slider ├── [button.up] ╰── [button.down] ]|
- Scrolled
Window - GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); GtkWidget *child_widget = gtk_button_new ();
- 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 - GLib type: Boxed type with copy-on-clone semantics.
- 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
- argv);
- 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 - ]|
- Socket
gdk_backend=x11 - GtkWidget *socket = gtk_socket_new (); gtk_widget_show (socket); gtk_container_add (GTK_CONTAINER (parent), socket);
- Spin
Button - // Provides a function to retrieve a floating point value from a // GtkSpinButton, and creates a high precision spin button.
- 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
- switch ╰── slider ]|
- 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 - ]|
- Text
View - textview.view ├── border.top ├── border.left ├── text │ ╰── [selection] ├── border.right ├── border.bottom ╰── [window.popup] ]|
- Tick
Callback Id - Toggle
Button - static void output_state (GtkToggleButton *source, gpointer user_data) {
printf (“Active:
d\n”, gtk_toggle_button_get_active (source)); } - 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 - 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;
- 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 - iter); row_count++; } ]|
- 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 - modified_data, -1); g_free (modified_data); } ]|
- Tree
Path - GLib type: Boxed type with copy-on-clone semantics.
- 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 - ]|
- Tree
View - │ ╰── [rubberband] ]|
- 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
- // 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”); }
- Widget
Path - { GtkWidgetPath *path; guint pos;
- Window
- ]|
- 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 - GNOME Human Interface Guidelines.
- 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 - 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 - -`.
- 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 - // computation going on…
- false_
- Analogical to
true_(), this function does nothing but always returnsfalse. - 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 - setlocale (LC_ALL, new_locale); direction = gtk_get_locale_direction (); gtk_widget_set_default_direction (direction); ]|
- 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 - window.
Certain caveats should be considered when using this function, in
particular because the mouse pointer is warped to the key press
location, see
gdk_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_
- argv);