Expand description
Rust GTK 4 bindings
The project website is here.
Rust bindings of GTK 4, part of gtk4-rs.
This library contains safe Rust bindings for GTK 4, a multi-platform GUI toolkit. It is a part of gtk-rs.
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.
For a gentle introduction to gtk-rs we recommend the online book GUI development with Rust and GTK 4.
See also:
- gtk-rs project overview
- General GLibfamily types and object system overview
- GTK documentation
- GTK Visual Index
Minimum supported Rust version
Currently, the minimum supported Rust version is 1.70.
“Hello, World!” example program
GTK needs to be initialized before use by calling init. Creating an
Application will call init for you.
The gtk4 crate is usually renamed to gtk. You can find an example in
the features section for how to do this globally in your Cargo.toml.
use gtk4 as gtk;
use gtk::prelude::*;
use gtk::{glib, Application, ApplicationWindow};
fn main() -> glib::ExitCode {
    let app = Application::builder()
        .application_id("org.example.HelloWorld")
        .build();
    app.connect_activate(|app| {
        // We create the main window.
        let window = ApplicationWindow::builder()
            .application(app)
            .default_width(320)
            .default_height(200)
            .title("Hello, World!")
            .build();
        // Show the window.
        window.present();
    });
    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 gtk4 as gtk;
use gtk::prelude::*;
use gtk::{glib, Application, ApplicationWindow, Button};
fn main() -> glib::ExitCode {
    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.set_child(Some(&button));
        window.present();
    });
    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 4.0 APIs. You can access additional
functionality by selecting one of the v4_2, v4_4, etc. features.
Cargo.toml example:
[dependencies.gtk]
package = "gtk4"
version = "0.x.y"
features = ["v4_2"]
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
- The Rust API Stable/Development
- Book Stable/Development
- Examples
- The C API
- GTK Installation Instructions
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/gtk4-rs.git", package = "gtk4" }
Avoid mixing versioned and git crates like this:
# This will not compile
[dependencies]
gdk = {version = "0.1", package = "gdk4"}
gtk = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gtk4" }
Features
| Feature | Description | 
|---|---|
| v4_14 | Enable the new APIs part of GTK 4.14 | 
| v4_12 | Enable the new APIs part of GTK 4.12 | 
| v4_10 | Enable the new APIs part of GTK 4.10 | 
| v4_8 | Enable the new APIs part of GTK 4.8 | 
| v4_6 | Enable the new APIs part of GTK 4.6 | 
| v4_4 | Enable the new APIs part of GTK 4.4 | 
| v4_2 | Enable the new APIs part of GTK 4.2 | 
| gnome_45 | Enable all version feature flags of this crate and its dependencies to match the GNOME 45 SDK | 
| gnome_44 | Enable all version feature flags of this crate and its dependencies to match the GNOME 44 SDK | 
| gnome_43 | Enable all version feature flags of this crate and its dependencies to match the GNOME 43 SDK | 
| gnome_42 | Enable all version feature flags of this crate and its dependencies to match the GNOME 42 SDK | 
| unsafe-assume-initialized | Disable checks that gtk is initialized, for use in C ABI libraries | 
| xml_validation | Enable xml_validationfeature of gtk4-macros | 
| blueprint | Enable blueprintfeature of gtk4-macros | 
See Also
License
The Rust bindings of gtk4 are available under the MIT License, please refer to it.
Re-exports
- pub use subclass::widget::TemplateChild;
- pub use ffi;
- pub use cairo;
- pub use gdk;
- pub use gdk_pixbuf;
- pub use gio;
- pub use glib;
- pub use graphene;
- pub use gsk;
- pub use pango;
Modules
- Builder pattern types.
- Traits intended for blanket imports.
- Traits intended for creating custom types.
Structs
- ATContextis an abstract class provided by GTK to communicate to platform-specific assistive technologies API.
- TheAboutDialogoffers a simple way to display information about a program.
- Accessibleis an interface for describing UI elements for Assistive Technologies.
- AccessibleRangev4_10This interface describes ranged controls, e.g. controls which have a single value within an allowed range and that can optionally be changed by the user.
- ActionBaris designed to present contextual actions.
- TheActionableinterface provides a convenient way of associating widgets with actions.
- AShortcutActionthat calls gtk_widget_activate().
- Adjustmentis a model for a numeric value.
- AlertDialogv4_10AAlertDialogobject collects the arguments that are needed to present a message to the user.
- AShortcutTriggerthat combines two triggers.
- AnyFiltermatches an item when at least one of its filters matches.
- AppChooserDeprecatedThe application selection widgets should be implemented according to the design of each platform and/or application requiring them.AppChooseris an interface for widgets which allow the user to choose an application.
- AppChooserButtonDeprecatedThe application selection widgets should be implemented according to the design of each platform and/or application requiring them. TheAppChooserButtonlets the user select an application.
- AppChooserDialogDeprecatedThe application selection widgets should be implemented according to the design of each platform and/or application requiring them.AppChooserDialogshows aAppChooserWidgetinside aDialog.
- AppChooserWidgetDeprecatedThe application selection widgets should be implemented according to the design of each platform and/or application requiring them.AppChooserWidgetis a widget for selecting applications.
- Applicationis a high-level API for writing applications.
- Types of user actions that may be blocked byApplication.
- AspectFramepreserves the aspect ratio of its child.
- AssistantDeprecatedThis widget will be removed in GTK 5Assistantis used to represent a complex as a series of steps.
- AssistantPageDeprecatedThis object will be removed in GTK 5AssistantPageis an auxiliary object used by `GtkAssistant.
- BinLayoutis a- LayoutManagersubclass useful for create “bins” of widgets.
- ABitsetrepresents a set of unsigned integers.
- An opaque, stack-allocated struct for iterating over the elements of aBitset.
- BookmarkListis a list model that wraps- GBookmarkFile.
- BoolFilterevaluates a boolean- Expressionto determine whether to include items.
- A struct that specifies a border around a rectangular area.
- TheBoxwidget arranges child widgets into a single row or column.
- BoxLayoutis a layout manager that arranges children in a single row or column.
- Buildableallows objects to extend and customize their deserialization from ui files.
- ABuilderreads XML descriptions of a user interface and instantiates the described objects.
- The list of flags that can be passed to gtk_builder_create_closure().
- BuilderListItemFactoryis a- ListItemFactorythat creates widgets by instantiating- BuilderUI templates.
- An implementation ofBuilderScopethat can bind Rust callbacks.
- BuilderScopeis an interface to provide language binding support to- Builder.
- TheButtonwidget is generally used to trigger a callback function that is called when the button is pressed.
- Calendaris a widget that displays a Gregorian calendar, one month at a time.
- AShortcutActionthat invokes a callback.
- CellAreaDeprecatedList views use widgets for displaying their contents An abstract class for laying outCellRenderers
- CellAreaBoxDeprecatedList views use widgets for displaying their contents A cell area that renders GtkCellRenderers into a row or a column
- CellAreaContextDeprecatedThis object will be removed in GTK 5 Stores geometrical information for a series of rows in a GtkCellArea
- CellEditableDeprecatedList views use widgets for displaying their contents. SeeEditablefor editable text widgets Interface for widgets that can be used for editing cells
- CellLayoutDeprecatedList views use widgets to display their contents. SeeLayoutManagerfor layout manager delegate objects An interface for packing cells
- CellRendererDeprecatedList views use widgets for displaying their contents An object for rendering a single cell
- CellRendererAccelDeprecatedApplications editing keyboard accelerators should provide their own implementation according to platform design guidelines Renders a keyboard accelerator in a cell
- CellRendererComboDeprecatedList views use widgets to display their contents. You should useDropDowninstead Renders a combobox in a cell
- CellRendererPixbufDeprecated
- CellRendererProgressDeprecatedList views use widgets to display their contents. You should useProgressBarinstead Renders numbers as progress bars
- CellRendererSpinDeprecatedList views use widgets to display their contents. You should useSpinButtoninstead Renders a spin button in a cell
- CellRendererSpinnerDeprecatedList views use widgets to display their contents. You should useSpinnerinstead Renders a spinning animation in a cell
- Tells how a cell is to be rendered.
- CellRendererTextDeprecatedList views use widgets to display their contents. You should useInscriptionorLabelinstead Renders text in a cell
- CellRendererToggleDeprecatedList views use widgets to display their contents. You should useToggleButtoninstead Renders a toggle button in a cell
- CellViewDeprecatedList views use widgets to display their contents. You can useBoxinstead A widget displaying a single row of a GtkTreeModel
- CenterBoxarranges three children in a row, keeping the middle child centered as well as possible.
- CenterLayoutis a layout manager that manages up to three children.
- ACheckButtonplaces a label next to an indicator.
- An expression using a customGClosureto compute the value from its parameters.
- ColorButtonDeprecatedUseColorDialogButtoninstead TheColorButtonallows to open a color chooser dialog to change the color.
- ColorChooserDeprecatedUseColorDialogandColorDialogButtoninstead of widgets implementingColorChooserColorChooseris an interface that is implemented by widgets for choosing colors.
- ColorChooserDialogDeprecatedUseColorDialoginstead A dialog for choosing a color.
- ColorChooserWidgetDeprecatedDirect use ofColorChooserWidgetis deprecated. TheColorChooserWidgetwidget lets the user select a color.
- ColorDialogv4_10AColorDialogobject collects the arguments that are needed to present a color chooser dialog to the user, such as a title for the dialog and whether it should be modal.
- ColorDialogButtonv4_10TheColorDialogButtonis a wrapped around aColorDialogand allows to open a color chooser dialog to change the color.
- ColumnViewpresents a large dynamic list of items using multiple columns with headers.
- ColumnViewCellv4_12
- ColumnViewColumnrepresents the columns being added to a- ColumnView.
- ColumnViewRowv4_12ColumnViewRowis used byColumnViewto allow configuring how rows are displayed.
- ColumnViewSorterv4_10ColumnViewSorteris a sorter implementation that is geared towards the needs ofColumnView.
- ComboBoxDeprecated
- ComboBoxTextDeprecatedUseDropDownwith aStringListinstead AComboBoxTextis a simple variant ofComboBoxfor text-only use cases.
- A constant value in aExpression.
- Constraintdescribes a constraint between attributes of two widgets, expressed as a linear equation.
- AConstraintGuideis an invisible layout element in aConstraintLayout.
- A layout manager using constraints to describe relations between widgets.
- LayoutChildsubclass for children in a- ConstraintLayout.
- TheConstraintTargetinterface is implemented by objects that can be used as source or target inConstraints.
- CssProvideris an object implementing the- StyleProviderinterface for CSS.
- Defines a part of a CSS document.
- CustomFilterdetermines whether to include items with a callback.
- CustomSorteris a- Sorterimplementation that sorts via a callback function.
- Flags to use with gtk_set_debug_flags().
- DialogDeprecatedUseWindowinstead Dialogs are a convenient way to prompt the user for a small amount of input.
- Flags used to influence dialog construction.
- DirectoryListis a list model that wraps g_file_enumerate_children_async().
- DragSourceis an event controller to initiate Drag-And-Drop operations.
- DrawingAreais a widget that allows drawing with cairo.
- DropControllerMotionis an event controller tracking the pointer during Drag-and-Drop operations.
- DropDownis a widget that allows the user to choose an item from a list of options.
- DropTargetis an event controller to receive Drag-and-Drop operations.
- DropTargetAsyncis an event controller to receive Drag-and-Drop operations, asynchronously.
- Editableis an interface for text editing widgets.
- AEditableLabelis a label that allows users to edit the text by switching to an “edit mode”.
- TheEmojiChooseris used by text widgets such asEntryorTextViewto let users insert Emoji characters.
- Entryis a single line text entry widget.
- AEntryBufferhold the text displayed in aTextwidget.
- EntryCompletionDeprecatedEntryCompletionis an auxiliary object to provide completion functionality forEntry.
- EventControlleris the base class for event controllers.
- EventControllerFocusis an event controller to keep track of keyboard focus.
- EventControllerKeyis an event controller that provides access to key events.
- EventControllerLegacyis an event controller that provides raw access to the event stream.
- EventControllerMotionis an event controller tracking the pointer position.
- EventControllerScrollis an event controller that handles scroll events.
- Describes the behavior of aEventControllerScroll.
- EveryFiltermatches an item when each of its filters matches.
- Expanderallows the user to reveal its child by clicking on an expander triangle.
- Expressionprovides a way to describe references to values.
- An opaque structure representing a watchedExpression.
- FileChooserDeprecatedUseFileDialoginsteadFileChooseris an interface that can be implemented by file selection widgets.
- FileChooserDialogDeprecatedUseFileDialoginsteadFileChooserDialogis a dialog suitable for use with “File Open” or “File Save” commands.
- FileChooserNativeDeprecatedUseFileDialoginsteadFileChooserNativeis an abstraction of a dialog suitable for use with “File Open” or “File Save as” commands.
- FileChooserWidgetDeprecatedDirect use ofFileChooserWidgetis deprecatedFileChooserWidgetis a widget for choosing files.
- FileDialogv4_10AFileDialogobject collects the arguments that are needed to present a file chooser dialog to the user, such as a title for the dialog and whether it should be modal.
- FileFilterfilters files by name or mime type.
- FileLauncherv4_10AFileLauncherobject collects the arguments that are needed to open a file with an application.
- AFilterobject describes the filtering to be performed by aFilterListModel.
- FilterListModelis a list model that filters the elements of the underlying model according to a- Filter.
- Fixedplaces its child widgets at fixed positions and with fixed sizes.
- FixedLayoutis a layout manager which can place child widgets at fixed positions.
- LayoutChildsubclass for children in a- FixedLayout.
- FlattenListModelis a list model that concatenates other list models.
- AFlowBoxputs child widgets in reflowing grid.
- FlowBoxChildis the kind of widget that can be added to a- FlowBox.
- FontButtonDeprecatedUseFontDialogButtoninstead TheFontButtonallows to open a font chooser dialog to change the font.
- FontChooserDeprecatedUseFontDialogandFontDialogButtoninsteadFontChooseris an interface that can be implemented by widgets for choosing fonts.
- FontChooserDialogDeprecatedUseFontDialoginstead TheFontChooserDialogwidget is a dialog for selecting a font.
- Specifies the granularity of font selection that is desired in aFontChooser.
- FontChooserWidgetDeprecatedDirect use ofFontChooserWidgetis deprecated. TheFontChooserWidgetwidget lets the user select a font.
- FontDialogv4_10AFontDialogobject collects the arguments that are needed to present a font chooser dialog to the user, such as a title for the dialog and whether it should be modal.
- FontDialogButtonv4_10TheFontDialogButtonis wrapped around aFontDialogand allows to open a font chooser dialog to change the font.
- Frameis a widget that surrounds its child with a decorative frame and an optional label.
- GLAreais a widget that allows drawing with OpenGL.
- Gestureis the base class for gesture recognition.
- GestureClickis a- Gestureimplementation for clicks.
- GestureDragis a- Gestureimplementation for drags.
- GestureLongPressis a- Gesturefor long presses.
- GesturePanis a- Gesturefor pan gestures.
- GestureRotateis a- Gesturefor 2-finger rotations.
- GestureSingleis a- GtkGesturessubclass optimized for singe-touch and mouse gestures.
- GestureStylusis a- Gesturespecific to stylus input.
- GestureSwipeis a- Gesturefor swipe gestures.
- GestureZoomis a- Gesturefor 2-finger pinch/zoom gestures.
- Gridis a container which arranges its child widgets in rows and columns.
- GridLayoutis a layout manager which arranges child widgets in rows and columns.
- LayoutChildsubclass for children in a- GridLayout.
- GridViewpresents a large dynamic grid of items.
- HeaderBaris a widget for creating custom title bars for windows.
- IMContextdefines the interface for GTK input methods.
- IMContextSimpleis an input method supporting table-based input methods.
- IMMulticontextis an input method context supporting multiple, switchable input methods.
- Used to specify options for gtk_icon_theme_lookup_icon().
- Contains information found when looking up an icon inIconTheme.
- IconThemeprovides a facility for loading themed icons.
- IconViewDeprecated
- TheImagewidget displays an image.
- InfoBarDeprecated
- Describes hints that might be taken into account by input methods or applications.
- Inscriptionv4_8Inscriptionis a widget to show text in a predefined area.
- AShortcutTriggerthat triggers when a specific keyval and modifiers are pressed.
- TheLabelwidget displays a small amount of text.
- LayoutChildis the base class for objects that are meant to hold layout properties.
- Layout managers are delegate classes that handle the preferred size and the allocation of a widget.
- LevelBaris a widget that can be used as a level indicator.
- ALinkButtonis a button with a hyperlink.
- ListBaseis the abstract base class for GTK’s list widgets.
- ListBoxis a vertical list.
- ListBoxRowis the kind of widget that can be added to a- ListBox.
- ListHeaderv4_12ListHeaderis used by list widgets to represent the headers they display.
- ListItemis used by list widgets to represent items in a- gio::ListModel.
- AListItemFactorycreates widgets for the items taken from aGListModel.
- ListScrollFlagsv4_12List of actions to perform when scrolling to items in a list widget.
- ListStoreDeprecatedUseGio::ListStoreinstead A list-like data structure that can be used with theTreeView.
- ListViewpresents a large dynamic list of items.
- LockButtonDeprecatedThis widget will be removed in GTK 5LockButtonis a widget to obtain and revoke authorizations needed to operate the controls.
- AMapListModelmaps the items in a list model to different items.
- MediaControlsis a widget to show controls for a video.
- MediaFileimplements- MediaStreamfor files.
- MediaStreamis the integration point for media playback inside GTK.
- TheMenuButtonwidget is used to display a popup when clicked.
- MessageDialogDeprecatedUseAlertDialoginsteadMessageDialogpresents a dialog with some message text.
- AShortcutActionthat calls gtk_widget_mnemonic_activate().
- AShortcutTriggerthat triggers when a specific mnemonic is pressed.
- MountOperationis an implementation of- GMountOperation.
- MultiFilteris the base class for filters that combine multiple filters.
- MultiSelectionis a- SelectionModelthat allows selecting multiple elements.
- MultiSortercombines multiple sorters by trying them in turn.
- AShortcutActionthat activates an action by name.
- Nativeis the interface implemented by all widgets that have their own- gdk::Surface.
- Native dialogs are platform dialogs that don’t useDialog.
- AShortcutTriggerthat never triggers.
- NoSelectionis a- SelectionModelthat does not allow selecting anything.
- Notebookis a container whose children are pages switched between using tabs.
- NotebookPageis an auxiliary object used by- Notebook.
- AShortcutActionthat does nothing.
- NumericSorteris a- Sorterthat compares numbers.
- AGObjectvalue in aExpression.
- TheOrientableinterface is implemented by all widgets that can be oriented horizontally or vertically.
- Overlayis a container which contains a single main child, on top of which it can place “overlay” widgets.
- OverlayLayoutis the layout manager used by- Overlay.
- LayoutChildsubclass for children in a- OverlayLayout.
- Struct defining a pad action entry.
- PadControlleris an event controller for the pads found in drawing tablets.
- A range of pages to print.
- APageSetupobject stores the page size, orientation and margins.
- PageSetupUnixDialogLinuxPageSetupUnixDialogimplements a page setup dialog for platforms which don’t provide a native page setup dialog, like Unix.
- A widget with two panes, arranged either horizontally or vertically.
- PaperSizehandles paper sizes.
- AGParamSpecfor properties holding aExpression.
- PasswordEntryis an entry that has been tailored for entering secrets.
- AEntryBufferthat locks the underlying memory to prevent it from being swapped to disk.
- Flags that influence the behavior ofWidgetExt::pick().
- ThePicturewidget displays agdk::Paintable.
- Popoveris a bubble-like context popup.
- PopoverMenuis a subclass of- Popoverthat implements menu behavior.
- PopoverMenuBarpresents a horizontal bar of items that pop up popover menus when clicked.
- Flags that affect howPopoverMenuwidgets built from agio::MenuModelare created and displayed.
- PrintCapabilitiesLinuxSpecifies which features the print dialog should offer.
- APrintContextencapsulates context information that is required when drawing pages for printing.
- PrintJobLinuxAPrintJobobject represents a job that is sent to a printer.
- PrintOperationis the high-level, portable printing API.
- PrintOperationPreviewis the interface that is used to implement print preview.
- APrintSettingsobject represents the settings of a print dialog in a system-independent way.
- PrintUnixDialogLinuxPrintUnixDialogimplements a print dialog for platforms which don’t provide a native print dialog, like Unix.
- PrinterLinuxAPrinterobject represents a printer.
- ProgressBaris typically used to display the progress of a long running operation.
- AGObjectproperty value in aExpression.
- Rangeis the common base class for widgets which visualize an adjustment.
- Meta-data to be passed to gtk_recent_manager_add_full() when registering a recently used resource.
- RecentInfocontains the metadata associated with an item in the recently used files list.
- RecentManagermanages and looks up recently used files.
- ARequisitionrepresents the desired size of a widget. See GtkWidget’s geometry management section for more information.
- ARevealeranimates the transition of its child from invisible to visible.
- Rootis the interface implemented by all widgets that can act as a toplevel widget.
- AScaleis a slider control used to select a numeric value.
- ScaleButtonprovides a button which pops up a scale widget.
- ScrollInfov4_12TheScrollInfocan be used to provide more accurate data on how a scroll operation should be performed.
- Scrollableis an interface for widgets with native scrolling ability.
- TheScrollbarwidget is a horizontal or vertical scrollbar.
- ScrolledWindowis a container that makes its child scrollable.
- SearchBaris a container made to have a search entry.
- SearchEntryis an entry widget that has been tailored for use as a search entry.
- SectionModelv4_12SectionModelis an interface that adds support for sections to list models.
- SelectionFilterModelis a list model that presents the selection from a- SelectionModel.
- SelectionModelis an interface that add support for selection to list models.
- Separatoris a horizontal or vertical separator widget.
- Settingsprovides a mechanism to share global settings between applications.
- AShortcutdescribes a keyboard shortcut.
- ShortcutActionencodes an action that can be triggered by a keyboard shortcut.
- List of flags that can be passed to action activation.
- ShortcutControlleris an event controller that manages shortcuts.
- ShortcutLabeldisplays a single keyboard shortcut or gesture.
- TheShortcutManagerinterface is used to implement shortcut scopes.
- ShortcutTriggertracks how a- Shortcutshould be activated.
- AShortcutsGrouprepresents a group of related keyboard shortcuts or gestures.
- AShortcutsSectioncollects all the keyboard shortcuts and gestures for a major application mode.
- AShortcutsShortcutrepresents a single keyboard shortcut or gesture with a short text.
- AShortcutsWindowshows information about the keyboard shortcuts and gestures of an application.
- AShortcutAction that emits a signal.
- SignalListItemFactoryis a- ListItemFactorythat emits signals to manage listitems.
- SingleSelectionis a- SelectionModelthat allows selecting a single item.
- SizeGroupgroups widgets together so they all request the same size.
- SliceListModelis a list model that presents a slice of another model.
- Snapshotassists in creating- gsk::RenderNodes for widgets.
- AGListModelthat sorts the elements of an underlying model according to aSorter.
- Sorteris an object to describe sorting criteria.
- ASpinButtonis an ideal way to allow the user to set the value of some attribute.
- ASpinnerwidget displays an icon-size spinning animation.
- Stackis a container which only shows one of its children at a time.
- AStackSidebaruses a sidebar to switch betweenStackpages.
- TheStackSwitchershows a row of buttons to switch betweenStackpages.
- Describes a widget state.
- StatusbarDeprecated
- StringFilterdetermines whether to include items by comparing strings to a fixed search term.
- StringListis a list model that wraps an array of strings.
- StringObjectis the type of items in a- StringList.
- StringSorteris a- Sorterthat compares strings.
- StyleContextDeprecatedThe relevant API has been moved toWidgetwhere applicable; otherwise, there is no replacement for querying the style machinery. Stylable UI elements should use widgets.StyleContextstores styling information affecting a widget.
- Flags that modify the behavior of gtk_style_context_to_string().
- StyleProvideris an interface for style information used by- StyleContext.
- Switchis a “light switch” that has two states: on or off.
- SymbolicPaintableis an interface that support symbolic colors in paintables.
- TheTextwidget is a single-line text entry widget.
- Stores text and attributes for display in aTextView.
- ATextChildAnchoris a spot in aTextBufferwhere child widgets can be “anchored”.
- An iterator for the contents of aTextBuffer.
- ATextMarkis a position in aGtkTextbufferthat is preserved across modifications.
- Flags affecting how a search is done.
- A tag that can be applied to text contained in aTextBuffer.
- The collection of tags in aTextBuffer
- A widget that displays the contents of aTextBuffer.
- AToggleButtonis a button which remains “pressed-in” when clicked.
- Tooltipis an object representing a widget tooltip.
- TreeDragDestDeprecatedList views use widgets to display their contents. You can useDropTargetto implement a drop destination Interface for Drag-and-Drop destinations inTreeView.
- TreeDragSourceDeprecatedList views use widgets to display their contents. You can useDragSourceto implement a drag source Interface for Drag-and-Drop destinations inTreeView.
- TreeExpanderis a widget that provides an expander for a list.
- TreeListModelis a list model that can create child models on demand.
- TreeListRowis used by- TreeListModelto represent items.
- TreeListRowSorteris a special-purpose sorter that will apply a given sorter to the levels in a tree.
- TreeModelDeprecatedUsegio::ListModelinstead The tree interface used by GtkTreeView
- TreeModelFilterDeprecatedUseFilterListModelinstead. ATreeModelwhich hides parts of an underlying tree model
- TreeModelFlagsDeprecatedThese flags indicate various properties of aTreeModel.
- TreeModelSortDeprecatedUseSortListModelinstead A GtkTreeModel which makes an underlying tree model sortable
- An opaque structure representing a path to a row in a model.
- A GtkTreeRowReference tracks model changes so that it always refers to the same row (aTreePathrefers to a position, not a fixed row). Create a new GtkTreeRowReference with gtk_tree_row_reference_new().
- TreeSelectionDeprecatedUseSelectionModelinstead The selection object for GtkTreeView
- TreeSortableDeprecatedThere is no replacement for this interface. You should useSortListModelto wrap your list model instead The interface for sortable models used by GtkTreeView
- TreeStoreDeprecatedUseTreeListModelinstead A tree-like data structure that can be used with theTreeView.
- TreeViewDeprecatedUseListViewfor lists, andColumnViewfor tabular lists A widget for displaying both trees and lists
- TreeViewColumnDeprecatedUseColumnViewandColumnViewColumninstead ofTreeViewto show a tabular list A visible column in aTreeViewwidget
- UriLauncherv4_10AUriLauncherobject collects the arguments that are needed to open a uri with an application.
- Videois a widget to show a- MediaStreamwith media controls.
- Viewportimplements scrollability for widgets that lack their own scrolling capabilities.
- VolumeButtonDeprecatedThis widget will be removed in GTK 5VolumeButtonis aScaleButtonsubclass tailored for volume control.
- The base class for all widgets.
- WidgetPaintableis a- gdk::Paintablethat displays the contents of a widget.
- AWindowis a toplevel window which can contain other widgets.
- WindowControlsshows window frame controls.
- WindowGroupmakes group of windows behave like separate applications.
- WindowHandleis a titlebar area widget.
Enums
- The possible values for theAccessibleProperty::Autocompleteaccessible property.
- The possible values for theAccessibleState::Invalidaccessible state.
- The various platform states which can be queried usingAccessibleExt::platform_state().
- The possible accessible properties of aAccessible.
- The possible accessible relations of aAccessible.
- The accessible role for aAccessibleimplementation.
- The possible values for theAccessibleProperty::Sortaccessible property.
- The possible accessible states of aAccessible.
- The possible values for theAccessibleState::Pressedaccessible state.
- Controls how a widget deals with extra space in a single dimension.
- Used to indicate the direction in which an arrow should point.
- Determines the page role inside aAssistant.
- Baseline position in a row of widgets.
- Describes how the border of a UI element should be rendered.
- Error codes that identify various errors that can occur while usingBuilder.
- Prebuilt sets of buttons forDialog.
- The available modes foraccel-mode.
- Identifies how the user can interact with a particular cell.
- Collationv4_10Describes how aStringSorterturns strings into sort keys to compare them.
- The widget attributes that can be used when creating aConstraint.
- The relation between two terms of a constraint.
- The strength of a constraint, expressed as a symbolic constant.
- Domain for VFL parsing errors.
- ContentFitv4_8Controls how a content should be made to fit inside an allocation.
- Specifies which corner a child widget should be placed in when packed into aScrolledWindow
- Errors that can occur while parsing CSS.
- Warnings that can occur while parsing CSS.
- Passed to various keybinding signals for deleting text.
- DialogErrorv4_10Error codes in theGTK_DIALOG_ERRORdomain that can be returned by async dialog functions.
- Focus movement types.
- The identifiers forEditableproperties.
- Specifies the side of the entry at which an icon is placed.
- Describes the state of agdk::EventSequencein aGesture.
- Describes whether aFileChooseris being used to open existing files or to save to a possibly new file.
- These identify the various errors that can occur while callingFileChooserfunctions.
- Describes changes in a filter in more detail and allows objects using the filter to optimize refiltering items.
- Describes the known strictness of a filter.
- FontLevelv4_10The level of granularity for the font selection.
- Built-in icon sizes.
- Error codes forIconThemeoperations.
- An enum for determining where a dropped item goes.
- Describes the image data representation used by aImage.
- Describes primary purpose of the input widget.
- The different methods to handle text in #GtkInscription when it doesn’t fit the available space.
- Used for justifying the text inside aLabelwidget.
- Describes howLevelBarcontents should be rendered.
- The type of license for an application.
- ListTabBehaviorv4_12Used to configure the focus behavior in theGTK_DIR_TAB_FORWARDandGTK_DIR_TAB_BACKWARDdirection, like the Tab key in aListView.
- The type of message being displayed in aMessageDialog.
- Passed as argument to various keybinding signals for moving the cursor position.
- NaturalWrapModev4_6Options for selecting a different wrap mode for natural size requests.
- The parameter used in the action signals ofNotebook.
- Used to determine the layout of pages on a sheet when printing multiple pages per sheet.
- Describes the way two values can be compared.
- Represents the orientation of widgets and other objects.
- Defines how content overflowing a given area should be handled.
- Represents the packing location of a children in its parent.
- The type of a pad action.
- See also gtk_print_settings_set_orientation().
- See also gtk_print_job_set_page_set().
- Describes the panning direction of aGesturePan.
- Determines how the size should be computed to achieve the one of the visibility mode for the scrollbars.
- Describes which edge of a widget a certain feature is positioned at.
- See also gtk_print_settings_set_duplex().
- Error codes that identify various errors that can occur while using the GTK printing support.
- Determines what action the print operation should perform.
- The result of a print operation.
- See also gtk_print_job_set_pages()
- See also gtk_print_settings_set_quality().
- The status gives a rough indication of the completion of a running print operation.
- Describes limits of aEventControllerfor handling events targeting other widgets.
- Describes the stage at which events are fed into aEventController.
- Error codes forRecentManageroperations
- Predefined values for use as response ids in gtk_dialog_add_button().
- These enumeration values describe the possible transitions when the child of aRevealerwidget is shown or hidden.
- Passed as argument to various keybinding signals.
- Scrolling types.
- Defines the policy to be used in a scrollable widget when updating the scrolled window adjustments in a given orientation.
- Used to control what selections users are allowed to make.
- Determines how GTK handles the sensitivity of various controls, such as combo box buttons.
- Describes whereShortcuts added to aShortcutControllerget handled.
- GtkShortcutType specifies the kind of shortcut that is being described.
- The mode of the size group determines the directions in which the size group affects the requested sizes of its component widgets.
- Specifies a preference for height-for-width or width-for-height geometry management.
- SortColumnDeprecated
- Determines the direction of a sort.
- Describes changes in a sorter in more detail and allows users to optimize resorting.
- Describes the type of order that aSortermay produce.
- Determines whether the spin button displays values outside the adjustment bounds.
- The values of the GtkSpinType enumeration are used to specify the change to make in gtk_spin_button_spin().
- Possible transitions between pages in aStackwidget.
- Specifies how search strings are matched inside text.
- SymbolicColorv4_6The indexes of colors passed to symbolic color rendering, such asvfunc::Gtk::SymbolicPaintable::snapshot_symbolic.
- Values that can be passed to theWidgetImpl::system_setting_changed()vfunc.
- Reading directions for text.
- Granularity types that extend the text selection. Use theGtkTextView::extend-selectionsignal to customize the selection.
- Used to reference the layers ofTextViewfor the purpose of customized drawing with the ::snapshot_layer vfunc.
- Used to reference the parts ofTextView.
- The sizing method the column uses to determine its width. Please note thatAutosizeare inefficient for large views, and can make columns appear choppy.
- An enum for determining where a dropped row goes.
- Used to indicate which grid lines to draw in a tree view.
- See also gtk_print_settings_set_paper_width().
- Describes a type of line wrapping.
Constants
- An undefined value. The accessible attribute is either unset, or its value is undefined.
- The value used to refer to a guaranteed invalid position in aGListModel.
- Use this priority for functionality related to size allocation.
- A priority that can be used when adding aStyleProviderfor application-specific style information.
- The priority used for default style information that is used in the absence of themes.
- The priority used for style information provided viaSettings.
- The priority used for style information provided by themes.
- The priority used for the style information from$XDG_CONFIG_HOME/gtk-4.0/gtk.css.
- The priority at which the text view validates onscreen lines in an idle job in the background.
Statics
- The name used for the stock full offset included byLevelBar.
- The name used for the stock high offset included byLevelBar.
- The name used for the stock low offset included byLevelBar.
- Name for the A3 paper size.
- Name for the A4 paper size.
- Name for the A5 paper size.
- Name for the B5 paper size.
- Name for the Executive paper size.
- Name for the Legal paper size.
- Name for the Letter paper size.
- 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.
- The key used by the “Print to file” printer to store the directory to which the output should be written.
- The key used by the “Print to file” printer to store the format of the output. The supported values are “PS” and “PDF”.
- 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.
Functions
- Gets the modifier mask.
- Converts an accelerator keyval and modifier mask into a string which can be used to represent the accelerator to the user.
- Converts an accelerator keyval and modifier mask into a string that can be displayed to the user.
- Converts an accelerator keyval and modifier mask into a string parseable by gtk_accelerator_parse().
- Converts an accelerator keyval and modifier mask into a string parseable by gtk_accelerator_parse_with_keycode().
- Parses a string representing an accelerator.
- Parses a string representing an accelerator.
- Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator.
- Returns the binary age as passed tolibtool.
- Checks that the GTK library in use is compatible with the given version.
- Returns the GTK debug flags that are currently active.
- Returns thepango::Languagefor the default language currently in effect.
- enumerate_printersLinuxCalls a function for allPrinters.
- Converts a color from HSV space to RGB.
- Tries to initialize GTK.
- Returns the interface age as passed tolibtool.
- Returnstrueif GTK has been initialized.
- Returnstrueif GTK has been initialized and this is the main thread.
- Get the direction of the current locale. This is the expected reading direction for text and UI.
- Returns the major version number of the GTK library.
- Returns the micro version number of the GTK library.
- Returns the minor version number of the GTK library.
- 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 in @page_setup, otherwise it contains the modifications done in the dialog.
- Runs a page setup dialog, letting the user modify the values from @page_setup.
- render_activityDeprecatedRenders an activity indicator (such as inSpinner). The stateStateFlags::CHECKEDdetermines whether there is activity going on.
- render_arrowDeprecatedRenders an arrow pointing to @angle.
- render_backgroundDeprecatedRenders the background of an element.
- render_checkDeprecatedRenders a checkmark (as in aCheckButton).
- render_expanderDeprecatedRenders an expander (as used inTreeViewandExpander) in the area defined by @x, @y, @width, @height. The stateStateFlags::CHECKEDdetermines whether the expander is collapsed or expanded.
- render_focusDeprecatedRenders a focus indicator on the rectangle determined by @x, @y, @width, @height.
- render_frameDeprecatedRenders a frame around the rectangle defined by @x, @y, @width, @height.
- render_handleDeprecated
- render_iconDeprecatedRenders the icon in @texture at the specified @x and @y coordinates.
- render_layoutDeprecatedRenders @layout on the coordinates @x, @y
- render_lineDeprecatedRenders a line from (x0, y0) to (x1, y1).
- render_optionDeprecatedRenders an option mark (as in a radio button), theStateFlags::CHECKEDstate will determine whether the option is on or off, andStateFlags::INCONSISTENTwhether it should be marked as undefined.
- Converts a color from RGB space to HSV.
- Sets the GTK debug flags.
- Informs this crate that GTK has been initialized and the current thread is the main one.
- A convenience function for showing an application’s about dialog.
- show_uriDeprecatedThis function launches the default application for showing a given uri, or shows an error dialog if that fails.
- show_uri_fullDeprecatedThis function launches the default application for showing a given uri.
- show_uri_full_futureDeprecated
- Checks whether theAccessiblehas @property set.
- Checks whether theAccessiblehas @relation set.
- Checks whether theGtkAccessible:accessible-roleof the accessible is @role.
- Checks whether theAccessiblehas @state set.
- Return the type ids that have been registered after calling gtk_test_register_all_types().
- Force registration of all core GTK object types.
- Enters the main loop and waits for @widget to be “drawn”.
- tree_create_row_drag_contentDeprecatedCreates a content provider for dragging @path from @tree_model.
- tree_get_row_drag_dataDeprecatedObtains a @tree_model and @path from value of target typeGTK_TYPE_TREE_ROW_DATA.