Module gtk::functions[][src]

Functions

accel_groups_activate

Finds the first accelerator in any AccelGroup attached to object that matches accel_key and accel_mods, and activates that accelerator.

accel_groups_from_object

Gets a list of all accel groups which are attached to object.

accelerator_get_default_mod_mask

Gets the modifier mask.

accelerator_get_label

Converts an accelerator keyval and modifier mask into a string which can be used to represent the accelerator to the user.

accelerator_get_label_with_keycode

Converts an accelerator keyval and modifier mask into a (possibly translated) string that can be displayed to a user, similarly to accelerator_get_label(), but handling keycodes.

accelerator_name

Converts an accelerator keyval and modifier mask into a string parseable by accelerator_parse(). For example, if you pass in GDK_KEY_q and gdk::ModifierType::CONTROL_MASK, this function returns “<Control>q”.

accelerator_name_with_keycode

Converts an accelerator keyval and modifier mask into a string parseable by gtk_accelerator_parse_with_keycode(), similarly to accelerator_name() but handling keycodes. This is only useful for system-level components, applications should use accelerator_parse() instead.

accelerator_parse

Parses a string representing an accelerator. The format looks like “<Control>a” or “<Shift>``<Alt>F1” or “<Release>z” (the last one is for key release).

accelerator_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 by AccelGroup.

accelerator_valid

Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator. For example, the GDK_KEY_a keyval plus gdk::ModifierType::CONTROL_MASK is valid - this is a “Ctrl+a” accelerator. But, you can’t, for instance, use the GDK_KEY_Control_L keyval as an accelerator.

binary_age

Returns the binary age as passed to libtool when building the GTK+ library the process is running against. If libtool means nothing to you, don’t worry about it.

bindings_activate

Find a key binding matching keyval and modifiers and activate the binding on object.

bindings_activate_event

Looks up key bindings for object to find one matching event, and if one was found, activate it.

cairo_should_draw_window

This function is supposed to be called in signal::Widget::draw implementations for widgets that support multiple windows. cr must be untransformed from invoking of the draw function. This function will return true if the contents of the given window are supposed to be drawn and false otherwise. Note that when the drawing was not initiated by the windowing system this function will return true for 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 cr that from widget-relative coordinates to window-relative coordinates. If the widget’s window is not an ancestor of window, 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_VERSION as 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 state and return true, otherwise return false.

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::Language for 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 on device and its associated pointer or keyboard (if any) are delivered to widget. If the block_others parameter is true, any other devices will be unable to interact with widget during 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() and gtk_parse_args() from automatically calling setlocale (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 event is None or the event was not associated with any widget, returns None, otherwise returns the widget that received the event originally.

events_pending

Checks if any events are pending.

false_
grab_get_current

Queries the current grab of the default window group.

interface_age

Returns the interface age as passed to libtool when building the GTK+ library the process is running against. If libtool means nothing to you, don’t worry about it.

locale_direction

Get the direction of the current locale. This is the expected reading direction for text and UI.

main

Runs the main loop until gtk_main_quit() is called.

main_do_event

Processes a single GDK event.

main_iteration

Runs a single iteration of the mainloop.

main_iteration_do

Runs a single iteration of the mainloop. If no events are available either return or block depending on the value of blocking.

main_level

Asks for the current nesting level of the main loop.

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 returned PageSetup is identical to the passed in page_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 state StateFlags::CHECKED determines 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_clipv3_20

Returns the area that will be affected (i.e. drawn to) when calling render_background() for the given context and rectangle.

render_check

Renders a checkmark (as in a CheckButton).

render_expander

Renders an expander (as used in TreeView and Expander) in the area defined by x, y, width, height. The state StateFlags::CHECKED determines whether the expander is collapsed or expanded.

render_extension

Renders a extension (as in a Notebook tab) in the rectangle defined by x, y, width, height. The side where the extension connects to is defined by gap_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

Renders a frame around the rectangle defined by (x, y, width, height), leaving a gap on one side. xy0_gap and xy1_gap will mean X coordinates for PositionType::Top and PositionType::Bottom gap sides, and Y coordinates for PositionType::Left and PositionType::Right.

render_handle

Renders a handle (as in GtkHandleBox, Paned and Window’s resize grip), in the rectangle determined by x, y, width, height.

render_icon

Renders the icon in pixbuf at the specified x and y coordinates.

render_icon_surface

Renders the icon in surface at the specified x and y coordinates.

render_insertion_cursor

Draws a text caret on cr at the specified index of layout.

render_layout

Renders layout on the coordinates x, y

render_line

Renders a line from (x0, y0) to (x1, y1).

render_option

Renders an option mark (as in a RadioButton), the StateFlags::CHECKED state will determine whether the option is on or off, and StateFlags::INCONSISTENT whether it should be marked as undefined.

render_slider

Renders a slider (as in Scale) in the rectangle defined by x, y, width, height. orientation defines 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 widget is None, release ownership of the selection.

selection_owner_set_for_display

Claim ownership of a given selection for a particular widget, or, if widget is None, 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.

show_uri

A convenience function for launching the default application to show the uri. Like show_uri_on_window(), but takes a screen as transient parent instead of a window.

show_uri_on_windowv3_22

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 targets can be used to provide a gdk_pixbuf::Pixbuf.

targets_include_rich_text

Determines if any of the targets in targets can be used to provide rich text.

targets_include_text

Determines if any of the targets in targets can be used to provide text.

targets_include_uri

Determines if any of the targets in targets can be used to provide an uri list.

test_create_simple_window

Create a simple window with window title window_title and text contents dialog_text. The window will quit any running main()-loop when destroyed, and it will automatically be destroyed upon test function teardown.

test_find_label

This function will search widget and all its descendants for a GtkLabel widget with a text string matching label_pattern. The label_pattern may 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, see gtk_test_init() for more details.

test_find_sibling

This function will search siblings of base_widget and siblings of its ancestors for all widgets matching widget_type. Of the matching widgets, the one that is geometrically closest to base_widget will 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 widget for a widget of type widget_type that has a label matching label_pattern next 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 see test_find_label(), test_find_sibling() and 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_slider_get_value

Retrive the literal adjustment value for GtkRange based widgets and spin buttons. Note that the value returned by this function is anything between the lower and upper bounds of the adjustment belonging to widget, and is not a percentage as passed in to test_slider_set_perc().

test_slider_set_perc

This function will adjust the slider position of all GtkRange based widgets, such as scrollbars or scales, it’ll also adjust spin buttons. The adjustment value of these widgets is set to a value between the lower and upper limits, according to the percentage argument.

test_spin_button_click

This function will generate a button click in the upwards or downwards spin button arrow areas, usually leading to an increase or decrease of spin button’s value.

test_text_get

Retrive the text string of widget if it is a GtkLabel, GtkEditable (entry and text widgets) or GtkTextView.

test_text_set

Set the text string of widget to string if it is a GtkLabel, GtkEditable (entry and text widgets) or GtkTextView.

test_widget_click

This function will generate a button click (button press and button release event) in the middle of the first GdkWindow found that belongs to widget. For windowless widgets like Button (which returns false from WidgetExt::has_window()), this will often be an input-only event window. For other widgets, this is usually widget->window. Certain caveats should be considered when using this function, in particular because the mouse pointer is warped to the button click location, see gdk_test_simulate_button() for details.

test_widget_send_key

This function will generate keyboard press and release events in the middle of the first GdkWindow found that belongs to widget. For windowless widgets like Button (which returns false from WidgetExt::has_window()), this will often be an input-only event window. For other widgets, this is usually widget->window. Certain caveats should be considered when using this function, in particular because the mouse pointer is warped to the key press location, see gdk_test_simulate_key() for details.

test_widget_wait_for_draw

Enters the main loop and waits for widget to be “drawn”. In this context that means it waits for the frame clock of widget to have run a full styling, layout and drawing cycle.

tree_get_row_drag_data

Obtains a tree_model and path from selection data of target type GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. This function can only be used if selection_data originates 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 the TreeDragDest drag_data_received handler, you can assume that selection data of type GTK_TREE_MODEL_ROW is in from the current process. The returned path must be freed with gtk_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_