Gtk4 Reference

Public interface

Base.parentFunction
parent(w::GtkWidget)

Returns the parent widget of w, or nothing if the widget has not been set as the child of another widget (or is a toplevel widget, like a GtkWindow).

See also toplevel.

Related GTK function: gtk_widget_get_parent()

source
Gtk4.activateMethod
activate(w::GtkWidget)

Activates widgets like buttons, menu items, etc. that support being activated. Returns false if the widget is not activatable.

Related GTK function: gtk_widget_activate()

source
Gtk4.ask_dialogFunction
ask_dialog(question::AbstractString, parent = nothing; timeout = -1)

Create a dialog with a message question and two buttons "No" and "Yes". Returns true if "Yes" is selected and false if "No" is selected or the dialog (or its parent window parent) is closed. The optional input timeout (disabled by default) can be used to set a time in seconds after which the dialog will close and false will be returned.

source
Gtk4.bufferMethod
buffer(iter::Union{Ref{_GtkTextIter}, _GtkTextIter})

Returns the buffer associated with iter.

source
Gtk4.configure!Method
configure!(adj::GtkAdjustment; value = nothing, lower = nothing, upper = nothing, step_increment = nothing, page_increment = nothing, page_size = nothing)

Sets all properties of an adjustment, while only resulting in one emission of the changed signal. If an argument is nothing, it is not changed.

Related GTK function: gtk_adjustment_configure()

source
Gtk4.configure!Method
configure!(sb::GtkSpinButton; adj = nothing, climb_rate = nothing, digits = nothing)

Sets the adjustment adj, the climb_rate, and the number of digits of a GtkSpinButton. If an argument is nothing, it is not changed.

Related GTK function: gtk_spin_button_configure()

source
Gtk4.create_markMethod
create_mark(buffer::GtkTextBuffer, mark_name, it::TI, left_gravity::Bool)
create_mark(buffer::GtkTextBuffer, it::TI)

Impements gtk_text_buffer_create_mark.

source
Gtk4.info_dialogFunction
info_dialog(message::AbstractString, parent = nothing; timeout = -1)

Create a dialog with an informational message message. Returns when the dialog (or its parent window parent) is closed. The optional input timeout (disabled by default) can be used to set a time in seconds after which the dialog will close and false will be returned.

source
Gtk4.input_dialogFunction
input_dialog(message::AbstractString, entry_default::AbstractString, buttons = (("Cancel", 0), ("Accept", 1)), parent = nothing; timeout = -1)

Create a dialog with a message message and a text entry. Returns the string in the entry when the "Accept" button is pressed, or entry_default if "Cancel" is pressed or the dialog or its parent window parent is closed. The optional input timeout (disabled by default) can be used to set a time in seconds after which the dialog will close and entry_default will be returned.

source
Gtk4.open_dialogFunction
open_dialog(title::AbstractString, parent = nothing, filters::Union{AbstractVector, Tuple} = String[]; timeout = -1, multiple = false, start_folder = "")

Create a dialog for choosing a file or folder to be opened. Returns the path chosen by the user, or "" if "Cancel" is pressed or the dialog or its parent window parent is closed. The dialog title is set using title. The argument filters can be used to show only directory contents that match certain file extensions.

Keyword arguments: timeout: The optional input timeout (disabled by default) can be used to set a time in seconds after which the dialog will close and "" will be returned. multiple: if true, multiple files can be selected, and a list of file paths is returned rather than a single path. start_folder: if set, the dialog will start out browsing a particular folder. Otherwise GTK will decide.

source
Gtk4.place_cursorMethod
place_cursor(buffer::GtkTextBuffer, it::_GtkTextIter)
place_cursor(buffer::GtkTextBuffer, pos::Int)

Place the cursor at indicated position.

source
Gtk4.presentMethod
present(win::GtkWindow)
present(win::GtkWindow, timestamp)

Presents a window to the user. Usually means move it to the front. According to the GTK docs, this function "should not be used" without including a timestamp for the user's request.

Related GTK function: gtk_window_present() Related GTK function: gtk_window_present_with_time()

source
Gtk4.save_dialogFunction
save_dialog(title::AbstractString, parent = nothing, filters::Union{AbstractVector, Tuple} = String[]; timeout = -1, start_folder = "")

Create a dialog for choosing a file to be saved to. Returns the path chosen by the user, or "" if "Cancel" is pressed or the dialog or its parent window parent is closed. The window title is set using title. The argument filters can be used to show only directory contents that match certain file extensions.

Keyword arguments: timeout: The optional input timeout (disabled by default) can be used to set a time in seconds after which the dialog will close and "" will be returned. start_folder: if set, the dialog will start out browsing a particular folder. Otherwise GTK will decide.

source
Gtk4.screen_sizeFunction
screen_size(widget=nothing)

Returns a tuple (width,height) that gives the primary monitor size for the display where widget is being displayed, or the default display if widget is unrealized or not given.

source
Gtk4.scroll_toMethod
scroll_to(view::GtkTextView, mark::GtkTextMark, within_margin::Real,
               use_align::Bool, xalign::Real, yalign::Real)

scroll_to(view::GtkTextView, iter::TI, within_margin::Real,
          use_align::Bool, xalign::Real, yalign::Real)

Implements gtk_text_view_scroll_to_mark and gtk_text_view_scroll_to_iter.

source
Gtk4.searchFunction
search(buffer::GtkTextBuffer, str::AbstractString, direction = :forward,
    flag = GtkTextSearchFlags.GTK_TEXT_SEARCH_TEXT_ONLY)

Search text str in buffer in direction :forward or :backward starting from the cursor position in the buffer.

Returns a tuple (found, start, stop) where found indicates whether the search was successful and start and stop are _GtkTextIters containing the location of the match.

source
Gtk4.select_rangeMethod
select_range(buffer::GtkTextBuffer, ins::TI, bound::TI)
select_range(buffer::GtkTextBuffer, range::GtkTextRange)

Select the text in buffer accorind to _GtkTextIter ins and bound.

Implements gtk_text_buffer_select_range.

source
Gtk4.selection_boundsMethod
selection_bounds(buffer::GtkTextBuffer)

Returns a tuple (selected, start, stop) indicating if text is selected in the buffer, and if so sets the _GtkTextIter start and stop to point to the selected text.

Implements gtk_text_buffer_get_selection_bounds.

source
Gtk4.widgetFunction
widget(c::GtkEventController)

Returns the widget associated with an event controller.

source
Gtk4.@load_builderMacro
@load_builder(b::GtkBuilder)

Loads all GtkBuildable objects from a GtkBuilder object and assigns them to Julia variables in the current scope. GtkBuilder ID's are mapped onto Julia variable names.

source

Private methods

Base.skipMethod
skip(iter::Ref{_GtkTextIter}, count::Integer, what::Symbol)

Moves iter according to the operation specified by what and count. Operations are :

  • :chars (gtk_text_iter_forward_chars)
  • :lines (gtk_text_iter_forward_lines)
  • :words (gtk_text_iter_forward_word_ends)
  • :word_cursor_positions (gtk_text_iter_forward_cursor_positions)
  • :sentences (gtk_text_iter_forward_sentence_ends)
  • :visible_words (gtk_text_iter_forward_visible_word_ends)
  • :visible_cursor_positions (gtk_text_iter_forward_visible_cursor_positions)
  • :visible_lines (gtk_text_iter_forward_visible_lines)
  • :line_ends (gtk_text_iter_forward_visible_lines)
source
Base.skipMethod
skip(iter::Ref{_GtkTextIter}, count::Integer)

Moves iter count characters. Returns a Bool indicating if the move was successful.

source
Base.skipMethod
skip(iter::Ref{_GtkTextIter}, what::Symbol)

Moves iter according to the operation specified by what. Operations are :

  • :forward_line (gtk_text_iter_forward_line)
  • :backward_line (gtk_text_iter_backward_line)
  • :forward_to_line_end (gtk_text_iter_forward_to_line_end)
  • :backward_word_start (gtk_text_iter_forward_word_end)
  • :forward_word_end (gtk_text_iter_backward_word_start)
  • :backward_sentence_start (gtk_text_iter_backward_sentence_start)
  • :forward_sentence_end (gtk_text_iter_forward_sentence_end)
source
Gtk4.backward_searchMethod
backward_search(iter::Ref{_GtkTextIter},
    str::AbstractString, start::Ref{_GtkTextIter},
    stop::Ref{_GtkTextIter}, limit::Ref{_GtkTextIter}, flag::Int32)

Implements gtk_text_iter_backward_search.

source
Gtk4.buffer_to_window_coordsFunction
buffer_to_window_coords(view::GtkTextView, buffer_x::Integer, buffer_y::Integer, wintype::Integer = 0)

Implements gtk_text_view_buffer_to_window_coords.

source
Gtk4.char_offsetMethod
char_offset(iter::Union{Ref{_GtkTextIter}, _GtkTextIter})

Returns the offset of iter (one-based index).

source
Gtk4.find_controllerMethod
find_controller(w::GtkWidget, ::Type{T}) where T <: GtkEventController

Returns an event controller of type T connected to a widget, or nothing if one doesn't exist. This function is intended for testing purposes (to simulate events) and is not recommended otherwise, as there is a performance penalty for creating a list of a widget's event controllers.

Related GTK function: gtk_widget_observe_controllers)

source
Gtk4.forward_searchMethod
forward_search(iter::Ref{_GtkTextIter},
    str::AbstractString, start::Ref{_GtkTextIter},
    stop::Ref{_GtkTextIter}, limit::Ref{_GtkTextIter}, flag::Int32)

Implements gtk_text_iter_forward_search.

source
Gtk4.monitorMethod
monitor(w::GtkWidget)

Gets the GdkMonitor where w is displayed, or nothing if the widget is not part of a widget hierarchy.

source
Gtk4.monitorsMethod
monitors()

Returns a list of GdkMonitors for the default GdkDisplay, or nothing if none are found.

source
Gtk4.window_to_buffer_coordsFunction
window_to_buffer_coords(view::GtkTextView, window_x::Integer, window_y::Integer, wintype::Integer = 2)

Implements gtk_text_view_window_to_buffer_coords.

source

Types

Gtk4.AlignType

Controls how a widget deals with extra space in a single dimension.

Details can be found in the GTK docs.

source
Gtk4.CornerTypeType

Specifies which corner a child widget should be placed in when packed into a GtkScrolledWindow.

Details can be found in the GTK docs.

source
Gtk4.DeviceToolTypeType

Indicates the specific type of tool being used being a tablet. Such as an airbrush, pencil, etc.

Details can be found in the GTK docs.

source
Gtk4.DragActionType

Used in GdkDrop and GdkDrag to indicate the actions that the destination can and should do with the dropped data.

Details can be found in the GTK docs.

source
Gtk4.FileChooserActionType

Describes whether a GtkFileChooser is being used to open existing files or to save to a possibly new file.

Details can be found in the GTK docs.

source
Gtk4.FilterChangeType

Describes changes in a filter in more detail and allows objects using the filter to optimize refiltering items.

Details can be found in the GTK docs.

source
Gtk4.GLAPIType

The list of the different APIs that GdkGLContext can potentially support.

Details can be found in the GTK docs.

source
Gtk4.GdkClipboardType

The GdkClipboard object represents data shared between applications or inside an application.

Details can be found in the GTK docs.

source
Gtk4.GdkContentProviderType

A GdkContentProvider is used to provide content for the clipboard or for drag-and-drop operations in a number of formats.

Details can be found in the GTK docs.

source
Gtk4.GdkDeviceType

The GdkDevice object represents an input device, such as a keyboard, a mouse, or a touchpad.

Details can be found in the GTK docs.

source
Gtk4.GdkDragType

The GdkDrag object represents the source of an ongoing DND operation.

Details can be found in the GTK docs.

source
Gtk4.GdkDropType

The GdkDrop object represents the target of an ongoing DND operation.

Details can be found in the GTK docs.

source
Gtk4.GdkEventType

GdkEvents are immutable data structures, created by GDK to represent windowing system events.

Details can be found in the GTK docs.

source
Gtk4.GdkFrameTimingsType

A GdkFrameTimings object holds timing information for a single frame of the application’s displays.

Details can be found in the GTK docs.

source
Gtk4.GdkMonitorType

GdkMonitor objects represent the individual outputs that are associated with a GdkDisplay.

Details can be found in the GTK docs.

source
Gtk4.GdkPopupLayoutType

The GdkPopupLayout struct contains information that is necessary position a [iface@Gdk.Popup] relative to its parent.

Details can be found in the GTK docs.

source
Gtk4.GdkRGBAType

A GdkRGBA is used to represent a color, in a way that is compatible with cairo’s notion of color.

Details can be found in the GTK docs.

source
Gtk4.GdkSeatType

The GdkSeat object represents a collection of input devices that belong to a user.

Details can be found in the GTK docs.

source
Gtk4.GdkToplevelLayoutType

The GdkToplevelLayout struct contains information that is necessary to present a sovereign window on screen.

Details can be found in the GTK docs.

source
Gtk4.GravityType

Defines the reference point of a surface and is used in GdkPopupLayout.

Details can be found in the GTK docs.

source
Gtk4.GskGLShaderType

A GskGLShader is a snippet of GLSL that is meant to run in the fragment shader of the rendering pipeline.

Details can be found in the GTK docs.

source
Gtk4.GskRenderNodeType

GskRenderNode is the basic block in a scene graph to be rendered using [class@Gsk.Renderer].

Details can be found in the GTK docs.

source
Gtk4.GskRendererType

GskRenderer is a class that renders a scene graph defined via a tree of [class@Gsk.RenderNode] instances.

Details can be found in the GTK docs.

source
Gtk4.GtkATContextType

GtkATContext is an abstract class provided by GTK to communicate to platform-specific assistive technologies API.

Details can be found in the GTK docs.

source
Gtk4.GtkBoxType

The GtkBox widget arranges child widgets into a single row or column.

Details can be found in the GTK docs.

source
Gtk4.GtkBuilderType

A GtkBuilder reads XML descriptions of a user interface and instantiates the described objects.

Details can be found in the GTK docs.

source
Gtk4.GtkButtonType

The GtkButton widget is generally used to trigger a callback function that is called when the button is pressed.

Details can be found in the GTK docs.

source
Gtk4.GtkCenterBoxType

GtkCenterBox arranges three children in a row, keeping the middle child centered as well as possible.

Details can be found in the GTK docs.

source
Gtk4.GtkComboBoxType

A GtkComboBox is a widget that allows the user to choose from a list of valid choices.

Details can be found in the GTK docs.

source
Gtk4.GtkConstraintType

GtkConstraint describes a constraint between attributes of two widgets, expressed as a linear equation.

Details can be found in the GTK docs.

source
Gtk4.GtkDialogType

Dialogs are a convenient way to prompt the user for a small amount of input.

Details can be found in the GTK docs.

source
Gtk4.GtkDropDownType

GtkDropDown is a widget that allows the user to choose an item from a list of options.

Details can be found in the GTK docs.

source
Gtk4.GtkEmojiChooserType

The GtkEmojiChooser is used by text widgets such as GtkEntry or GtkTextView to let users insert Emoji characters.

Details can be found in the GTK docs.

source
Gtk4.GtkExpanderType

GtkExpander allows the user to reveal its child by clicking on an expander triangle.

Details can be found in the GTK docs.

source
Gtk4.GtkFileChooserNativeType

GtkFileChooserNative is an abstraction of a dialog suitable for use with “File Open” or “File Save as” commands.

Details can be found in the GTK docs.

source
Gtk4.GtkFilterType

A GtkFilter object describes the filtering to be performed by a [class@Gtk.FilterListModel].

Details can be found in the GTK docs.

source
Gtk4.GtkFilterListModelType

GtkFilterListModel is a list model that filters the elements of the underlying model according to a GtkFilter.

Details can be found in the GTK docs.

source
Gtk4.GtkFixedType

GtkFixed places its child widgets at fixed positions and with fixed sizes.

Details can be found in the GTK docs.

source
Gtk4.GtkFrameType

GtkFrame is a widget that surrounds its child with a decorative frame and an optional label.

Details can be found in the GTK docs.

source
Gtk4.GtkGridType

GtkGrid is a container which arranges its child widgets in rows and columns.

Details can be found in the GTK docs.

source
Gtk4.GtkLockButtonType

GtkLockButton is a widget to obtain and revoke authorizations needed to operate the controls.

Details can be found in the GTK docs.

source
Gtk4.GtkOverlayType

GtkOverlay is a container which contains a single main child, on top of which it can place “overlay” widgets.

Details can be found in the GTK docs.

source
Gtk4.GtkPrintContextType

A GtkPrintContext encapsulates context information that is required when drawing pages for printing.

Details can be found in the GTK docs.

source
Gtk4.GtkRangeType

GtkRange is the common base class for widgets which visualize an adjustment.

Details can be found in the GTK docs.

source
Gtk4.GtkRecentDataType

Meta-data to be passed to gtkrecentmanageraddfull() when registering a recently used resource.

Details can be found in the GTK docs.

source
Gtk4.GtkRecentInfoType

GtkRecentInfo contains the metadata associated with an item in the recently used files list.

Details can be found in the GTK docs.

source
Gtk4.GtkRequestedSizeType

Represents a request of a screen object in a given orientation. These are primarily used in container implementations when allocating a natural size for children calling. See [func@distributenaturalallocation].

Details can be found in the GTK docs.

source
Gtk4.GtkStackType

GtkStack is a container which only shows one of its children at a time.

Details can be found in the GTK docs.

source
Gtk4.GtkStatusbarType

A GtkStatusbar widget is usually placed along the bottom of an application's main [class@Gtk.Window].

Details can be found in the GTK docs.

source
Gtk4.GtkTextMarkType

A GtkTextMark is a position in a GtkTextbuffer that is preserved across modifications.

Details can be found in the GTK docs.

source
Gtk4.GtkTreeIterType

The GtkTreeIter is the primary structure for accessing a GtkTreeModel. Models are expected to put a unique integer in the @stamp member, and put model-specific data in the three @user_data members.

Details can be found in the GTK docs.

source
Gtk4.GtkViewportType

GtkViewport implements scrollability for widgets that lack their own scrolling capabilities.

Details can be found in the GTK docs.

source
Gtk4.InputHintsType

Describes hints that might be taken into account by input methods or applications.

Details can be found in the GTK docs.

source
Gtk4.PolicyTypeType

Determines how the size should be computed to achieve the one of the visibility mode for the scrollbars.

Details can be found in the GTK docs.

source
Gtk4.PrintErrorType

Error codes that identify various errors that can occur while using the GTK printing support.

Details can be found in the GTK docs.

source
Gtk4.PrintStatusType

The status gives a rough indication of the completion of a running print operation.

Details can be found in the GTK docs.

source
Gtk4.ScrollablePolicyType

Defines the policy to be used in a scrollable widget when updating the scrolled window adjustments in a given orientation.

Details can be found in the GTK docs.

source
Gtk4.SizeGroupModeType

The mode of the size group determines the directions in which the size group affects the requested sizes of its component widgets.

Details can be found in the GTK docs.

source
Gtk4.SpinTypeType

The values of the GtkSpinType enumeration are used to specify the change to make in gtkspinbutton_spin().

Details can be found in the GTK docs.

source
Gtk4.SubpixelLayoutType

This enumeration describes how the red, green and blue components of physical pixels on an output device are laid out.

Details can be found in the GTK docs.

source
Gtk4.SymbolicColorType

The indexes of colors passed to symbolic color rendering, such as [vfunc@Gtk.SymbolicPaintable.snapshot_symbolic].

Details can be found in the GTK docs.

source
Gtk4.TextExtendSelectionType

Granularity types that extend the text selection. Use the GtkTextView::extend-selection signal to customize the selection.

Details can be found in the GTK docs.

source
Gtk4.TextViewLayerType

Used to reference the layers of GtkTextView for the purpose of customized drawing with the ::snapshot_layer vfunc.

Details can be found in the GTK docs.

source
Gtk4.TreeViewColumnSizingType

The sizing method the column uses to determine its width. Please note that %GTKTREEVIEWCOLUMNAUTOSIZE are inefficient for large views, and can make columns appear choppy.

Details can be found in the GTK docs.

source
Gtk4._GtkTextIterMethod
_GtkTextIter(text::GtkTextBuffer, char_offset::Integer)

Creates a _GtkTextIter with offset char_offset (one-based index).

source

Constants

Gtk4.BINARY_AGEConstant

Like [func@getbinaryage], but from the headers used at application compile time, rather than from the library linked against at application run time.

Details can be found in the GTK docs.

source
Gtk4.BUTTON_PRIMARYConstant

The primary button. This is typically the left mouse button, or the right button in a left-handed setup.

Details can be found in the GTK docs.

source
Gtk4.BUTTON_SECONDARYConstant

The secondary button. This is typically the right mouse button, or the left button in a left-handed setup.

Details can be found in the GTK docs.

source
Gtk4.EVENT_STOPConstant

Use this macro as the return value for stopping the propagation of an event handler.

Details can be found in the GTK docs.

source
Gtk4.INPUT_ERRORConstant

Constant to return from a signal handler for the ::input signal in case of conversion failure.

Details can be found in the GTK docs.

source
Gtk4.INTERFACE_AGEConstant

Like [func@getinterfaceage], but from the headers used at application compile time, rather than from the library linked against at application run time.

Details can be found in the GTK docs.

source
Gtk4.MAJOR_VERSIONConstant

Like [func@getmajorversion], but from the headers used at application compile time, rather than from the library linked against at application run time.

Details can be found in the GTK docs.

source
Gtk4.MICRO_VERSIONConstant

Like [func@getmicroversion], but from the headers used at application compile time, rather than from the library linked against at application run time.

Details can be found in the GTK docs.

source
Gtk4.MINOR_VERSIONConstant

Like [func@getminorversion], but from the headers used at application compile time, rather than from the library linked against at application run time.

Details can be found in the GTK docs.

source
Gtk4.PRINT_SETTINGS_OUTPUT_URIConstant

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.

Details can be found in the GTK docs.

source
Gtk4.PRIORITY_REDRAWConstant

This is the priority that the idle handler processing surface updates is given in the main loop.

Details can be found in the GTK docs.

source