Optionalproperties: Partial<Gtk.FileChooserWidget.ConstructorProps>Internal$signalsCompile-time signal type information.
This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.
Static$gtypeRead-OnlysubtitleWhether a file chooser not in Gtk.FileChooserAction.OPEN mode will offer the user to create new folders.
Whether a file chooser not in Gtk.FileChooserAction.OPEN mode will offer the user to create new folders.
Whether a file chooser not in Gtk.FileChooserAction.OPEN mode will offer the user to create new folders.
Whether a file chooser not in Gtk.FileChooserAction.OPEN mode will offer the user to create new folders.
Whether a file chooser in Gtk.FileChooserAction.SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists.
Whether a file chooser in Gtk.FileChooserAction.SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists.
Whether a file chooser in Gtk.FileChooserAction.SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists.
Whether a file chooser in Gtk.FileChooserAction.SAVE mode will present an overwrite confirmation dialog if the user selects a file name that already exists.
Whether to expand in both directions. Setting this sets both Gtk.Widget.hexpand and Gtk.Widget.vexpand
Enables or disables the emission of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip on widget.
A value of true indicates that widget can have a tooltip, in this case
the widget will be queried using Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip to determine
whether it will provide a tooltip or not.
Note that setting this property to true for the first time will change
the event masks of the GdkWindows of this widget to include leave-notify
and motion-notify events. This cannot and will not be undone when the
property is set to false again.
Enables or disables the emission of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip on widget.
A value of true indicates that widget can have a tooltip, in this case
the widget will be queried using Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip to determine
whether it will provide a tooltip or not.
Note that setting this property to true for the first time will change
the event masks of the GdkWindows of this widget to include leave-notify
and motion-notify events. This cannot and will not be undone when the
property is set to false again.
Whether to use the Gtk.Widget.hexpand property. See gtk_widget_get_hexpand_set().
Whether to use the Gtk.Widget.hexpand property. See gtk_widget_get_hexpand_set().
Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
Margin on left side of widget.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
since 3.12: Use Gtk.Widget.margin_start instead.
Margin on right side of widget.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
since 3.12: Use Gtk.Widget.margin_end instead.
Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
Margin on left side of widget.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
since 3.12: Use Gtk.Widget.margin_start instead.
Margin on right side of widget.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
since 3.12: Use Gtk.Widget.margin_end instead.
Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget's normal size
request, the margin will be added in addition to the size from
gtk_widget_set_size_request() for example.
The style of the widget, which contains information about how it will look (colors, etc).
Use Gtk.StyleContext instead
Sets the text of tooltip to be the given string, which is marked up
with the [Pango text markup language][PangoMarkupFormat].
Also see gtk_tooltip_set_markup().
This is a convenience property which will take care of getting the
tooltip shown if the given string is not null: Gtk.Widget.has_tooltip
will automatically be set to true and there will be taken care of
Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.
Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.
Sets the text of tooltip to be the given string.
Also see gtk_tooltip_set_text().
This is a convenience property which will take care of getting the
tooltip shown if the given string is not null: Gtk.Widget.has_tooltip
will automatically be set to true and there will be taken care of
Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.
Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.
Sets the text of tooltip to be the given string, which is marked up
with the [Pango text markup language][PangoMarkupFormat].
Also see gtk_tooltip_set_markup().
This is a convenience property which will take care of getting the
tooltip shown if the given string is not null: Gtk.Widget.has_tooltip
will automatically be set to true and there will be taken care of
Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.
Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.
Sets the text of tooltip to be the given string.
Also see gtk_tooltip_set_text().
This is a convenience property which will take care of getting the
tooltip shown if the given string is not null: Gtk.Widget.has_tooltip
will automatically be set to true and there will be taken care of
Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.
Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.
Whether to use the Gtk.Widget.vexpand property. See gtk_widget_get_vexpand_set().
Whether to use the Gtk.Widget.vexpand property. See gtk_widget_get_vexpand_set().
Adds a 'choice' to the file chooser. This is typically implemented
as a combobox or, for boolean choices, as a checkbutton. You can select
a value using gtk_file_chooser_set_choice() before the dialog is shown,
and you can obtain the user-selected value in the ::response signal handler
using gtk_file_chooser_get_choice().
Compare gtk_file_chooser_set_extra_widget().
id for the added choice
user-visible label for the added choice
Optionaloptions: string[]ids for the options of the choice, or null for a boolean choice
Optionaloption_labels: string[]user-visible labels for the options, must be the same length as options
Adds filter to the list of filters that the user can select between.
When a filter is selected, only files that are passed by that
filter are displayed.
Note that the chooser takes ownership of the filter, so you have to
ref and sink it if you want to keep a reference.
Adds a folder to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a “/usr/share/mydrawprogram/Clipart” folder to the volume list.
filename of the folder to add
true if the folder could be added successfully, false otherwise. In the latter case, the error will be set as appropriate.
Adds a folder URI to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a “file:///usr/share/mydrawprogram/Clipart” folder to the volume list.
URI of the folder to add
true if the folder could be added successfully, false otherwise. In the latter case, the error will be set as appropriate.
Creates a binding between source_property on source and target_property
on target.
Whenever the source_property is changed the target_property is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.
If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual:
if target_property on target changes then the source_property on source
will be updated as well.
The binding will automatically be removed when either the source or the
target instances are finalized. To remove the binding without affecting the
source and the target you can just call g_object_unref() on the returned
GObject.Binding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source and target are only used from a single thread and it
is clear that both source and target outlive the binding. Especially it
is not safe to rely on this if the binding, source or target can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A GObject.Object can have multiple bindings.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Complete version of g_object_bind_property().
Creates a binding between source_property on source and target_property
on target, allowing you to set the transformation functions to be used by
the binding.
If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual:
if target_property on target changes then the source_property on source
will be updated as well. The transform_from function is only used in case
of bidirectional bindings, otherwise it will be ignored
The binding will automatically be removed when either the source or the
target instances are finalized. This will release the reference that is
being held on the GObject.Binding instance; if you want to hold on to the
GObject.Binding instance, you will need to hold a reference to it.
To remove the binding, call g_binding_unbind().
A GObject.Object can have multiple bindings.
The same user_data parameter will be used for both transform_to
and transform_from transformation functions; the notify function will
be called once, when the binding is removed. If you need different data
for each transformation function, please use
g_object_bind_property_with_closures() instead.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
Optionaltransform_to: BindingTransformFuncthe transformation function from the source to the target, or null to use the default
Optionaltransform_from: BindingTransformFuncthe transformation function from the target to the source, or null to use the default
Optionalnotify: DestroyNotifya function to call when disposing the binding, to free resources used by the transformation functions, or null if not required
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Creates a binding between source_property on source and target_property
on target, allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of
g_object_bind_property_full(), using GClosures instead of
function pointers.
the property on source to bind
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Blocks a handler of an instance so it will not be called during any signal emissions
Handler ID of the handler to be blocked
SignalconnectSignalconnect_Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
Handler ID of the handler to be disconnected
SignalemitThis function is intended for GObject.Object implementations to re-enforce
a [floating][floating-ref] object reference. Doing this is seldom
required: all GInitiallyUnowneds are created with a floating reference
which usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on object. If the freeze count is
non-zero, the emission of "notify" signals on object is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
GObject.Object::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
Gets the type of operation that the file chooser is performing; see
gtk_file_chooser_set_action().
the action that the file selector is performing
Gets the currently selected option in the 'choice' with the given ID.
the ID of the choice to get
the ID of the currenly selected option
Gets whether file choser will offer to create new folders.
See gtk_file_chooser_set_create_folders().
true if the Create Folder button should be displayed.
Gets the current folder of chooser as a local filename.
See gtk_file_chooser_set_current_folder().
Note that this is the folder that the file chooser is currently displaying
(e.g. "/home/username/Documents"), which is not the same
as the currently-selected folder if the chooser is in
Gtk.FileChooserAction.SELECT_FOLDER mode
(e.g. "/home/username/Documents/selected-folder/". To get the
currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
usual way to get the selection.
the full path of the current folder, or null if the current path cannot be represented as a local filename. Free with g_free(). This function will also return null if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling gtk_file_chooser_set_current_folder() on a nonexistent folder.
Gets the current folder of chooser as an URI.
See gtk_file_chooser_set_current_folder_uri().
Note that this is the folder that the file chooser is currently displaying
(e.g. "file:///home/username/Documents"), which is not the same
as the currently-selected folder if the chooser is in
Gtk.FileChooserAction.SELECT_FOLDER mode
(e.g. "file:///home/username/Documents/selected-folder/". To get the
currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
usual way to get the selection.
the URI for the current folder. Free with g_free(). This function will also return null if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling gtk_file_chooser_set_current_folder_uri() on a nonexistent folder.
Gets the current name in the file selector, as entered by the user in the text entry for “Name”.
This is meant to be used in save dialogs, to get the currently typed filename when the file itself does not exist yet. For example, an application that adds a custom extra widget to the file chooser for “file format” may want to change the extension of the typed filename based on the chosen format, say, from “.jpg” to “.png”.
The raw text from the file chooser’s “Name” entry. Free this with g_free(). Note that this string is not a full pathname or URI; it is whatever the contents of the entry are. Note also that this string is in UTF-8 encoding, which is not necessarily the system’s encoding for filenames.
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
the data if found, or null if no such data exists.
Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists.
true if the file chooser will present a confirmation dialog; false otherwise.
Gets the Gio.File for the currently selected file in the file selector. If multiple files are selected, one of the files will be returned at random.
If the file chooser is in folder mode, this function returns the selected folder.
a selected Gio.File. You own the returned file; use g_object_unref() to release it.
Gets the filename for the currently selected file in the file selector. The filename is returned as an absolute path. If multiple files are selected, one of the filenames will be returned at random.
If the file chooser is in folder mode, this function returns the selected folder.
The currently selected filename, or null if no file is selected, or the selected file can't be represented with a local filename. Free with g_free().
Lists all the selected files and subfolders in the current folder of
chooser. The returned names are full absolute paths. If files in the current
folder cannot be represented as local filenames they will be ignored. (See
gtk_file_chooser_get_uris())
a GLib.SList containing the filenames of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free().
Lists all the selected files and subfolders in the current folder of chooser
as Gio.File. An internal function, see gtk_file_chooser_get_uris().
a GLib.SList containing a Gio.File for each selected file and subfolder in the current folder. Free the returned list with g_slist_free(), and the files with g_object_unref().
Gets the current filter; see gtk_file_chooser_set_filter().
the current filter, or null
Gets whether only local files can be selected in the
file selector. See gtk_file_chooser_set_local_only()
true if only local files can be selected.
Retrieves the orientation of the orientable.
the orientation of the orientable.
Gets the filename that should be previewed in a custom preview
widget. See gtk_file_chooser_set_preview_widget().
the filename to preview, or null if no file is selected, or if the selected file cannot be represented as a local filename. Free with g_free()
Gets the URI that should be previewed in a custom preview
widget. See gtk_file_chooser_set_preview_widget().
the URI for the file to preview, or null if no file is selected. Free with g_free().
Gets whether the preview widget set by gtk_file_chooser_set_preview_widget()
should be shown for the current filename. See
gtk_file_chooser_set_preview_widget_active().
true if the preview widget is active for the current filename.
Gets a property of an object.
The value can be:
In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
The name of the property to get
Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
This function gets back user data pointers stored via
g_object_set_qdata().
A GLib.Quark, naming the user data pointer
The user data pointer set, or null
Gets whether multiple files can be selected in the file
selector. See gtk_file_chooser_set_select_multiple().
true if multiple files can be selected.
Gets whether hidden files and folders are displayed in the file selector.
See gtk_file_chooser_set_show_hidden().
true if hidden files and folders are displayed.
Gets the URI for the currently selected file in the file selector. If multiple files are selected, one of the filenames will be returned at random.
If the file chooser is in folder mode, this function returns the selected folder.
The currently selected URI, or null if no file is selected. If gtk_file_chooser_set_local_only() is set to true (the default) a local URI will be returned for any FUSE locations. Free with g_free()
Lists all the selected files and subfolders in the current folder of
chooser. The returned names are full absolute URIs.
a GLib.SList containing the URIs of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free().
Gets whether a stock label should be drawn with the name of the previewed
file. See gtk_file_chooser_set_use_preview_label().
true if the file chooser is set to display a label with the name of the previewed file, false otherwise.
Gets n_properties properties for an object.
Obtained properties will be set to values. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.
the names of each property to get
the values of each property to get
Checks whether object has a [floating][floating-ref] reference.
true if object has a floating reference
Lists the current set of user-selectable filters; see
gtk_file_chooser_add_filter(), gtk_file_chooser_remove_filter().
a GLib.SList containing the current set of user selectable filters. The contents of the list are owned by GTK+, but you must free the list itself with g_slist_free() when you are done with it.
Queries the list of shortcut folders in the file chooser, as set by
gtk_file_chooser_add_shortcut_folder_uri().
A list of folder URIs, or null if there are no shortcut folders. Free the returned list with g_slist_free(), and the URIs with g_free().
Queries the list of shortcut folders in the file chooser, as set by
gtk_file_chooser_add_shortcut_folder().
A list of folder filenames, or null if there are no shortcut folders. Free the returned list with g_slist_free(), and the filenames with g_free().
Emits a "notify" signal for the property property_name on object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Note that emission of the notify signal may be blocked with
g_object_freeze_notify(). In this case, the signal emissions are queued
and will be emitted (in reverse order) when g_object_thaw_notify() is
called.
the name of a property installed on the class of object.
Emits a "notify" signal for the property specified by pspec on object.
This function omits the property name lookup, hence it is faster than
g_object_notify().
One way to avoid using g_object_notify() from within the
class that registered the properties, and using g_object_notify_by_pspec()
instead, is to store the GParamSpec used with
g_object_class_install_property() inside a static array, e.g.:
typedef enum
{
PROP_FOO = 1,
PROP_LAST
} MyObjectProperty;
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
0, 100,
50,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
and then notify a change on the "foo" property with:
g_object_notify_by_pspec (self, properties[PROP_FOO]);
the GObject.ParamSpec of a property installed on the class of object.
Increases the reference count of object.
Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type
of object will be propagated to the return type (using the GCC typeof()
extension), so any casting the caller needs to do on the return type must be
explicit.
the same object
Increase the reference count of object, and possibly remove the
[floating][floating-ref] reference, if object has a floating reference.
In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.
Since GLib 2.56, the type of object will be propagated to the return type
under the same conditions as for g_object_ref().
object
Removes a 'choice' that has been added with gtk_file_chooser_add_choice().
the ID of the choice to remove
Removes filter from the list of filters that the user can select between.
Removes a folder from a file chooser’s list of shortcut folders.
filename of the folder to remove
true if the operation succeeds, false otherwise. In the latter case, the error will be set as appropriate. See also: gtk_file_chooser_add_shortcut_folder()
Removes a folder URI from a file chooser’s list of shortcut folders.
URI of the folder to remove
true if the operation succeeds, false otherwise. In the latter case, the error will be set as appropriate. See also: gtk_file_chooser_add_shortcut_folder_uri()
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
Selects all the files in the current folder of a file chooser.
Selects a filename. If the file name isn’t in the current
folder of chooser, then the current folder of chooser will
be changed to the folder containing filename.
the filename to select
Not useful. See also: gtk_file_chooser_set_filename()
Selects the file to by uri. If the URI doesn’t refer to a
file in the current folder of chooser, then the current folder of
chooser will be changed to the folder containing filename.
the URI to select
Not useful.
Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
Object containing the properties to set
Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action. For example, an option to create a new folder might be shown if the action is Gtk.FileChooserAction.SAVE but not if the action is Gtk.FileChooserAction.OPEN.
the action that the file selector is performing
Selects an option in a 'choice' that has been added with
gtk_file_chooser_add_choice(). For a boolean choice, the
possible options are "true" and "false".
the ID of the choice to set
the ID of the option to select
Sets whether file choser will offer to create new folders. This is only relevant if the action is not set to be Gtk.FileChooserAction.OPEN.
true if the Create Folder button should be displayed
Sets the current folder for chooser from a local filename.
The user will be shown the full contents of the current folder,
plus user interface elements for navigating to other folders.
In general, you should not use this function. See the [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up] for the rationale behind this.
the full path of the new current folder
Not useful.
Sets the current folder for chooser from an URI.
The user will be shown the full contents of the current folder,
plus user interface elements for navigating to other folders.
In general, you should not use this function. See the [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up] for the rationale behind this.
the URI for the new current folder
true if the folder could be changed successfully, false otherwise.
Sets the current name in the file selector, as if entered
by the user. Note that the name passed in here is a UTF-8
string rather than a filename. This function is meant for
such uses as a suggested name in a “Save As...” dialog. You can
pass “Untitled.doc” or a similarly suitable suggestion for the name.
If you want to preselect a particular existing file, you should use
gtk_file_chooser_set_filename() or gtk_file_chooser_set_uri() instead.
Please see the documentation for those functions for an example of using
gtk_file_chooser_set_current_name() as well.
the filename to use, as a UTF-8 string
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
If the object already had an association with that name, the old association will be destroyed.
Internally, the key is converted to a GLib.Quark using g_quark_from_string().
This means a copy of key is kept permanently (even after object has been
finalized) — so it is recommended to only use a small, bounded set of values
for key in your program, to avoid the GLib.Quark storage growing unbounded.
name of the key
Optionaldata: anydata to associate with that key
Sets whether a file chooser in Gtk.FileChooserAction.SAVE mode will present
a confirmation dialog if the user types a file name that already exists. This
is false by default.
If set to true, the chooser will emit the
Gtk.FileChooser.SignalSignatures.confirm_overwrite | Gtk.FileChooser::confirm-overwrite signal when appropriate.
If all you need is the stock confirmation dialog, set this property to true.
You can override the way confirmation is done by actually handling the
Gtk.FileChooser.SignalSignatures.confirm_overwrite | Gtk.FileChooser::confirm-overwrite signal; please refer to its documentation
for the details.
whether to confirm overwriting in save mode
Sets file as the current filename for the file chooser, by changing
to the file’s parent folder and actually selecting the file in list. If
the chooser is in Gtk.FileChooserAction.SAVE mode, the file’s base name
will also appear in the dialog’s file name entry.
If the file name isn’t in the current folder of chooser, then the current
folder of chooser will be changed to the folder containing filename. This
is equivalent to a sequence of gtk_file_chooser_unselect_all() followed by
gtk_file_chooser_select_filename().
Note that the file must exist, or nothing will be done except for the directory change.
If you are implementing a save dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does Save As... If you don’t have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:
if (document_is_new)
{
// the user just created a new document
gtk_file_chooser_set_current_folder_file (chooser, default_file_for_saving);
gtk_file_chooser_set_current_name (chooser, "Untitled document");
}
else
{
// the user edited an existing document
gtk_file_chooser_set_file (chooser, existing_file);
}
Not useful.
Sets filename as the current filename for the file chooser, by changing to
the file’s parent folder and actually selecting the file in list; all other
files will be unselected. If the chooser is in
Gtk.FileChooserAction.SAVE mode, the file’s base name will also appear in
the dialog’s file name entry.
Note that the file must exist, or nothing will be done except for the directory change.
You should use this function only when implementing a save dialog for which you already have a file name to which the user may save. For example, when the user opens an existing file and then does Save As... to save a copy or a modified version. If you don’t have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:
if (document_is_new)
{
// the user just created a new document
gtk_file_chooser_set_current_name (chooser, "Untitled document");
}
else
{
// the user edited an existing document
gtk_file_chooser_set_filename (chooser, existing_filename);
}
In the first case, the file chooser will present the user with useful suggestions as to where to save his new file. In the second case, the file’s existing location is already known, so the file chooser will use it.
the filename to set as current
Not useful.
Sets the current filter; only the files that pass the filter will be displayed. If the user-selectable list of filters is non-empty, then the filter should be one of the filters in that list. Setting the current filter when the list of filters is empty is useful if you want to restrict the displayed set of files without letting the user change it.
Sets whether only local files can be selected in the
file selector. If local_only is true (the default),
then the selected file or files are guaranteed to be
accessible through the operating systems native file
system and therefore the application only
needs to worry about the filename functions in
Gtk.FileChooser, like gtk_file_chooser_get_filename(),
rather than the URI functions like
gtk_file_chooser_get_uri(),
On some systems non-native files may still be available using the native filesystem via a userspace filesystem (FUSE).
true if only local files can be selected
Sets the orientation of the orientable.
the orientable’s new orientation.
Sets an application-supplied widget to use to display a custom preview
of the currently selected file. To implement a preview, after setting the
preview widget, you connect to the Gtk.FileChooser.SignalSignatures.update_preview | Gtk.FileChooser::update-preview
signal, and call gtk_file_chooser_get_preview_filename() or
gtk_file_chooser_get_preview_uri() on each change. If you can
display a preview of the new file, update your widget and
set the preview active using gtk_file_chooser_set_preview_widget_active().
Otherwise, set the preview inactive.
When there is no application-supplied preview widget, or the application-supplied preview widget is not active, the file chooser will display no preview at all.
Sets whether the preview widget set by
gtk_file_chooser_set_preview_widget() should be shown for the
current filename. When active is set to false, the file chooser
may display an internally generated preview of the current file
or it may display no preview at all. See
gtk_file_chooser_set_preview_widget() for more details.
whether to display the user-specified preview widget
Sets a property on an object.
The name of the property to set
The value to set the property to
Sets whether multiple files can be selected in the file selector. This is only relevant if the action is set to be Gtk.FileChooserAction.OPEN or Gtk.FileChooserAction.SELECT_FOLDER.
true if multiple files can be selected.
Sets whether hidden files and folders are displayed in the file selector.
true if hidden files and folders should be displayed.
Sets the file referred to by uri as the current file for the file chooser,
by changing to the URI’s parent folder and actually selecting the URI in the
list. If the chooser is Gtk.FileChooserAction.SAVE mode, the URI’s base
name will also appear in the dialog’s file name entry.
Note that the URI must exist, or nothing will be done except for the directory change.
You should use this function only when implementing a save dialog for which you already have a file name to which the user may save. For example, when the user opens an existing file and then does Save As... to save a copy or a modified version. If you don’t have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:
if (document_is_new)
{
// the user just created a new document
gtk_file_chooser_set_current_name (chooser, "Untitled document");
}
else
{
// the user edited an existing document
gtk_file_chooser_set_uri (chooser, existing_uri);
}
In the first case, the file chooser will present the user with useful suggestions as to where to save his new file. In the second case, the file’s existing location is already known, so the file chooser will use it.
the URI to set as current
Not useful.
Sets whether the file chooser should display a stock label with the name of
the file that is being previewed; the default is true. Applications that
want to draw the whole preview area themselves should set this to false and
display the name themselves in their preview widget.
See also: gtk_file_chooser_set_preview_widget()
whether to display a stock label with the name of the previewed file
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
the data if found, or null if no such data exists.
This function gets back user data pointers stored via
g_object_set_qdata() and removes the data from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrieve the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
Using g_object_get_qdata() in the above example, instead of
g_object_steal_qdata() would have left the destroy function set,
and thus the partial string list would have been freed upon
g_object_set_qdata_full().
A GLib.Quark, naming the user data pointer
The user data pointer set, or null
Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
Name of the signal to stop emission of
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on object
and when it reaches zero, queued "notify" signals are emitted.
Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.
It is an error to call this function when the freeze count is zero.
Unblocks a handler so it will be called again during any signal emissions
Handler ID of the handler to be unblocked
Decreases the reference count of object. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
If the pointer to the GObject.Object may be reused in future (for example, if it is
an instance variable of another object), it is recommended to clear the
pointer to null rather than retain a dangling pointer to a potentially
invalid GObject.Object instance. Use g_clear_object() for this.
Unselects all the files in the current folder of a file chooser.
Unselects a currently selected filename. If the filename is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.
the filename to unselect
Unselects the file referred to by uri. If the file
is not in the current directory, does not exist, or
is otherwise not currently selected, does nothing.
the URI to unselect
Virtualvfunc_the constructed function is called by g_object_new() as the
final step of the object creation process. At the point of the call, all
construction properties have been set on the object. The purpose of this
call is to allow for object initialisation steps that can only be performed
after construction properties have been set. constructed implementors
should chain up to the constructed call of their parent class to allow it
to complete its initialisation.
Virtualvfunc_Virtualvfunc_the dispose function is supposed to drop all references to other
objects, but keep the instance otherwise intact, so that client method
invocations still work. It may be run multiple times (due to reference
loops). Before returning, dispose should chain up to the dispose method
of the parent class.
Virtualvfunc_instance finalization function, should finish the finalization of
the instance begun in dispose and chain up to the finalize method of the
parent class.
Virtualvfunc_Virtualvfunc_Emits a "notify" signal for the property property_name on object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Note that emission of the notify signal may be blocked with
g_object_freeze_notify(). In this case, the signal emissions are queued
and will be emitted (in reverse order) when g_object_thaw_notify() is
called.
Virtualvfunc_the generic setter for all properties of this type. Should be
overridden for every type with properties. If implementations of
set_property don't emit property change notification explicitly, this will
be done implicitly by the type system. However, if the notify signal is
emitted explicitly, the type system will not emit it a second time.
This function essentially limits the life time of the closure to
the life time of the object. That is, when the object is finalized,
the closure is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the closure, to ensure that an extra
reference count is held on object during invocation of the
closure. Usually, this function will be called on closures that
use this object as closure data.
GObject.Closure to watch
StaticnewFor widgets that can be “activated” (buttons, menu items, etc.)
this function activates them. Activation is what happens when you
press Enter on a widget during key navigation. If widget isn't
activatable, the function returns false.
true if the widget was activatable
Adds widget to container. Typically used for simple containers
such as Gtk.Window, Gtk.Frame, or Gtk.Button; for more complicated
layout containers such as Gtk.Box or Gtk.Grid, this function will
pick default packing parameters that may not be correct. So
consider functions such as gtk_box_pack_start() and
gtk_grid_attach() as an alternative to gtk_container_add() in
those cases. A widget may be added to only one container at a time;
you can’t place the same widget inside two different containers.
Note that some containers, such as Gtk.ScrolledWindow or Gtk.ListBox, may add intermediate children between the added widget and the container.
Installs an accelerator for this widget in accel_group that causes
accel_signal to be emitted if the accelerator is activated.
The accel_group needs to be added to the widget’s toplevel via
gtk_window_add_accel_group(), and the signal must be of type GObject.SignalFlags.ACTION.
Accelerators added through this function are not user changeable during
runtime. If you want to support accelerators that can be changed by the
user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or
gtk_menu_item_set_accel_path() instead.
widget signal to emit on accelerator activation
accel group for this widget, added to its toplevel
GDK keyval of the accelerator
modifier key combination of the accelerator
flag accelerators, e.g. Gtk.AccelFlags.VISIBLE
Adds the device events in the bitfield events to the event mask for
widget. See gtk_widget_set_device_events() for details.
an event mask, see Gdk.EventMask
Adds the events in the bitfield events to the event mask for
widget. See gtk_widget_set_events() and the
[input handling overview][event-masks] for details.
an event mask, see Gdk.EventMask
Adds a widget to the list of mnemonic labels for
this widget. (See gtk_widget_list_mnemonic_labels()). Note the
list of mnemonic labels for the widget is cleared when the
widget is destroyed, so the caller must make sure to update
its internal state at this point as well, by using a connection
to the Gtk.Widget::destroy signal or a weak notifier.
a Gtk.Widget that acts as a mnemonic label for widget
Queues an animation frame update and adds a callback to be called
before each frame. Until the tick callback is removed, it will be
called frequently (usually at the frame rate of the output device
or as quickly as the application can be repainted, whichever is
slower). For this reason, is most suitable for handling graphics
that change every frame or every few frames. The tick callback does
not automatically imply a relayout or repaint. If you want a
repaint or relayout, and aren’t changing widget properties that
would trigger that (for example, changing the text of a Gtk.Label),
then you will have to call gtk_widget_queue_resize() or
gtk_widget_queue_draw_area() yourself.
gdk_frame_clock_get_frame_time() should generally be used for timing
continuous animations and
gdk_frame_timings_get_predicted_presentation_time() if you are
trying to display isolated frames at particular times.
This is a more convenient alternative to connecting directly to the Gdk.FrameClock::update signal of Gdk.FrameClock, since you don't have to worry about when a Gdk.FrameClock is assigned to a widget.
function to call for updating animations
an id for the connection of this callback. Remove the callback by passing it to gtk_widget_remove_tick_callback()
Determines whether an accelerator that activates the signal
identified by signal_id can currently be activated.
This is done by emitting the Gtk.Widget.SignalSignatures.can_activate_accel | Gtk.Widget::can-activate-accel
signal on widget; if the signal isn’t overridden by a
handler or in a derived widget, then the default check is
that the widget must be sensitive, and the widget and all
its ancestors mapped.
the ID of a signal installed on widget
true if the accelerator can be activated.
This function is used by custom widget implementations; if you're
writing an app, you’d use gtk_widget_grab_focus() to move the focus
to a particular widget, and gtk_container_set_focus_chain() to
change the focus tab order. So you may want to investigate those
functions instead.
gtk_widget_child_focus() is called by containers as the user moves
around the window using keyboard shortcuts. direction indicates
what kind of motion is taking place (up, down, left, right, tab
forward, tab backward). gtk_widget_child_focus() emits the
Gtk.Widget::focus signal; widgets override the default handler
for this signal in order to implement appropriate focus behavior.
The default ::focus handler for a widget should return true if
moving in direction left the focus on a focusable location inside
that widget, and false if moving in direction moved the focus
outside the widget. If returning true, widgets normally
call gtk_widget_grab_focus() to place the focus accordingly;
if returning false, they don’t modify the current focus location.
direction of focus movement
true if focus ended up inside widget
Emits a Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signal for the
[child property][child-properties]
child_property on the child.
This is an analogue of g_object_notify() for child properties.
Also see gtk_widget_child_notify().
Emits a Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signal for the
[child property][child-properties] specified by
pspec on the child.
This is an analogue of g_object_notify_by_pspec() for child properties.
the child widget
the GObject.ParamSpec of a child property instealled on the class of container
Same as gtk_widget_path(), but always uses the name of a widget’s type,
never uses a custom name set with gtk_widget_set_name().
Computes whether a container should give this widget extra space
when possible. Containers should check this, rather than
looking at gtk_widget_get_hexpand() or gtk_widget_get_vexpand().
This function already checks whether the widget is visible, so visibility does not need to be checked separately. Non-visible widgets are not expanded.
The computed expand value uses either the expand setting explicitly set on the widget itself, or, if none has been explicitly set, the widget may expand if some of its children do.
expand direction
whether widget tree rooted here should be expanded
Constructs a child of buildable with the name name.
Gtk.Builder calls this function if a “constructor” has been specified in the UI definition.
Gtk.Builder used to construct this object
name of child to construct
the constructed child
Creates a new Pango.Context with the appropriate font map,
font options, font description, and base direction for drawing
text for this widget. See also gtk_widget_get_pango_context().
the new Pango.Context
Creates a new Pango.Layout with the appropriate font map, font description, and base direction for drawing text for this widget.
If you keep a Pango.Layout created in this way around, you need to re-create it when the widget Pango.Context is replaced. This can be tracked by using the Gtk.Widget.SignalSignatures.screen_changed | Gtk.Widget::screen-changed signal on the widget.
Optionaltext: stringtext to set on the layout (can be null)
the new Pango.Layout
This is similar to gtk_buildable_parser_finished() but is
called once for each custom tag handled by the buildable.
This is called at the end of each custom element handled by the buildable.
Gtk.Builder used to construct this object
child object or null for non-child tags
name of tag
Optionaldata: anyuser data that will be passed in to parser functions
This is called for each unknown element under <child>.
a Gtk.Builder used to construct this object
child object or null for non-child tags
name of tag
true if a object has a custom implementation, false if it doesn't.
Destroys a widget.
When a widget is destroyed all references it holds on other objects will be released:
It's expected that all references held on the widget will also
be released; you should connect to the Gtk.Widget::destroy signal
if you hold a reference to widget and you wish to remove it when
this function is called. It is not necessary to do so if you are
implementing a Gtk.Container, as you'll be able to use the
Gtk.ContainerClass.remove() virtual function for that.
It's important to notice that gtk_widget_destroy() will only cause
the widget to be finalized if no additional references, acquired
using g_object_ref(), are held on it. In case additional references
are in place, the widget will be in an "inert" state after calling
this function; widget will still point to valid memory, allowing you
to release the references you hold, but you may not query the widget's
own state.
You should typically call this function on top level widgets, and rarely on child widgets.
See also: gtk_container_remove()
This function sets *widget_pointer to null if widget_pointer !=
null. It’s intended to be used as a callback connected to the
“destroy” signal of a widget. You connect gtk_widget_destroyed()
as a signal handler, and pass the address of your widget variable
as user data. Then when the widget is destroyed, the variable will
be set to null. Useful for example to avoid multiple copies
of the same dialog.
Returns true if device has been shadowed by a GTK+
device grab on another widget, so it would stop sending
events to widget. This may be used in the
Gtk.Widget.SignalSignatures.grab_notify | Gtk.Widget::grab-notify signal to check for specific
devices. See gtk_device_grab_add().
true if there is an ongoing grab on device by another Gtk.Widget than widget.
This function is equivalent to gtk_drag_begin_with_coordinates(),
passing -1, -1 as coordinates.
The targets (data formats) in which the source can provide the data
A bitmask of the allowed drag actions for this drag
The button the user clicked to start the drag
Optionalevent: Gdk.EventThe event that triggered the start of the drag, or null if none can be obtained.
the context for this drag
Initiates a drag on the source side. The function only needs to be used
when the application is starting drags itself, and is not needed when
gtk_drag_source_set() is used.
The event is used to retrieve the timestamp that will be used internally to
grab the pointer. If event is null, then GDK_CURRENT_TIME will be used.
However, you should try to pass a real event in all cases, since that can be
used to get information about the drag.
Generally there are three cases when you want to start a drag by hand by calling this function:
During a Gtk.Widget.SignalSignatures.button_press_event | Gtk.Widget::button-press-event handler, if you want to start a drag
immediately when the user presses the mouse button. Pass the event
that you have in your Gtk.Widget.SignalSignatures.button_press_event | Gtk.Widget::button-press-event handler.
During a Gtk.Widget.SignalSignatures.motion_notify_event | Gtk.Widget::motion-notify-event handler, if you want to start a drag
when the mouse moves past a certain threshold distance after a button-press.
Pass the event that you have in your Gtk.Widget.SignalSignatures.motion_notify_event | Gtk.Widget::motion-notify-event handler.
During a timeout handler, if you want to start a drag after the mouse
button is held down for some time. Try to save the last event that you got
from the mouse, using gdk_event_copy(), and pass it to this function
(remember to free the event with gdk_event_free() when you are done).
If you really cannot pass a real event, pass null instead.
The targets (data formats) in which the source can provide the data
A bitmask of the allowed drag actions for this drag
The button the user clicked to start the drag
The event that triggered the start of the drag, or null if none can be obtained.
The initial x coordinate to start dragging from, in the coordinate space of widget. If -1 is passed, the coordinates are retrieved from event or the current pointer position
The initial y coordinate to start dragging from, in the coordinate space of widget. If -1 is passed, the coordinates are retrieved from event or the current pointer position
the context for this drag
Checks to see if a mouse drag starting at (start_x, start_y) and ending
at (current_x, current_y) has passed the GTK+ drag threshold, and thus
should trigger the beginning of a drag-and-drop operation.
X coordinate of start of drag
Y coordinate of start of drag
current X coordinate
current Y coordinate
true if the drag threshold has been passed.
Add the image targets supported by Gtk.SelectionData to
the target list of the drag destination. The targets
are added with info = 0. If you need another value,
use gtk_target_list_add_image_targets() and
gtk_drag_dest_set_target_list().
Add the text targets supported by Gtk.SelectionData to
the target list of the drag destination. The targets
are added with info = 0. If you need another value,
use gtk_target_list_add_text_targets() and
gtk_drag_dest_set_target_list().
Add the URI targets supported by Gtk.SelectionData to
the target list of the drag destination. The targets
are added with info = 0. If you need another value,
use gtk_target_list_add_uri_targets() and
gtk_drag_dest_set_target_list().
Looks for a match between the supported targets of context and the
dest_target_list, returning the first matching target, otherwise
returning GDK_NONE. dest_target_list should usually be the return
value from gtk_drag_dest_get_target_list(), but some widgets may
have different valid targets for different parts of the widget; in
that case, they will have to implement a drag_motion handler that
passes the correct target list to this function.
drag context
Optionaltarget_list: TargetListlist of droppable targets, or null to use gtk_drag_dest_get_target_list (widget).
first target that the source offers and the dest can accept, or GDK_NONE
Returns the list of targets this widget can accept from drag-and-drop.
the Gtk.TargetList, or null if none
Returns whether the widget has been configured to always emit Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion signals.
true if the widget always emits Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion events
Sets a widget as a potential drop destination, and adds default behaviors.
The default behaviors listed in flags have an effect similar
to installing default handlers for the widget’s drag-and-drop signals
(Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion, Gtk.Widget.SignalSignatures.drag_drop | Gtk.Widget::drag-drop, ...). They all exist
for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is
sufficient to connect to the widget’s Gtk.Widget.SignalSignatures.drag_data_received | Gtk.Widget::drag-data-received
signal to get primitive, but consistent drag-and-drop support.
Things become more complicated when you try to preview the dragged data,
as described in the documentation for Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion. The default
behaviors described by flags make some assumptions, that can conflict
with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes
invokations of gdk_drag_status() in the context of Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion,
and invokations of gtk_drag_finish() in Gtk.Widget.SignalSignatures.drag_data_received | Gtk.Widget::drag-data-received.
Especially the later is dramatic, when your own Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion
handler calls gtk_drag_get_data() to inspect the dragged data.
There’s no way to set a default action here, you can use the Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion callback for that. Here’s an example which selects the action to use depending on whether the control key is pressed or not:
static void
drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time)
{
GdkModifierType mask;
gdk_window_get_pointer (gtk_widget_get_window (widget),
NULL, NULL, &mask);
if (mask & GDK_CONTROL_MASK)
gdk_drag_status (context, GDK_ACTION_COPY, time);
else
gdk_drag_status (context, GDK_ACTION_MOVE, time);
}
which types of default drag behavior to use
a pointer to an array of GtkTargetEntrys indicating the drop types that this widget will accept, or null. Later you can access the list with gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target().
a bitmask of possible actions for a drop onto this widget.
Sets this widget as a proxy for drops to another window.
the window to which to forward drag events
the drag protocol which the proxy_window accepts (You can use gdk_drag_get_protocol() to determine this)
If true, send the same coordinates to the destination, because it is an embedded subwindow.
Sets the target types that this widget can accept from drag-and-drop.
The widget must first be made into a drag destination with
gtk_drag_dest_set().
Optionaltarget_list: TargetListlist of droppable targets, or null for none
Tells the widget to emit Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion and Gtk.Widget.SignalSignatures.drag_leave | Gtk.Widget::drag-leave events regardless of the targets and the Gtk.DestDefaults.MOTION flag.
This may be used when a widget wants to do generic actions regardless of the targets that the source offers.
whether to accept all targets
Clears information about a drop destination set with
gtk_drag_dest_set(). The widget will no longer receive
notification of drags.
Gets the data associated with a drag. When the data
is received or the retrieval fails, GTK+ will emit a
Gtk.Widget.SignalSignatures.drag_data_received | Gtk.Widget::drag-data-received signal. Failure of the retrieval
is indicated by the length field of the selection_data
signal parameter being negative. However, when gtk_drag_get_data()
is called implicitely because the Gtk.DestDefaults.DROP was set,
then the widget will not receive notification of failed
drops.
the drag context
the target (form of the data) to retrieve
a timestamp for retrieving the data. This will generally be the time received in a Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion or Gtk.Widget.SignalSignatures.drag_drop | Gtk.Widget::drag-drop signal
Highlights a widget as a currently hovered drop target.
To end the highlight, call gtk_drag_unhighlight().
GTK+ calls this automatically if Gtk.DestDefaults.HIGHLIGHT is set.
Add the writable image targets supported by Gtk.SelectionData to
the target list of the drag source. The targets
are added with info = 0. If you need another value,
use gtk_target_list_add_image_targets() and
gtk_drag_source_set_target_list().
Add the text targets supported by Gtk.SelectionData to
the target list of the drag source. The targets
are added with info = 0. If you need another value,
use gtk_target_list_add_text_targets() and
gtk_drag_source_set_target_list().
Add the URI targets supported by Gtk.SelectionData to
the target list of the drag source. The targets
are added with info = 0. If you need another value,
use gtk_target_list_add_uri_targets() and
gtk_drag_source_set_target_list().
Gets the list of targets this widget can provide for drag-and-drop.
the Gtk.TargetList, or null if none
Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget. The widget must have a window.
the bitmask of buttons that can start the drag
the table of targets that the drag will support, may be null
the bitmask of possible actions for a drag from this widget
Sets the icon that will be used for drags from a particular source
to icon. See the docs for Gtk.IconTheme for more details.
Sets the icon that will be used for drags from a particular source to a themed icon. See the docs for Gtk.IconTheme for more details.
name of icon to use
Sets the icon that will be used for drags from a particular widget
from a GdkPixbuf.Pixbuf. GTK+ retains a reference for pixbuf and will
release it when it is no longer needed.
the GdkPixbuf.Pixbuf for the drag icon
Sets the icon that will be used for drags from a particular source to a stock icon.
the ID of the stock icon to use
Changes the target types that this widget offers for drag-and-drop.
The widget must first be made into a drag source with
gtk_drag_source_set().
Optionaltarget_list: TargetListlist of draggable targets, or null for none
Undoes the effects of gtk_drag_source_set().
Removes a highlight set by gtk_drag_highlight() from
a widget.
Draws widget to cr. The top left corner of the widget will be
drawn to the currently set origin point of cr.
You should pass a cairo context as cr argument that is in an
original state. Otherwise the resulting drawing is undefined. For
example changing the operator using cairo_set_operator() or the
line width using cairo_set_line_width() might have unwanted side
effects.
You may however change the context’s transform matrix - like with
cairo_scale(), cairo_translate() or cairo_set_matrix() and clip
region with cairo_clip() prior to calling this function. Also, it
is fine to modify the context with cairo_save() and
cairo_push_group() prior to calling this function.
Note that special-purpose widgets may contain special code for
rendering to the screen and might appear differently on screen
and when rendered using gtk_widget_draw().
Ensures that widget has a style (widget->style).
Not a very useful function; most of the time, if you want the style, the widget is realized, and realized widgets are guaranteed to have a style already.
Notifies the user about an input-related error on this widget.
If the Gtk.Settings.gtk_error_bell setting is true, it calls
gdk_window_beep(), otherwise it does nothing.
Note that the effect of gdk_window_beep() can be configured in many
ways, depending on the windowing backend and the desktop environment
or window manager that is used.
Rarely-used function. This function is used to emit
the event signals on a widget (those signals should never
be emitted without using this function to do so).
If you want to synthesize an event though, don’t use this function;
instead, use gtk_main_do_event() so the event will behave as if
it were in the event queue. Don’t synthesize expose events; instead,
use gdk_window_invalidate_rect() to invalidate a region of the
window.
return from the event signal emission (true if the event was handled)
Invokes callback on each direct child of container, including
children that are considered “internal” (implementation details
of the container). “Internal” children generally weren’t added
by the user of the container, but were added by the container
implementation itself.
Most applications should use gtk_container_foreach(), rather
than gtk_container_forall().
Invokes callback on each non-internal child of container.
See gtk_container_forall() for details on what constitutes
an “internal” child. For all practical purposes, this function
should iterate over precisely those child widgets that were
added to the container by the application with explicit add()
calls.
It is permissible to remove the child from the callback handler.
Most applications should use gtk_container_foreach(),
rather than gtk_container_forall().
Stops emission of Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signals on widget. The
signals are queued until gtk_widget_thaw_child_notify() is called
on widget.
This is the analogue of g_object_freeze_notify() for child properties.
Returns the accessible object that describes the widget to an assistive technology.
If accessibility support is not available, this Atk.Object instance may be a no-op. Likewise, if no class-specific Atk.Object implementation is available for the widget instance in question, it will inherit an Atk.Object implementation from the first ancestor class for which such an implementation is defined.
The documentation of the ATK library contains more information about accessible objects and their uses.
the Atk.Object associated with widget
Retrieves the Gio.ActionGroup that was registered using prefix. The resulting
Gio.ActionGroup may have been registered to widget or any Gtk.Widget in its
ancestry.
If no action group was found matching prefix, then null is returned.
The “prefix” of the action group.
A Gio.ActionGroup or null.
Returns the baseline that has currently been allocated to widget.
This function is intended to be used when implementing handlers
for the Gtk.Widget::draw function, and when allocating child
widgets in Gtk.Widget.SignalSignatures.size_allocate | Gtk.Widget::size_allocate.
the baseline of the widget, or -1 if none
Returns the height that has currently been allocated to widget.
This function is intended to be used when implementing handlers
for the Gtk.Widget::draw function.
the height of the widget
Retrieves the widget’s allocated size.
This function returns the last values passed to
gtk_widget_size_allocate_with_baseline(). The value differs from
the size returned in gtk_widget_get_allocation() in that functions
like gtk_widget_set_halign() can adjust the allocation, but not
the value returned by this function.
If a widget is not visible, its allocated size is 0.
Returns the width that has currently been allocated to widget.
This function is intended to be used when implementing handlers
for the Gtk.Widget::draw function.
the width of the widget
Retrieves the widget’s allocation.
Note, when implementing a Gtk.Container: a widget’s allocation will
be its “adjusted” allocation, that is, the widget’s parent
container typically calls gtk_widget_size_allocate() with an
allocation, and that allocation is then adjusted (to handle margin
and alignment for example) before assignment to the widget.
gtk_widget_get_allocation() returns the adjusted allocation that
was actually assigned to the widget. The adjusted allocation is
guaranteed to be completely contained within the
gtk_widget_size_allocate() allocation, however. So a Gtk.Container
is guaranteed that its children stay inside the assigned bounds,
but not that they have exactly the bounds the container assigned.
There is no way to get the original allocation assigned by
gtk_widget_size_allocate(), since it isn’t stored; if a container
implementation needs that information it will have to track it itself.
Gets the first ancestor of widget with type widget_type. For example,
gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets
the first Gtk.Box that’s an ancestor of widget. No reference will be
added to the returned widget; it should not be unreferenced. See note
about checking for a toplevel Gtk.Window in the docs for
gtk_widget_get_toplevel().
Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor()
considers widget to be an ancestor of itself.
ancestor type
the ancestor widget, or null if not found
Determines whether the application intends to draw on the widget in an Gtk.Widget::draw handler.
See gtk_widget_set_app_paintable()
true if the widget is app paintable
Gets the value set by gtk_box_set_baseline_position().
the baseline position
Retrieves the border width of the container. See
gtk_container_set_border_width().
the current border width
Determines whether widget can be a default widget. See
gtk_widget_set_can_default().
true if widget can be a default widget, false otherwise
Determines whether widget can own the input focus. See
gtk_widget_set_can_focus().
true if widget can own the input focus, false otherwise
This function is only for use in widget implementations. Obtains
widget->requisition, unless someone has forced a particular
geometry on the widget (e.g. with gtk_widget_set_size_request()),
in which case it returns that geometry instead of the widget's
requisition.
This function differs from gtk_widget_size_request() in that
it retrieves the last size request value from widget->requisition,
while gtk_widget_size_request() actually calls the "size_request" method
on widget to compute the size request and fill in widget->requisition,
and only then returns widget->requisition.
Because this function does not call the “size_request” method, it
can only be used when you know that widget->requisition is
up-to-date, that is, gtk_widget_size_request() has been called
since the last time a resize was queued. In general, only container
implementations have this information; applications should use
gtk_widget_size_request().
Gets the value set with gtk_widget_set_child_visible().
If you feel a need to use this function, your code probably
needs reorganization.
This function is only useful for container implementations and never should be called by an application.
true if the widget is mapped with the parent.
Returns the clipboard object for the given selection to
be used with widget. widget must have a Gdk.Display
associated with it, so must be attached to a toplevel
window.
the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time.
Obtains the composite name of a widget.
the composite name of widget, or null if widget is not a composite child. The string should be freed when it is no longer needed.
Gets the reading direction for a particular widget. See
gtk_widget_set_direction().
the reading direction for the widget.
Get the Gdk.Display for the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a Gtk.Window at the top.
In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.
the Gdk.Display for the toplevel for this widget.
Determines whether the widget is double buffered.
See gtk_widget_set_double_buffered()
true if the widget is double buffered
Returns the event mask (see Gdk.EventMask) for the widget. These are the events that the widget will receive.
Note: Internally, the widget event mask will be the logical OR of the event
mask set through gtk_widget_set_events() or gtk_widget_add_events(), and the
event mask necessary to cater for every Gtk.EventController created for the
widget.
event mask for widget
Retrieves the focus chain of the container, if one has been
set explicitly. If no focus chain has been explicitly
set, GTK+ computes the focus chain based on the positions
of the children. In that case, GTK+ stores null in
focusable_widgets and returns false.
true if the focus chain of the container has been set explicitly.
Retrieves the horizontal focus adjustment for the container. See gtk_container_set_focus_hadjustment ().
the horizontal focus adjustment, or null if none has been set.
Returns whether the widget should grab focus when it is clicked with the mouse.
See gtk_widget_set_focus_on_click().
true if the widget should grab focus when it is clicked with the mouse.
Retrieves the vertical focus adjustment for the container. See
gtk_container_set_focus_vadjustment().
the vertical focus adjustment, or null if none has been set.
Gets the font map that has been set with gtk_widget_set_font_map().
A Pango.FontMap, or null
Returns the cairo.FontOptions used for Pango rendering. When not set, the defaults font options for the Gdk.Screen will be used.
the cairo.FontOptions or null if not set
Obtains the frame clock for a widget. The frame clock is a global
“ticker” that can be used to drive animations and repaints. The
most common reason to get the frame clock is to call
gdk_frame_clock_get_frame_time(), in order to get a time to use for
animating. For example you might record the start of the animation
with an initial value from gdk_frame_clock_get_frame_time(), and
then update the animation by calling
gdk_frame_clock_get_frame_time() again during each repaint.
gdk_frame_clock_request_phase() will result in a new frame on the
clock, but won’t necessarily repaint any widgets. To repaint a
widget, you have to use gtk_widget_queue_draw() which invalidates
the widget (thus scheduling it to receive a draw on the next
frame). gtk_widget_queue_draw() will also end up requesting a frame
on the appropriate frame clock.
A widget’s frame clock will not change while the widget is mapped. Reparenting a widget (which implies a temporary unmap) can change the widget’s frame clock.
Unrealized widgets do not have a frame clock.
a Gdk.FrameClock, or null if widget is unrealized
Gets the value of the Gtk.Widget.halign property.
For backwards compatibility reasons this method will never return Gtk.Align.BASELINE, but instead it will convert it to Gtk.Align.FILL. Baselines are not supported for horizontal alignment.
the horizontal alignment of widget
Returns the current value of the has-tooltip property. See Gtk.Widget.has_tooltip for more information.
current value of has-tooltip on widget.
Determines whether widget has a Gdk.Window of its own. See
gtk_widget_set_has_window().
true if widget has a window, false otherwise
Gets whether the widget would like any available extra horizontal space. When a user resizes a Gtk.Window, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.
Containers should use gtk_widget_compute_expand() rather than
this function, to see whether a widget, or any of its children,
has the expand flag set. If any child of a widget wants to
expand, the parent may ask to expand also.
This function only looks at the widget’s own hexpand flag, rather than computing whether the entire widget tree rooted at this widget wants to expand.
whether hexpand flag is set
Gets whether gtk_widget_set_hexpand() has been used to
explicitly set the expand flag on this widget.
If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.
There are few reasons to use this function, but it’s here for completeness and consistency.
whether hexpand has been explicitly set
Returns whether the box is homogeneous (all children are the
same size). See gtk_box_set_homogeneous().
true if the box is homogeneous.
Whether the widget is mapped.
true if the widget is mapped, false otherwise.
Returns the modifier mask the widget’s windowing system backend
uses for a particular purpose.
See gdk_keymap_get_modifier_mask().
the use case for the modifier mask
the modifier mask used for intent.
Returns the current modifier style for the widget. (As set by
gtk_widget_modify_style().) If no style has previously set, a new
Gtk.RcStyle will be created with all values unset, and set as the
modifier style for the widget. If you make changes to this rc
style, you must call gtk_widget_modify_style(), passing in the
returned rc style, to make sure that your changes take effect.
Caution: passing the style back to gtk_widget_modify_style() will
normally end up destroying it, because gtk_widget_modify_style() copies
the passed-in style and sets the copy as the new modifier style,
thus dropping any reference to the old modifier style. Add a reference
to the modifier style if you want to keep it alive.
the modifier style for the widget. This rc style is owned by the widget. If you want to keep a pointer to value this around, you must add a refcount using g_object_ref().
Gets the name of the buildable object.
Gtk.Builder sets the name based on the
[GtkBuilder UI definition][BUILDER-UI]
used to construct the buildable.
the name set with gtk_buildable_set_name()
Returns the current value of the Gtk.Widget.no_show_all property,
which determines whether calls to gtk_widget_show_all()
will affect this widget.
the current value of the “no-show-all” property.
Fetches the requested opacity for this widget.
See gtk_widget_set_opacity().
the requested opacity for this widget.
Gets a Pango.Context with the appropriate font map, font description,
and base direction for this widget. Unlike the context returned
by gtk_widget_create_pango_context(), this context is owned by
the widget (it can be used until the screen for the widget changes
or the widget is removed from its toplevel), and will be updated to
match any changes to the widget’s attributes. This can be tracked
by using the Gtk.Widget.SignalSignatures.screen_changed | Gtk.Widget::screen-changed signal on the widget.
the Pango.Context for the widget.
Returns the Gtk.WidgetPath representing widget, if the widget
is not connected to a toplevel widget, a partial path will be
created.
The Gtk.WidgetPath representing widget
Returns a newly created widget path representing all the widget hierarchy
from the toplevel down to and including child.
A newly created Gtk.WidgetPath
Obtains the location of the mouse pointer in widget coordinates.
Widget coordinates are a bit odd; for historical reasons, they are
defined as widget->window coordinates for widgets that return true for
gtk_widget_get_has_window(); and are relative to widget->allocation.x,
widget->allocation.y otherwise.
Retrieves a widget’s initial minimum and natural height.
This call is specific to width-for-height requests.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given
the specified width, or the default height if width is -1. The baselines may be -1 which means
that no baseline is requested for this widget.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods
and by any GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
the width which is available for allocation, or -1 if none
Retrieves a widget’s minimum and natural height if it would be given
the specified width.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
the width which is available for allocation
Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management.
This is used to retrieve a suitable size by container widgets which do not impose any restrictions on the child placement. It can be used to deduce toplevel window and menu sizes as well as child widgets in free-form containers such as GtkLayout.
Handle with care. Note that the natural height of a height-for-width widget will generally be a smaller size than the minimum height, since the required height for the natural width is generally smaller than the required height for the minimum width.
Use gtk_widget_get_preferred_height_and_baseline_for_width() if you want to support
baseline alignment.
Retrieves a widget’s initial minimum and natural width.
This call is specific to height-for-width requests.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
Retrieves a widget’s minimum and natural width if it would be given
the specified height.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
the height which is available for allocation
Determines whether widget is realized.
true if widget is realized, false otherwise
Determines whether widget is always treated as the default widget
within its toplevel when it has the focus, even if another widget
is the default.
See gtk_widget_set_receives_default().
true if widget acts as the default widget when focused, false otherwise
Gets whether the widget prefers a height-for-width layout or a width-for-height layout.
Gtk.Bin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.
The Gtk.SizeRequestMode preferred by widget.
Retrieves the widget’s requisition.
This function should only be used by widget implementations in
order to figure whether the widget’s requisition has actually
changed after some internal state change (so that they can call
gtk_widget_queue_resize() instead of gtk_widget_queue_draw()).
Normally, gtk_widget_size_request() should be used.
Returns the resize mode for the container. See gtk_container_set_resize_mode ().
the current resize mode
Get the root window where this widget is located. This function can only be called after the widget has been added to a widget hierarchy with Gtk.Window at the top.
The root window is useful for such purposes as creating a popup Gdk.Window associated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.
the Gdk.Window root window for the toplevel for this widget.
Retrieves the internal scale factor that maps from window coordinates to the actual device pixels. On traditional systems this is 1, on high density outputs, it can be a higher value (typically 2).
See gdk_window_get_scale_factor().
the scale factor for widget
Get the Gdk.Screen from the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a Gtk.Window at the top.
In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.
the Gdk.Screen for the toplevel for this widget.
Returns the widget’s sensitivity (in the sense of returning
the value that has been set using gtk_widget_set_sensitive()).
The effective sensitivity of a widget is however determined by both its
own and its parent widget’s sensitivity. See gtk_widget_is_sensitive().
true if the widget is sensitive
Gets the settings object holding the settings used for this widget.
Note that this function can only be called when the Gtk.Widget is attached to a toplevel, since the settings object is specific to a particular Gdk.Screen.
the relevant Gtk.Settings object
Gets the size request that was explicitly set for the widget using
gtk_widget_set_size_request(). A value of -1 stored in width or
height indicates that that dimension has not been set explicitly
and the natural requisition of the widget will be used instead. See
gtk_widget_set_size_request(). To get the size a widget will
actually request, call gtk_widget_get_preferred_size() instead of
this function.
Gets the value set by gtk_box_set_spacing().
spacing between children
Returns the widget state as a flag set. It is worth mentioning
that the effective Gtk.StateFlags.INSENSITIVE state will be
returned, that is, also based on parent insensitivity, even if
widget itself is sensitive.
Also note that if you are looking for a way to obtain the
Gtk.StateFlags to pass to a Gtk.StyleContext method, you
should look at gtk_style_context_get_state().
The state flags for widget
Returns the style context associated to widget. The returned object is
guaranteed to be the same for the lifetime of widget.
a Gtk.StyleContext. This memory is owned by widget and must not be freed.
Returns true if widget is multiple pointer aware. See
gtk_widget_set_support_multidevice() for more information.
true if widget is multidevice aware.
Fetch an object build from the template XML for widget_type in this widget instance.
This will only report children which were previously declared with
gtk_widget_class_bind_template_child_full() or one of its
variants.
This function is only meant to be called for code which is private to the widget_type which
declared the child and is meant for language bindings which cannot easily make use
of the GObject structure offsets.
The GObject.GType to get a template child for
The “id” of the child defined in the template XML
The object built in the template XML with the id name
Gets the contents of the tooltip for widget.
the tooltip text, or null. You should free the returned string with g_free() when done.
Gets the contents of the tooltip for widget.
the tooltip text, or null. You should free the returned string with g_free() when done.
Returns the Gtk.Window of the current tooltip. This can be the
GtkWindow created by default, or the custom tooltip window set
using gtk_widget_set_tooltip_window().
The Gtk.Window of the current tooltip.
This function returns the topmost widget in the container hierarchy
widget is a part of. If widget has no parent widgets, it will be
returned as the topmost widget. No reference will be added to the
returned widget; it should not be unreferenced.
Note the difference in behavior vs. gtk_widget_get_ancestor();
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)
would return
null if widget wasn’t inside a toplevel window, and if the
window was inside a Gtk.Window-derived widget which was in turn
inside the toplevel Gtk.Window. While the second case may
seem unlikely, it actually happens when a Gtk.Plug is embedded
inside a Gtk.Socket within the same application.
To reliably find the toplevel Gtk.Window, use
gtk_widget_get_toplevel() and call GTK_IS_WINDOW()
on the result. For instance, to get the title of a widget's toplevel
window, one might use:
static const char *
get_widget_toplevel_title (GtkWidget *widget)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (toplevel))
{
return gtk_window_get_title (GTK_WINDOW (toplevel));
}
return NULL;
}
the topmost ancestor of widget, or widget itself if there’s no ancestor.
Gets the value of the Gtk.Widget.valign property.
For backwards compatibility reasons this method will never return
Gtk.Align.BASELINE, but instead it will convert it to
Gtk.Align.FILL. If your widget want to support baseline aligned
children it must use gtk_widget_get_valign_with_baseline(), or
g_object_get (widget, "valign", &value, NULL), which will
also report the true value.
the vertical alignment of widget, ignoring baseline alignment
Gets the value of the Gtk.Widget.valign property, including Gtk.Align.BASELINE.
the vertical alignment of widget
Gets whether the widget would like any available extra vertical space.
See gtk_widget_get_hexpand() for more detail.
whether vexpand flag is set
Gets whether gtk_widget_set_vexpand() has been used to
explicitly set the expand flag on this widget.
See gtk_widget_get_hexpand_set() for more detail.
whether vexpand has been explicitly set
Determines whether the widget is visible. If you want to
take into account whether the widget’s parent is also marked as
visible, use gtk_widget_is_visible() instead.
This function does not check if the widget is obscured in any way.
See gtk_widget_set_visible().
true if the widget is visible
Makes widget the current grabbed widget.
This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget.
If widget is not sensitive, it is not set as the current
grabbed widget and this function does nothing.
Causes widget to become the default widget. widget must be able to be
a default widget; typically you would ensure this yourself
by calling gtk_widget_set_can_default() with a true value.
The default widget is activated when
the user presses Enter in a window. Default widgets must be
activatable, that is, gtk_widget_activate() should affect them. Note
that Gtk.Entry widgets require the “activates-default” property
set to true before they activate the default widget when Enter
is pressed and the Gtk.Entry is focused.
Causes widget to have the keyboard focus for the Gtk.Window it's
inside. widget must be a focusable widget, such as a Gtk.Entry;
something like Gtk.Frame won’t work.
More precisely, it must have the GTK_CAN_FOCUS flag set. Use
gtk_widget_set_can_focus() to modify that flag.
The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.
Removes the grab from the given widget.
You have to pair calls to gtk_grab_add() and gtk_grab_remove().
If widget does not have the grab, this function does nothing.
Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).
See also gtk_grab_add().
true if the widget is in the grab_widgets stack
Determines if the widget style has been looked up through the rc mechanism.
true if the widget has been looked up through the rc mechanism, false otherwise.
Checks whether there is a Gdk.Screen is associated with this widget. All toplevel widgets have an associated screen, and all widgets added into a hierarchy with a toplevel window at the top.
true if there is a Gdk.Screen associated with the widget.
Determines if the widget should show a visible indication that
it has the global input focus. This is a convenience function for
use in ::draw handlers that takes into account whether focus
indication should currently be shown in the toplevel window of
widget. See gtk_window_get_focus_visible() for more information
about focus indication.
To find out if the widget has the global input focus, use
gtk_widget_has_focus().
true if the widget should display a “focus rectangle”
Reverses the effects of gtk_widget_show(), causing the widget to be
hidden (invisible to the user).
Utility function; intended to be connected to the Gtk.Widget.SignalSignatures.delete_event | Gtk.Widget::delete-event
signal on a Gtk.Window. The function calls gtk_widget_hide() on its
argument, then returns true. If connected to ::delete-event, the
result is that clicking the close button for a window (on the
window frame, top right corner usually) will hide but not destroy
the window. By default, GTK+ destroys windows when ::delete-event
is received.
true
Returns whether the widget is currently being destroyed. This information can sometimes be used to avoid doing unnecessary work.
true if widget is being destroyed
Creates and initializes child widgets defined in templates. This
function must be called in the instance initializer for any
class which assigned itself a template using gtk_widget_class_set_template()
It is important to call this function in the instance initializer of a Gtk.Widget subclass and not in GObject.Object.constructed() or GObject.Object.constructor() for two reasons.
One reason is that generally derived widgets will assume that parent class composite widgets have been created in their instance initializers.
Another reason is that when calling g_object_new() on a widget with
composite templates, it’s important to build the composite widgets
before the construct properties are set. Properties passed to g_object_new()
should take precedence over properties set in the private template XML.
Sets an input shape for this widget’s GDK window. This allows for
windows which react to mouse click in a nonrectangular region, see
gdk_window_input_shape_combine_region() for more information.
Inserts group into widget. Children of widget that implement
Gtk.Actionable can then be associated with actions in group by
setting their “action-name” to
prefix.action-name.
If group is null, a previously inserted group for name is removed
from widget.
the prefix for actions in group
Optionalgroup: Gio.ActionGroupa Gio.ActionGroup, or null
Determines whether widget is somewhere inside ancestor, possibly with
intermediate containers.
another Gtk.Widget
true if ancestor contains widget as a child, grandchild, great grandchild, etc.
Whether widget can rely on having its alpha channel
drawn correctly. On X11 this function returns whether a
compositing manager is running for widget’s screen.
Please note that the semantics of this call will change
in the future if used on a widget that has a composited
window in its hierarchy (as set by gdk_window_set_composited()).
true if the widget can rely on its alpha channel being drawn correctly.
Determines whether widget can be drawn to. A widget can be drawn
to if it is mapped and visible.
true if widget is drawable, false otherwise
Returns the widget’s effective sensitivity, which means it is sensitive itself and also its parent widget is sensitive
true if the widget is effectively sensitive
Determines whether widget is a toplevel widget.
Currently only Gtk.Window and Gtk.Invisible (and out-of-process
GtkPlugs) are toplevel widgets. Toplevel widgets have no parent
widget.
true if widget is a toplevel, false otherwise
Determines whether the widget and all its parents are marked as visible.
This function does not check if the widget is obscured in any way.
See also gtk_widget_get_visible() and gtk_widget_set_visible()
true if the widget and all its parents are visible
This function should be called whenever keyboard navigation within
a single widget hits a boundary. The function emits the
Gtk.Widget.SignalSignatures.keynav_failed | Gtk.Widget::keynav-failed signal on the widget and its return
value should be interpreted in a way similar to the return value of
gtk_widget_child_focus():
When true is returned, stay in the widget, the failed keyboard
navigation is OK and/or there is nowhere we can/should move the
focus to.
When false is returned, the caller should continue with keyboard
navigation outside the widget, e.g. by calling
gtk_widget_child_focus() on the widget’s toplevel.
The default ::keynav-failed handler returns false for
Gtk.DirectionType.TAB_FORWARD and Gtk.DirectionType.TAB_BACKWARD. For the other
values of Gtk.DirectionType it returns true.
Whenever the default handler returns true, it also calls
gtk_widget_error_bell() to notify the user of the failed keyboard
navigation.
A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of Gtk.Entry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.
direction of focus movement
true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).
Lists the closures used by widget for accelerator group connections
with gtk_accel_group_connect_by_path() or gtk_accel_group_connect().
The closures can be used to monitor accelerator changes on widget,
by connecting to the GtkAccelGroup::accel-changed signal of the
Gtk.AccelGroup of a closure which can be found out with
gtk_accel_group_from_accel_closure().
a newly allocated GLib.List of closures
Retrieves a null-terminated array of strings containing the prefixes of
Gio.ActionGroup's available to widget.
a null-terminated array of strings.
Returns a newly allocated list of the widgets, normally labels, for
which this widget is the target of a mnemonic (see for example,
gtk_label_set_mnemonic_widget()).
The widgets in the list are not individually referenced. If you
want to iterate through the list and perform actions involving
callbacks that might destroy the widgets, you
must call g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and then unref all the
widgets afterwards.
the list of mnemonic labels; free this list with g_list_free() when you are done with it.
This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.
Emits the Gtk.Widget.SignalSignatures.mnemonic_activate | Gtk.Widget::mnemonic-activate signal.
true if there are other widgets with the same mnemonic
true if the signal has been handled
Sets the base color for a widget in a particular state.
All other style values are left untouched. The base color
is the background color used along with the text color
(see gtk_widget_modify_text()) for widgets such as Gtk.Entry
and Gtk.TextView. See also gtk_widget_modify_style().
Note that “no window” widgets (which have the
GTK_NO_WINDOWflag set) draw on their parent container’s window and thus may not draw any background themselves. This is the case for e.g. Gtk.Label.To modify the background of such widgets, you have to set the base color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a Gtk.EventBox widget and setting the base color on that.
Sets the background color for a widget in a particular state.
All other style values are left untouched.
See also gtk_widget_modify_style().
Note that “no window” widgets (which have the
GTK_NO_WINDOWflag set) draw on their parent container’s window and thus may not draw any background themselves. This is the case for e.g. Gtk.Label.To modify the background of such widgets, you have to set the background color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a Gtk.EventBox widget and setting the background color on that.
Sets the cursor color to use in a widget, overriding the Gtk.Widget cursor-color and secondary-cursor-color style properties.
All other style values are left untouched.
See also gtk_widget_modify_style().
Optionalprimary: Gdk.Colorthe color to use for primary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_cursor().
Optionalsecondary: Gdk.Colorthe color to use for secondary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_cursor().
Sets the foreground color for a widget in a particular state.
All other style values are left untouched.
See also gtk_widget_modify_style().
Sets the font to use for a widget.
All other style values are left untouched.
See also gtk_widget_modify_style().
Optionalfont_desc: Pango.FontDescriptionthe font description to use, or null to undo the effect of previous calls to gtk_widget_modify_font()
Modifies style values on the widget.
Modifications made using this technique take precedence over
style values set via an RC file, however, they will be overridden
if a style is explicitly set on the widget using gtk_widget_set_style().
The Gtk.RcStyle-struct is designed so each field can either be
set or unset, so it is possible, using this function, to modify some
style values and leave the others unchanged.
Note that modifications made with this function are not cumulative
with previous calls to gtk_widget_modify_style() or with such
functions as gtk_widget_modify_fg(). If you wish to retain
previous values, you must first call gtk_widget_get_modifier_style(),
make your modifications to the returned style, then call
gtk_widget_modify_style() with that style. On the other hand,
if you first call gtk_widget_modify_style(), subsequent calls
to such functions gtk_widget_modify_fg() will have a cumulative
effect with the initial modifications.
the Gtk.RcStyle-struct holding the style modifications
Sets the text color for a widget in a particular state.
All other style values are left untouched.
The text color is the foreground color used along with the
base color (see gtk_widget_modify_base()) for widgets such
as Gtk.Entry and Gtk.TextView.
See also gtk_widget_modify_style().
Sets the background color to use for a widget.
All other style values are left untouched.
See gtk_widget_override_color().
the state for which to set the background color
Optionalcolor: Gdk.RGBAthe color to assign, or null to undo the effect of previous calls to gtk_widget_override_background_color()
Sets the color to use for a widget.
All other style values are left untouched.
This function does not act recursively. Setting the color of a
container does not affect its children. Note that some widgets that
you may not think of as containers, for instance GtkButtons,
are actually containers.
This API is mostly meant as a quick way for applications to
change a widget appearance. If you are developing a widgets
library and intend this change to be themeable, it is better
done by setting meaningful CSS classes in your
widget/container implementation through gtk_style_context_add_class().
This way, your widget library can install a Gtk.CssProvider
with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order
to provide a default styling for those widgets that need so, and
this theming may fully overridden by the user’s theme.
Note that for complex widgets this may bring in undesired
results (such as uniform background color everywhere), in
these cases it is better to fully style such widgets through a
Gtk.CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
priority.
the state for which to set the color
Optionalcolor: Gdk.RGBAthe color to assign, or null to undo the effect of previous calls to gtk_widget_override_color()
Sets the cursor color to use in a widget, overriding the
cursor-color and secondary-cursor-color
style properties. All other style values are left untouched.
See also gtk_widget_modify_style().
Note that the underlying properties have the Gdk.Color type,
so the alpha value in primary and secondary will be ignored.
Optionalcursor: Gdk.RGBAthe color to use for primary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_override_cursor().
Optionalsecondary_cursor: Gdk.RGBAthe color to use for secondary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_override_cursor().
Sets the font to use for a widget. All other style values are
left untouched. See gtk_widget_override_color().
Optionalfont_desc: Pango.FontDescriptionthe font description to use, or null to undo the effect of previous calls to gtk_widget_override_font()
Sets a symbolic color for a widget.
All other style values are left untouched.
See gtk_widget_override_color() for overriding the foreground
or background color.
Adds child to box, packed with reference to the end of box.
The child is packed after (away from end of) any other child
packed with reference to the end of box.
the Gtk.Widget to be added to box
true if the new child is to be given extra space allocated to box. The extra space will be divided evenly between all children of box that use this option
true if space given to child by the expand option is actually allocated to child, rather than just padding it. This parameter has no effect if expand is set to false. A child is always allocated the full height of a horizontal Gtk.Box and the full width of a vertical Gtk.Box. This option affects the other dimension
extra space in pixels to put between this child and its neighbors, over and above the global amount specified by Gtk.Box.spacing property. If child is a widget at one of the reference ends of box, then padding pixels are also put between child and the reference edge of box
Adds child to box, packed with reference to the start of box.
The child is packed after any other child packed with reference
to the start of box.
the Gtk.Widget to be added to box
true if the new child is to be given extra space allocated to box. The extra space will be divided evenly between all children that use this option
true if space given to child by the expand option is actually allocated to child, rather than just padding it. This parameter has no effect if expand is set to false. A child is always allocated the full height of a horizontal Gtk.Box and the full width of a vertical Gtk.Box. This option affects the other dimension
extra space in pixels to put between this child and its neighbors, over and above the global amount specified by Gtk.Box.spacing property. If child is a widget at one of the reference ends of box, then padding pixels are also put between child and the reference edge of box
Obtains the full path to widget. The path is simply the name of a
widget and all its parents in the container hierarchy, separated by
periods. The name of a widget comes from
gtk_widget_get_name(). Paths are used to apply styles to a widget
in gtkrc configuration files. Widget names are the type of the
widget by default (e.g. “GtkButton”) or can be set to an
application-specific value with gtk_widget_set_name(). By setting
the name of a widget, you allow users or theme authors to apply
styles to that specific widget in their gtkrc
file. path_reversed_p fills in the path in reverse order,
i.e. starting with widget’s name instead of starting with the name
of widget’s outermost ancestor.
When a container receives a call to the draw function, it must send
synthetic Gtk.Widget::draw calls to all children that don’t have their
own GdkWindows. This function provides a convenient way of doing this.
A container, when it receives a call to its Gtk.Widget::draw function,
calls gtk_container_propagate_draw() once for each child, passing in
the cr the container received.
gtk_container_propagate_draw() takes care of translating the origin of cr,
and deciding whether the draw needs to be sent to the child. It is a
convenient and optimized way of getting the same effect as calling
gtk_widget_draw() on the child directly.
In most cases, a container can simply either inherit the Gtk.Widget::draw implementation from Gtk.Container, or do some drawing and then chain to the ::draw implementation from Gtk.Container.
Obtains information about how child is packed into box.
the Gtk.Widget of the child to query
This function is only for use in widget implementations.
Flags the widget for a rerun of the GtkWidgetClass::size_allocate
function. Use this function instead of gtk_widget_queue_resize()
when the widget's size request didn't change but it wants to
reposition its contents.
An example user of this function is gtk_widget_set_halign().
Mark widget as needing to recompute its expand flags. Call
this function when setting legacy expand child properties
on the child of a container.
See gtk_widget_compute_expand().
Equivalent to calling gtk_widget_queue_draw_area() for the
entire area of a widget.
Convenience function that calls gtk_widget_queue_draw_region() on
the region created from the given coordinates.
The region here is specified in widget coordinates.
Widget coordinates are a bit odd; for historical reasons, they are
defined as widget->window coordinates for widgets that return true for
gtk_widget_get_has_window(), and are relative to widget->allocation.x,
widget->allocation.y otherwise.
width or height may be 0, in this case this function does
nothing. Negative values for width and height are not allowed.
x coordinate of upper-left corner of rectangle to redraw
y coordinate of upper-left corner of rectangle to redraw
width of region to draw
height of region to draw
Invalidates the area of widget defined by region by calling
gdk_window_invalidate_region() on the widget’s window and all its
child windows. Once the main loop becomes idle (after the current
batch of events has been processed, roughly), the window will
receive expose events for the union of all regions that have been
invalidated.
Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a Gtk.DrawingArea or some portion thereof.
This function is only for use in widget implementations. Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a Gtk.Label, Gtk.Label queues a resize to ensure there’s enough space for the new text.
Note that you cannot call gtk_widget_queue_resize() on a widget
from inside its implementation of the GtkWidgetClass::size_allocate
virtual method. Calls to gtk_widget_queue_resize() from inside
GtkWidgetClass::size_allocate will be silently ignored.
This function works like gtk_widget_queue_resize(),
except that the widget is not invalidated.
Creates the GDK (windowing system) resources associated with a
widget. For example, widget->window will be created when a widget
is realized. Normally realization happens implicitly; if you show
a widget and all its parent containers, then the widget will be
realized and mapped automatically.
Realizing a widget requires all
the widget’s parent widgets to be realized; calling
gtk_widget_realize() realizes the widget’s parents in addition to
widget itself. If a widget is not yet inside a toplevel window
when you realize it, bad things will happen.
This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as Gtk.Widget::draw. Or simply g_signal_connect () to the Gtk.Widget::realize signal.
Computes the intersection of a widget’s area and region, returning
the intersection. The result may be empty, use cairo_region_is_empty() to
check.
a cairo.Region, in the same coordinate system as widget->allocation. That is, relative to widget->window for widgets which return false from gtk_widget_get_has_window(); relative to the parent window of widget->window otherwise.
A newly allocated region holding the intersection of widget and region.
Registers a Gdk.Window with the widget and sets it up so that
the widget receives events for it. Call gtk_widget_unregister_window()
when destroying the window.
Before 3.8 you needed to call gdk_window_set_user_data() directly to set
this up. This is now deprecated and you should use gtk_widget_register_window()
instead. Old code will keep working as is, although some new features like
transparency might not work perfectly.
Removes widget from container. widget must be inside container.
Note that container will own a reference to widget, and that this
may be the last reference held; so removing a widget from its
container can destroy that widget. If you want to use widget
again, you need to add a reference to it before removing it from
a container, using g_object_ref(). If you don’t want to use widget
again it’s usually more efficient to simply destroy it directly
using gtk_widget_destroy() since this will remove it from the
container and help break any circular reference count cycles.
Removes an accelerator from widget, previously installed with
gtk_widget_add_accelerator().
accel group for this widget
GDK keyval of the accelerator
modifier key combination of the accelerator
whether an accelerator was installed and could be removed
Removes a widget from the list of mnemonic labels for
this widget. (See gtk_widget_list_mnemonic_labels()). The widget
must have previously been added to the list with
gtk_widget_add_mnemonic_label().
a Gtk.Widget that was previously set as a mnemonic label for widget with gtk_widget_add_mnemonic_label().
Removes a tick callback previously registered with
gtk_widget_add_tick_callback().
an id returned by gtk_widget_add_tick_callback()
A convenience function that uses the theme settings for widget
to look up stock_id and render it to a pixbuf. stock_id should
be a stock icon ID such as #GTK_STOCK_OPEN or #GTK_STOCK_OK. size
should be a size such as #GTK_ICON_SIZE_MENU. detail should be a
string that identifies the widget or code doing the rendering, so
that theme engines can special-case rendering for that widget or
code.
The pixels in the returned GdkPixbuf.Pixbuf are shared with the rest of
the application and should not be modified. The pixbuf should be
freed after use with g_object_unref().
a stock ID
a stock size (Gtk.IconSize). A size of (GtkIconSize)-1 means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).
Optionaldetail: stringrender detail to pass to theme engine
a new pixbuf, or null if the stock ID wasn’t known
A convenience function that uses the theme engine and style
settings for widget to look up stock_id and render it to
a pixbuf. stock_id should be a stock icon ID such as
#GTK_STOCK_OPEN or #GTK_STOCK_OK. size should be a size
such as #GTK_ICON_SIZE_MENU.
The pixels in the returned GdkPixbuf.Pixbuf are shared with the rest of
the application and should not be modified. The pixbuf should be freed
after use with g_object_unref().
a stock ID
a stock size (Gtk.IconSize). A size of (GtkIconSize)-1 means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).
a new pixbuf, or null if the stock ID wasn’t known
Moves child to a new position in the list of box children.
The list contains widgets packed #GTK_PACK_START
as well as widgets packed #GTK_PACK_END, in the order that these
widgets were added to box.
A widget’s position in the box children list determines where
the widget is packed into box. A child widget at some position
in the list will be packed just after all other widgets of the
same packing type that appear earlier in the list.
the Gtk.Widget to move
the new position for child in the list of children of box, starting from 0. If negative, indicates the end of the list
Moves a widget from one Gtk.Container to another, handling reference count issues to avoid destroying the widget.
a Gtk.Container to move the widget into
Reset the styles of widget and all descendents, so when
they are looked up again, they get the correct values
for the currently loaded RC file settings.
This function is not useful for applications.
Updates the style context of widget and all descendants
by updating its widget path. GtkContainers may want
to use this on a child when reordering it in a way that a different
style might apply to it. See also gtk_container_get_path_for_child().
Very rarely-used function. This function is used to emit
an expose event on a widget. This function is not normally used
directly. The only time it is used is when propagating an expose
event to a windowless child widget (gtk_widget_get_has_window() is false),
and that is normally done using gtk_container_propagate_draw().
If you want to force an area of a window to be redrawn,
use gdk_window_invalidate_rect() or gdk_window_invalidate_region().
To cause the redraw to be done immediately, follow that call
with a call to gdk_window_process_updates().
return from the event signal emission (true if the event was handled)
Sends the focus change event to widget
This function is not meant to be used by applications. The only time it should be used is when it is necessary for a Gtk.Widget to assign focus to a widget that is semantically owned by the first widget even though it’s not a direct child - for instance, a search entry in a floating window similar to the quick search in Gtk.TreeView.
An example of its usage is:
GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
fevent->focus_change.type = GDK_FOCUS_CHANGE;
fevent->focus_change.in = TRUE;
fevent->focus_change.window = _gtk_widget_get_window (widget);
if (fevent->focus_change.window != NULL)
g_object_ref (fevent->focus_change.window);
gtk_widget_send_focus_change (widget, fevent);
gdk_event_free (event);
the return value from the event signal emission: true if the event was handled, and false otherwise
Given an accelerator group, accel_group, and an accelerator path,
accel_path, sets up an accelerator in accel_group so whenever the
key binding that is defined for accel_path is pressed, widget
will be activated. This removes any accelerators (for any
accelerator group) installed by previous calls to
gtk_widget_set_accel_path(). Associating accelerators with
paths allows them to be modified by the user and the modifications
to be saved for future use. (See gtk_accel_map_save().)
This function is a low level function that would most likely be used by a menu creation system like Gtk.UIManager. If you use Gtk.UIManager, setting up accelerator paths will be done automatically.
Even when you you aren’t using Gtk.UIManager, if you only want to
set up accelerators on menu items gtk_menu_item_set_accel_path()
provides a somewhat more convenient interface.
Note that accel_path string will be stored in a GLib.Quark. Therefore, if you
pass a static string, you can save some memory by interning it first with
g_intern_static_string().
Optionalaccel_path: stringpath used to look up the accelerator
Optionalaccel_group: Gtk.AccelGroupSets the widget’s allocation. This should not be used directly, but from within a widget’s size_allocate method.
The allocation set should be the “adjusted” or actual
allocation. If you’re implementing a Gtk.Container, you want to use
gtk_widget_size_allocate() instead of gtk_widget_set_allocation().
The GtkWidgetClass::adjust_size_allocation virtual method adjusts the
allocation inside gtk_widget_size_allocate() to create an adjusted
allocation.
a pointer to a Gtk.Allocation to copy from
Sets whether the application intends to draw on the widget in an Gtk.Widget::draw handler.
This is a hint to the widget and does not affect the behavior of the GTK+ core; many widgets ignore this flag entirely. For widgets that do pay attention to the flag, such as Gtk.EventBox and Gtk.Window, the effect is to suppress default themed drawing of the widget's background. (Children of the widget will still be drawn.) The application is then entirely responsible for drawing the widget background.
Note that the background is still drawn when the widget is mapped.
true if the application will paint on the widget
Sets the baseline position of a box. This affects
only horizontal boxes with at least one baseline aligned
child. If there is more vertical space available than requested,
and the baseline is not allocated by the parent then
position is used to allocate the baseline wrt the
extra space available.
Sets the border width of the container.
The border width of a container is the amount of space to leave around the outside of the container. The only exception to this is Gtk.Window; because toplevel windows can’t leave space outside, they leave the space inside. The border is added on all sides of the container. To add space to only one side, use a specific Gtk.Widget.margin property on the child widget, for example Gtk.Widget.margin_top.
amount of blank space to leave outside the container. Valid values are in the range 0-65535 pixels.
Specifies whether widget can be a default widget. See
gtk_widget_grab_default() for details about the meaning of
“default”.
whether or not widget can be a default widget.
Specifies whether widget can own the input focus. See
gtk_widget_grab_focus() for actually setting the input focus on a
widget.
whether or not widget can own the input focus.
Sets the way child is packed into box.
the Gtk.Widget of the child to set
the new value of the expand child property
the new value of the fill child property
the new value of the padding child property
the new value of the pack-type child property
Sets whether widget should be mapped along with its when its parent
is mapped and widget has been shown with gtk_widget_show().
The child visibility can be set for widget before it is added to
a container with gtk_widget_set_parent(), to avoid mapping
children unnecessary before immediately unmapping them. However
it will be reset to its default state of true when the widget
is removed from a container.
Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself.
This function is only useful for container implementations and never should be called by an application.
if true, widget should be mapped along with its parent.
Sets the widget’s clip. This must not be used directly,
but from within a widget’s size_allocate method.
It must be called after gtk_widget_set_allocation() (or after chaining up
to the parent class), because that function resets the clip.
The clip set should be the area that widget draws on. If widget is a
Gtk.Container, the area must contain all children's clips.
If this function is not called by widget during a ::size-allocate handler,
the clip will be set to widget's allocation.
a pointer to a Gtk.Allocation to copy from
Sets a widgets composite name. The widget must be
a composite child of its parent; see gtk_widget_push_composite_child().
the name to set
Enables or disables a Gdk.Device to interact with widget
and all its children.
It does so by descending through the Gdk.Window hierarchy
and enabling the same mask that is has for core events
(i.e. the one that gdk_window_get_events() returns).
Sets the device event mask (see Gdk.EventMask) for a widget. The event
mask determines which events a widget will receive from device. Keep
in mind that different widgets have different default event masks, and by
changing the event mask you may disrupt a widget’s functionality,
so be careful. This function must be called while a widget is
unrealized. Consider gtk_widget_add_device_events() for widgets that are
already realized, or if you want to preserve the existing event
mask. This function can’t be used with windowless widgets (which return
false from gtk_widget_get_has_window());
to get events on those widgets, place them inside a Gtk.EventBox
and receive events on the event box.
Sets the reading direction on a particular widget. This direction controls the primary direction for widgets containing text, and also the direction in which the children of a container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left reading directions can be done. Generally, applications will let the default reading direction present, except for containers where the containers are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification).
If the direction is set to Gtk.TextDirection.NONE, then the value
set by gtk_widget_set_default_direction() will be used.
the new direction
Widgets are double buffered by default; you can use this function
to turn off the buffering. “Double buffered” simply means that
gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() are called
automatically around expose events sent to the
widget. gdk_window_begin_draw_frame() diverts all drawing to a widget's
window to an offscreen buffer, and gdk_window_end_draw_frame() draws the
buffer to the screen. The result is that users see the window
update in one smooth step, and don’t see individual graphics
primitives being rendered.
In very simple terms, double buffered widgets don’t flicker, so you would only use this function to turn off double buffering if you had special needs and really knew what you were doing.
Note: if you turn off double-buffering, you have to handle
expose events, since even the clearing to the background color or
pixmap will not happen automatically (as it is done in
gdk_window_begin_draw_frame()).
In 3.10 GTK and GDK have been restructured for translucent drawing. Since then expose events for double-buffered widgets are culled into a single event to the toplevel GDK window. If you now unset double buffering, you will cause a separate rendering pass for every widget. This will likely cause rendering problems - in particular related to stacking - and usually increases rendering times significantly.
true to double-buffer a widget
Sets the event mask (see Gdk.EventMask) for a widget. The event
mask determines which events a widget will receive. Keep in mind
that different widgets have different default event masks, and by
changing the event mask you may disrupt a widget’s functionality,
so be careful. This function must be called while a widget is
unrealized. Consider gtk_widget_add_events() for widgets that are
already realized, or if you want to preserve the existing event
mask. This function can’t be used with widgets that have no window.
(See gtk_widget_get_has_window()). To get events on those widgets,
place them inside a Gtk.EventBox and receive events on the event
box.
event mask
Sets a focus chain, overriding the one computed automatically by GTK+.
In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it’s allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn’t always packed. The necessary checks are done when the focus chain is actually traversed.
Sets, or unsets if child is null, the focused child of container.
This function emits the GtkContainer::set_focus_child signal of
container. Implementations of Gtk.Container can override the
default behaviour by overriding the class closure of this signal.
This is function is mostly meant to be used by widgets. Applications can use
gtk_widget_grab_focus() to manually set the focus to a specific widget.
Optionalchild: Gtk.Widgeta Gtk.Widget, or null
Hooks up an adjustment to focus handling in a container, so when a child
of the container is focused, the adjustment is scrolled to show that
widget. This function sets the horizontal alignment.
See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining
the adjustment and gtk_container_set_focus_vadjustment() for setting
the vertical adjustment.
The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container.
an adjustment which should be adjusted when the focus is moved among the descendents of container
Sets whether the widget should grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.
whether the widget should grab focus when clicked with the mouse
Hooks up an adjustment to focus handling in a container, so when a
child of the container is focused, the adjustment is scrolled to
show that widget. This function sets the vertical alignment. See
gtk_scrolled_window_get_vadjustment() for a typical way of obtaining
the adjustment and gtk_container_set_focus_hadjustment() for setting
the horizontal adjustment.
The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container.
an adjustment which should be adjusted when the focus is moved among the descendents of container
Sets the font map to use for Pango rendering. When not set, the widget will inherit the font map from its parent.
Optionalfont_map: Pango.FontMap<GObject.Object>a Pango.FontMap, or null to unset any previously set font map
Sets the cairo.FontOptions used for Pango rendering in this widget. When not set, the default font options for the Gdk.Screen will be used.
Optionaloptions: default.FontOptionsa cairo.FontOptions, or null to unset any previously set default font options.
Sets the horizontal alignment of widget.
See the Gtk.Widget.halign property.
Sets the has-tooltip property on widget to has_tooltip. See
Gtk.Widget.has_tooltip for more information.
whether or not widget has a tooltip.
Specifies whether widget has a Gdk.Window of its own. Note that
all realized widgets have a non-null “window” pointer
(gtk_widget_get_window() never returns a null window when a widget
is realized), but for many of them it’s actually the Gdk.Window of
one of its parent widgets. Widgets that do not create a %window for
themselves in Gtk.Widget::realize must announce this by
calling this function with has_window = false.
This function should only be called by widget implementations,
and they should call it in their init() function.
whether or not widget has a window.
Sets whether the widget would like any available extra horizontal space. When a user resizes a Gtk.Window, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.
Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room.
By default, widgets automatically expand if any of their children
want to expand. (To see if a widget will automatically expand given
its current children and state, call gtk_widget_compute_expand(). A
container can decide how the expandability of children affects the
expansion of the container by overriding the compute_expand virtual
method on Gtk.Widget.).
Setting hexpand explicitly with this function will override the automatic expand behavior.
This function forces the widget to expand or not to expand,
regardless of children. The override occurs because
gtk_widget_set_hexpand() sets the hexpand-set property (see
gtk_widget_set_hexpand_set()) which causes the widget’s hexpand
value to be used, rather than looking at children and widget state.
whether to expand
Sets whether the hexpand flag (see gtk_widget_get_hexpand()) will
be used.
The hexpand-set property will be set automatically when you call
gtk_widget_set_hexpand() to set hexpand, so the most likely
reason to use this function would be to unset an explicit expand
flag.
If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.
There are few reasons to use this function, but it’s here for completeness and consistency.
value for hexpand-set property
Sets the Gtk.Box.homogeneous property of box, controlling
whether or not all children of box are given equal space
in the box.
a boolean value, true to create equal allotments, false for variable allotments
Marks the widget as being mapped.
This function should only ever be called in a derived widget's “map” or “unmap” implementation.
true to mark the widget as mapped
Sets the bottom margin of widget.
See the Gtk.Widget.margin_bottom property.
the bottom margin
Sets the end margin of widget.
See the Gtk.Widget.margin_end property.
the end margin
Sets the left margin of widget.
See the Gtk.Widget.margin_left property.
the left margin
Sets the right margin of widget.
See the Gtk.Widget.margin_right property.
the right margin
Sets the start margin of widget.
See the Gtk.Widget.margin_start property.
the start margin
Sets the top margin of widget.
See the Gtk.Widget.margin_top property.
the top margin
Sets the name of the buildable object.
name to set
Sets the Gtk.Widget.no_show_all property, which determines whether
calls to gtk_widget_show_all() will affect this widget.
This is mostly for use in constructing widget hierarchies with externally controlled visibility, see Gtk.UIManager.
the new value for the “no-show-all” property
Request the widget to be rendered partially transparent,
with opacity 0 being fully transparent and 1 fully opaque. (Opacity values
are clamped to the [0,1] range.).
This works on both toplevel widget, and child widgets, although there
are some limitations:
For toplevel widgets this depends on the capabilities of the windowing
system. On X11 this has any effect only on X screens with a compositing manager
running. See gtk_widget_is_composited(). On Windows it should work
always, although setting a window’s opacity after the window has been
shown causes it to flicker once on Windows.
For child widgets it doesn’t work if any affected widget has a native window, or disables double buffering.
desired opacity, between 0 and 1
This function is useful only when implementing subclasses of
Gtk.Container.
Sets the container as the parent of widget, and takes care of
some details such as updating the state and style of the child
to reflect its new location. The opposite function is
gtk_widget_unparent().
Sets a non default parent window for widget.
For Gtk.Window classes, setting a parent_window effects whether
the window is a toplevel window or can be embedded into other
widgets.
For Gtk.Window classes, this needs to be called before the window is realized.
Marks the widget as being realized. This function must only be
called after all GdkWindows for the widget have been created
and registered.
This function should only ever be called in a derived widget's “realize” or “unrealize” implementation.
true to mark the widget as realized
Sets the reallocate_redraws flag of the container to the given value.
Containers requesting reallocation redraws get automatically redrawn if any of their children changed allocation.
the new value for the container’s reallocate_redraws flag
Specifies whether widget will be treated as the default widget
within its toplevel when it has the focus, even if another widget
is the default.
See gtk_widget_grab_default() for details about the meaning of
“default”.
whether or not widget can be a default widget.
Sets whether the entire widget is queued for drawing when its size
allocation changes. By default, this setting is true and
the entire widget is redrawn on every size change. If your widget
leaves the upper left unchanged when made bigger, turning this
setting off will improve performance.
Note that for widgets where gtk_widget_get_has_window() is false
setting this flag to false turns off all allocation on resizing:
the widget will not even redraw if its position changes; this is to
allow containers that don’t draw anything to avoid excess
invalidations. If you set this flag on a widget with no window that
does draw on widget->window, you are
responsible for invalidating both the old and new allocation of the
widget when the widget is moved and responsible for invalidating
regions newly when the widget increases size.
if true, the entire widget will be redrawn when it is allocated to a new size. Otherwise, only the new portion of the widget will be redrawn.
Sets the resize mode for the container.
The resize mode of a container determines whether a resize request will be passed to the container’s parent, queued for later execution or executed immediately.
the new resize mode
Sets the sensitivity of a widget. A widget is sensitive if the user can interact with it. Insensitive widgets are “grayed out” and the user can’t interact with them. Insensitive widgets are known as “inactive”, “disabled”, or “ghosted” in some other toolkits.
true to make the widget sensitive
Sets the minimum size of a widget; that is, the widget’s size
request will be at least width by height. You can use this
function to force a widget to be larger than it normally would be.
In most cases, gtk_window_set_default_size() is a better choice for
toplevel windows than this function; setting the default size will
still allow users to shrink the window. Setting the size request
will force them to leave the window at least as large as the size
request. When dealing with window sizes,
gtk_window_set_geometry_hints() can be a useful function as well.
Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct.
The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it requested.
If the size request in a given direction is -1 (unset), then the “natural” size request of the widget will be used instead.
The size request set here does not include any margin from the Gtk.Widget properties margin-left, margin-right, margin-top, and margin-bottom, but it does include pretty much all other padding or border properties set by any subclass of Gtk.Widget.
width widget should request, or -1 to unset
height widget should request, or -1 to unset
Sets the Gtk.Box.spacing property of box, which is the
number of pixels to place between children of box.
the number of pixels to put between children
This function is for use in widget implementations. Turns on flag values in the current widget state (insensitive, prelighted, etc.).
This function accepts the values Gtk.StateFlags.DIR_LTR and
Gtk.StateFlags.DIR_RTL but ignores them. If you want to set the widget's
direction, use gtk_widget_set_direction().
It is worth mentioning that any other state than Gtk.StateFlags.INSENSITIVE,
will be propagated down to all non-internal children if widget is a
Gtk.Container, while Gtk.StateFlags.INSENSITIVE itself will be propagated
down to all Gtk.Container children by different means than turning on the
state flag down the hierarchy, both gtk_widget_get_state_flags() and
gtk_widget_is_sensitive() will make use of these.
State flags to turn on
Whether to clear state before turning on flags
Enables or disables multiple pointer awareness. If this setting is true,
widget will start receiving multiple, per device enter/leave events. Note
that if custom GdkWindows are created in Gtk.Widget::realize,
gdk_window_set_support_multidevice() will have to be called manually on them.
true to support input from multiple devices.
Sets markup as the contents of the tooltip, which is marked up with
the [Pango text markup language][PangoMarkupFormat].
This function will take care of setting Gtk.Widget.has_tooltip to true
and of the default handler for the Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip signal.
See also the Gtk.Widget.tooltip_markup property and
gtk_tooltip_set_markup().
Optionalmarkup: stringthe contents of the tooltip for widget, or null
Sets text as the contents of the tooltip. This function will take
care of setting Gtk.Widget.has_tooltip to true and of the default
handler for the Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip signal.
See also the Gtk.Widget.tooltip_text property and gtk_tooltip_set_text().
Optionaltext: stringthe contents of the tooltip for widget
Replaces the default window used for displaying
tooltips with custom_window. GTK+ will take care of showing and
hiding custom_window at the right moment, to behave likewise as
the default tooltip window. If custom_window is null, the default
tooltip window will be used.
Optionalcustom_window: Gtk.Windowa Gtk.Window, or null
Sets the vertical alignment of widget.
See the Gtk.Widget.valign property.
Sets whether the widget would like any available extra vertical space.
See gtk_widget_set_hexpand() for more detail.
whether to expand
Sets whether the vexpand flag (see gtk_widget_get_vexpand()) will
be used.
See gtk_widget_set_hexpand_set() for more detail.
value for vexpand-set property
Sets the visibility state of widget. Note that setting this to
true doesn’t mean the widget is actually viewable, see
gtk_widget_get_visible().
This function simply calls gtk_widget_show() or gtk_widget_hide()
but is nicer to use when the visibility of the widget depends on
some condition.
whether the widget should be shown or not
Sets the visual that should be used for by widget and its children for
creating GdkWindows. The visual must be on the same Gdk.Screen as
returned by gtk_widget_get_screen(), so handling the
Gtk.Widget.SignalSignatures.screen_changed | Gtk.Widget::screen-changed signal is necessary.
Setting a new visual will not cause widget to recreate its windows,
so you should call this function before widget is realized.
Sets a widget’s window. This function should only be used in a
widget’s Gtk.Widget::realize implementation. The %window passed is
usually either new window created with gdk_window_new(), or the
window of its parent widget as returned by
gtk_widget_get_parent_window().
Widgets must indicate whether they will create their own Gdk.Window
by calling gtk_widget_set_has_window(). This is usually done in the
widget’s init() function.
Note that this function does not add any reference to window.
Flags a widget to be displayed. Any widget that isn’t shown will
not appear on the screen. If you want to show all the widgets in a
container, it’s easier to call gtk_widget_show_all() on the
container, instead of individually showing the widgets.
Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.
When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.
Recursively shows a widget, and any child widgets (if the widget is a container).
Shows a widget. If the widget is an unmapped toplevel widget (i.e. a Gtk.Window that has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.
This function is only used by Gtk.Container subclasses, to assign a size and position to their child widgets.
In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s Gtk.Widget.halign and Gtk.Widget.valign properties.
For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline()
instead.
This function is only used by Gtk.Container subclasses, to assign a size, position and (optionally) baseline to their child widgets.
In this function, the allocation and baseline may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual and adjust_baseline_allocation methods on the child will be used to adjust the allocation and baseline. Standard adjustments include removing the widget's margins, and applying the widget’s Gtk.Widget.halign and Gtk.Widget.valign properties.
If the child widget does not have a valign of Gtk.Align.BASELINE the baseline argument is ignored and -1 is used instead.
This function is typically used when implementing a Gtk.Container
subclass. Obtains the preferred size of a widget. The container
uses this information to arrange its child widgets and decide what
size allocations to give them with gtk_widget_size_allocate().
You can also call this function from an application, with some caveats. Most notably, getting a size request requires the widget to be associated with a screen, because font information may be needed. Multihead-aware applications should keep this in mind.
Also remember that the size request is not necessarily the size a widget will actually be allocated.
This function attaches the widget’s Gtk.Style to the widget's Gdk.Window. It is a replacement for
widget->style = gtk_style_attach (widget->style, widget->window);
and should only ever be called in a derived widget’s “realize” implementation which does not chain up to its parent class' “realize” implementation, because one of the parent classes (finally Gtk.Widget) would attach the style itself.
Gets the value of a style property of widget.
the name of a style property
location to return the property value
Reverts the effect of a previous call to gtk_widget_freeze_child_notify().
This causes all queued Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signals on widget to be
emitted.
Translate coordinates relative to src_widget’s allocation to coordinates
relative to dest_widget’s allocations. In order to perform this
operation, both widgets must be realized, and must share a common
toplevel.
false if either widget was not realized, or there was no common ancestor. In this case, nothing is stored in *dest_x and *dest_y. Otherwise true.
Triggers a tooltip query on the display where the toplevel of widget
is located. See gtk_tooltip_trigger_tooltip_query() for more
information.
This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped.
This function is only for use in widget implementations. Should be called by implementations of the remove method on Gtk.Container, to dissociate a child from the container.
This function is only useful in widget implementations.
Causes a widget to be unrealized (frees all GDK resources
associated with the widget, such as widget->window).
Unregisters a Gdk.Window from the widget that was previously set up with
gtk_widget_register_window(). You need to call this when the window is
no longer used by the widget, such as when you destroy it.
Removes a focus chain explicitly set with gtk_container_set_focus_chain().
This function is for use in widget implementations. Turns off flag
values for the current widget state (insensitive, prelighted, etc.).
See gtk_widget_set_state_flags().
State flags to turn off
Virtualvfunc_Adds widget to container. Typically used for simple containers
such as Gtk.Window, Gtk.Frame, or Gtk.Button; for more complicated
layout containers such as Gtk.Box or Gtk.Grid, this function will
pick default packing parameters that may not be correct. So
consider functions such as gtk_box_pack_start() and
gtk_grid_attach() as an alternative to gtk_container_add() in
those cases. A widget may be added to only one container at a time;
you can’t place the same widget inside two different containers.
Note that some containers, such as Gtk.ScrolledWindow or Gtk.ListBox, may add intermediate children between the added widget and the container.
Virtualvfunc_Virtualvfunc_Virtualvfunc_Virtualvfunc_Convert an initial size allocation assigned
by a Gtk.Container using gtk_widget_size_allocate(), into an actual
size allocation to be used by the widget. adjust_size_allocation
adjusts to a child widget’s actual allocation
from what a parent container computed for the
child. The adjusted allocation must be entirely within the original
allocation. In any custom implementation, chain up to the default
Gtk.Widget implementation of this method, which applies the margin
and alignment properties of Gtk.Widget. Chain up
before performing your own adjustments so your
own adjustments remove more allocation after the Gtk.Widget base
class has already removed margin and alignment. The natural size
passed in should be adjusted in the same way as the allocated size,
which allows adjustments to perform alignments or other changes
based on natural size.
Virtualvfunc_Convert an initial size request from a widget's
Gtk.SizeRequestMode virtual method implementations into a size request to
be used by parent containers in laying out the widget.
adjust_size_request adjusts from a child widget's
original request to what a parent container should
use for layout. The for_size argument will be -1 if the request should
not be for a particular size in the opposing orientation, i.e. if the
request is not height-for-width or width-for-height. If for_size is
greater than -1, it is the proposed allocation in the opposing
orientation that we need the request for. Implementations of
adjust_size_request should chain up to the default implementation,
which applies Gtk.Widget’s margin properties and imposes any values
from gtk_widget_set_size_request(). Chaining up should be last,
after your subclass adjusts the request, so
Gtk.Widget can apply constraints and add the margin properly.
Virtualvfunc_Signal will be emitted when a button (typically from a mouse) is pressed.
Virtualvfunc_Signal will be emitted when a button (typically from a mouse) is released.
Virtualvfunc_Determines whether an accelerator that activates the signal
identified by signal_id can currently be activated.
This is done by emitting the Gtk.Widget.SignalSignatures.can_activate_accel | Gtk.Widget::can-activate-accel
signal on widget; if the signal isn’t overridden by a
handler or in a derived widget, then the default check is
that the widget must be sensitive, and the widget and all
its ancestors mapped.
the ID of a signal installed on widget
Virtualvfunc_Signal emitted when a size recalculation is needed.
Virtualvfunc_Emits a Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signal for the
[child property][child-properties] child_property
on widget.
This is the analogue of g_object_notify() for child properties.
Also see gtk_container_child_notify().
Virtualvfunc_Virtualvfunc_Virtualvfunc_Signal emitted when the composited status of
widgets screen changes. See gdk_screen_is_composited().
Virtualvfunc_Computes whether a container should give this widget extra space when possible.
Virtualvfunc_Signal will be emitted when the size, position or stacking of the widget’s window has changed.
Virtualvfunc_Constructs a child of buildable with the name name.
Gtk.Builder calls this function if a “constructor” has been specified in the UI definition.
Gtk.Builder used to construct this object
name of child to construct
Virtualvfunc_Virtualvfunc_This is called at the end of each custom element handled by the buildable.
Gtk.Builder used to construct this object
child object or null for non-child tags
name of tag
Optionaldata: anyuser data that will be passed in to parser functions
Virtualvfunc_This is called for each unknown element under <child>.
a Gtk.Builder used to construct this object
child object or null for non-child tags
name of tag
Virtualvfunc_Signal emitted when a redirected window belonging to widget gets drawn into.
Virtualvfunc_Signal emitted if a user requests that a toplevel window is closed.
Virtualvfunc_Destroys a widget.
When a widget is destroyed all references it holds on other objects will be released:
It's expected that all references held on the widget will also
be released; you should connect to the Gtk.Widget::destroy signal
if you hold a reference to widget and you wish to remove it when
this function is called. It is not necessary to do so if you are
implementing a Gtk.Container, as you'll be able to use the
Gtk.ContainerClass.remove() virtual function for that.
It's important to notice that gtk_widget_destroy() will only cause
the widget to be finalized if no additional references, acquired
using g_object_ref(), are held on it. In case additional references
are in place, the widget will be in an "inert" state after calling
this function; widget will still point to valid memory, allowing you
to release the references you hold, but you may not query the widget's
own state.
You should typically call this function on top level widgets, and rarely on child widgets.
See also: gtk_container_remove()
Virtualvfunc_Virtualvfunc_Signal emitted when the text direction of a widget changes.
Virtualvfunc_Virtualvfunc_Signal emitted on the drag source when a drag is started.
Virtualvfunc_Signal emitted on the drag source when a drag with the action Gdk.DragAction.MOVE is successfully completed.
Virtualvfunc_Signal emitted on the drag source when the drop site requests the data which is dragged.
Virtualvfunc_Signal emitted on the drop site when the dragged data has been received.
Virtualvfunc_Signal emitted on the drop site when the user drops the data onto the widget.
Virtualvfunc_Signal emitted on the drag source when a drag is finished.
Virtualvfunc_Signal emitted on the drag source when a drag has failed.
Virtualvfunc_Signal emitted on the drop site when the cursor leaves the widget.
Virtualvfunc_signal emitted on the drop site when the user moves the cursor over the widget during a drag.
Virtualvfunc_Virtualvfunc_Signal event will be emitted when the pointer enters the widget’s window.
Virtualvfunc_Rarely-used function. This function is used to emit
the event signals on a widget (those signals should never
be emitted without using this function to do so).
If you want to synthesize an event though, don’t use this function;
instead, use gtk_main_do_event() so the event will behave as if
it were in the event queue. Don’t synthesize expose events; instead,
use gdk_window_invalidate_rect() to invalidate a region of the
window.
Virtualvfunc_Virtualvfunc_Signal emitted when the keyboard focus enters the widget’s window.
Virtualvfunc_Signal emitted when the keyboard focus leaves the widget’s window.
Virtualvfunc_Invokes callback on each direct child of container, including
children that are considered “internal” (implementation details
of the container). “Internal” children generally weren’t added
by the user of the container, but were added by the container
implementation itself.
Most applications should use gtk_container_foreach(), rather
than gtk_container_forall().
Virtualvfunc_Returns the accessible object that describes the widget to an assistive technology.
If accessibility support is not available, this Atk.Object instance may be a no-op. Likewise, if no class-specific Atk.Object implementation is available for the widget instance in question, it will inherit an Atk.Object implementation from the first ancestor class for which such an implementation is defined.
The documentation of the ATK library contains more information about accessible objects and their uses.
Virtualvfunc_Virtualvfunc_Virtualvfunc_Gets the name of the buildable object.
Gtk.Builder sets the name based on the
[GtkBuilder UI definition][BUILDER-UI]
used to construct the buildable.
Virtualvfunc_Returns a newly created widget path representing all the widget hierarchy
from the toplevel down to and including child.
Virtualvfunc_Retrieves a widget’s initial minimum and natural height.
This call is specific to width-for-height requests.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
Virtualvfunc_Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given
the specified width, or the default height if width is -1. The baselines may be -1 which means
that no baseline is requested for this widget.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods
and by any GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
the width which is available for allocation, or -1 if none
Virtualvfunc_Retrieves a widget’s minimum and natural height if it would be given
the specified width.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
the width which is available for allocation
Virtualvfunc_Retrieves a widget’s initial minimum and natural width.
This call is specific to height-for-width requests.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
Virtualvfunc_Retrieves a widget’s minimum and natural width if it would be given
the specified height.
The returned request will be modified by the
GtkWidgetClass::adjust_size_request virtual method and by any
GtkSizeGroups that have been applied. That is, the returned request
is the one that should be used for layout, not necessarily the one
returned by the widget itself.
the height which is available for allocation
Virtualvfunc_Gets whether the widget prefers a height-for-width layout or a width-for-height layout.
Gtk.Bin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.
Virtualvfunc_Signal emitted when a pointer or keyboard grab on a window belonging to widget gets broken.
Virtualvfunc_Causes widget to have the keyboard focus for the Gtk.Window it's
inside. widget must be a focusable widget, such as a Gtk.Entry;
something like Gtk.Frame won’t work.
More precisely, it must have the GTK_CAN_FOCUS flag set. Use
gtk_widget_set_can_focus() to modify that flag.
The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.
Virtualvfunc_Signal emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.
Virtualvfunc_Reverses the effects of gtk_widget_show(), causing the widget to be
hidden (invisible to the user).
Virtualvfunc_Virtualvfunc_Virtualvfunc_Virtualvfunc_This function should be called whenever keyboard navigation within
a single widget hits a boundary. The function emits the
Gtk.Widget.SignalSignatures.keynav_failed | Gtk.Widget::keynav-failed signal on the widget and its return
value should be interpreted in a way similar to the return value of
gtk_widget_child_focus():
When true is returned, stay in the widget, the failed keyboard
navigation is OK and/or there is nowhere we can/should move the
focus to.
When false is returned, the caller should continue with keyboard
navigation outside the widget, e.g. by calling
gtk_widget_child_focus() on the widget’s toplevel.
The default ::keynav-failed handler returns false for
Gtk.DirectionType.TAB_FORWARD and Gtk.DirectionType.TAB_BACKWARD. For the other
values of Gtk.DirectionType it returns true.
Whenever the default handler returns true, it also calls
gtk_widget_error_bell() to notify the user of the failed keyboard
navigation.
A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of Gtk.Entry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.
direction of focus movement
Virtualvfunc_Will be emitted when the pointer leaves the widget’s window.
Virtualvfunc_This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.
Virtualvfunc_Virtualvfunc_Emits the Gtk.Widget.SignalSignatures.mnemonic_activate | Gtk.Widget::mnemonic-activate signal.
true if there are other widgets with the same mnemonic
Virtualvfunc_Signal emitted when the pointer moves over the widget’s Gdk.Window.
Virtualvfunc_Signal emitted when a change of focus is requested
Virtualvfunc_Virtualvfunc_Virtualvfunc_Signal emitted whenever a widget should pop up a context menu.
Virtualvfunc_Signal will be emitted when a property on the widget’s window has been changed or deleted.
Virtualvfunc_Virtualvfunc_Virtualvfunc_Virtualvfunc_Invalidates the area of widget defined by region by calling
gdk_window_invalidate_region() on the widget’s window and all its
child windows. Once the main loop becomes idle (after the current
batch of events has been processed, roughly), the window will
receive expose events for the union of all regions that have been
invalidated.
Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a Gtk.DrawingArea or some portion thereof.
Virtualvfunc_Creates the GDK (windowing system) resources associated with a
widget. For example, widget->window will be created when a widget
is realized. Normally realization happens implicitly; if you show
a widget and all its parent containers, then the widget will be
realized and mapped automatically.
Realizing a widget requires all
the widget’s parent widgets to be realized; calling
gtk_widget_realize() realizes the widget’s parents in addition to
widget itself. If a widget is not yet inside a toplevel window
when you realize it, bad things will happen.
This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as Gtk.Widget::draw. Or simply g_signal_connect () to the Gtk.Widget::realize signal.
Virtualvfunc_Removes widget from container. widget must be inside container.
Note that container will own a reference to widget, and that this
may be the last reference held; so removing a widget from its
container can destroy that widget. If you want to use widget
again, you need to add a reference to it before removing it from
a container, using g_object_ref(). If you don’t want to use widget
again it’s usually more efficient to simply destroy it directly
using gtk_widget_destroy() since this will remove it from the
container and help break any circular reference count cycles.
Virtualvfunc_Virtualvfunc_Signal emitted when a button in the 4 to 7 range is pressed.
Virtualvfunc_Signal will be emitted when the the widget’s window has lost ownership of a selection.
Virtualvfunc_Virtualvfunc_Virtualvfunc_Virtualvfunc_Signal will be emitted when another client requests ownership of the selection owned by the widget's window.
Virtualvfunc_Virtualvfunc_Virtualvfunc_Sets, or unsets if child is null, the focused child of container.
This function emits the GtkContainer::set_focus_child signal of
container. Implementations of Gtk.Container can override the
default behaviour by overriding the class closure of this signal.
This is function is mostly meant to be used by widgets. Applications can use
gtk_widget_grab_focus() to manually set the focus to a specific widget.
Optionalchild: Gtk.Widgeta Gtk.Widget, or null
Virtualvfunc_Sets the name of the buildable object.
name to set
Virtualvfunc_Flags a widget to be displayed. Any widget that isn’t shown will
not appear on the screen. If you want to show all the widgets in a
container, it’s easier to call gtk_widget_show_all() on the
container, instead of individually showing the widgets.
Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.
When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.
Virtualvfunc_Recursively shows a widget, and any child widgets (if the widget is a container).
Virtualvfunc_Virtualvfunc_This function is only used by Gtk.Container subclasses, to assign a size and position to their child widgets.
In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s Gtk.Widget.halign and Gtk.Widget.valign properties.
For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline()
instead.
Virtualvfunc_Virtualvfunc_Signal emitted when the widget state changes,
see gtk_widget_get_state_flags().
Virtualvfunc_Virtualvfunc_Signal emitted when the GtkStyleContext of a widget is changed.
Virtualvfunc_Virtualvfunc_This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped.
Virtualvfunc_Signal will be emitted when the widget’s window is unmapped.
Virtualvfunc_This function is only useful in widget implementations.
Causes a widget to be unrealized (frees all GDK resources
associated with the widget, such as widget->window).
Virtualvfunc_Signal emitted when the widget’s window is obscured or unobscured.
Virtualvfunc_Signal emitted when the state of the toplevel window associated to the widget changes.
Static_Staticbind_Staticbind_The “id” of the child defined in the template XML
Whether the child should be accessible as an “internal-child” when this class is used in GtkBuilder XML
The structure offset into the composite widget’s instance public or private structure where the automated child pointer should be set, or 0 to not assign the pointer.
Staticcompat_Optionaldata: anyStaticfind_Staticfind_Staticfind_Staticget_Staticget_Obtains the current default reading direction. See
gtk_widget_set_default_direction().
Staticget_Statichandle_Staticinstall_the GObject.ParamSpec array defining the new child properties
Staticinstall_the id for the property
the GObject.ParamSpec for the property
Staticinstall_Staticinstall_the id for the new property
the GObject.ParamSpec for the new property
Staticinstall_the GObject.ParamSpec for the property
Staticinterface_Find the GObject.ParamSpec with the given name for an
interface. Generally, the interface vtable passed in as g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
name of a property to look up.
Staticinterface_Add a property to an interface; this is only useful for interfaces
that are added to GObject-derived types. Adding a property to an
interface forces all objects classes with that interface to have a
compatible property. The compatible property could be a newly
created GObject.ParamSpec, but normally
g_object_class_override_property() will be used so that the object
class only needs to provide an implementation and inherits the
property description, default value, bounds, and so forth from the
interface property.
This function is meant to be called from the interface's default
vtable initialization function (the class_init member of
GObject.TypeInfo.) It must not be called after after class_init has
been called for any object types implementing this interface.
If pspec is a floating reference, it will be consumed.
any interface vtable for the interface, or the default vtable for the interface.
the GObject.ParamSpec for the new property
Staticinterface_Lists the properties of an interface.Generally, the interface
vtable passed in as g_iface will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
Staticlist_Staticlist_Staticlist_StaticnewvStaticoverride_the new property ID
the name of a property registered in a parent class or in an interface of this class.
Staticpop_Cancels the effect of a previous call to gtk_widget_push_composite_child().
Staticpush_Makes all newly-created widgets as composite children until
the corresponding gtk_widget_pop_composite_child() call.
A composite child is a child that’s an implementation detail of the
container it’s inside and should not be visible to people using the
container. Composite children aren’t treated differently by GTK+ (but
see gtk_container_foreach() vs. gtk_container_forall()), but e.g. GUI
builders might want to treat them in a different way.
Staticset_Staticset_The object type that implements the accessible for widget_class
Staticset_The Gtk.BuilderConnectFunc to use when connecting signals in the class template
Staticset_name to use
Staticset_Sets the default reading direction for widgets where the
direction has not been explicitly set by gtk_widget_set_direction().
the new default direction. This cannot be Gtk.TextDirection.NONE.
Staticset_A GLib.Bytes holding the Gtk.Builder XML
Staticset_The name of the resource to load the template from
Gtk.FileChooserWidget is a widget for choosing files. It exposes the Gtk.FileChooser interface, and you should use the methods of this interface to interact with the widget.
CSS nodes
GtkFileChooserWidget has a single CSS node with name filechooser.