pub trait WidgetExt:
IsA<Widget>
+ Sealed
+ 'static {
Show 207 methods
// Provided methods
fn action_set_enabled(&self, action_name: &str, enabled: bool) { ... }
fn activate(&self) -> bool { ... }
fn activate_action(
&self,
name: &str,
args: Option<&Variant>,
) -> Result<(), BoolError> { ... }
fn activate_default(&self) { ... }
fn add_controller(&self, controller: impl IsA<EventController>) { ... }
fn add_css_class(&self, css_class: &str) { ... }
fn add_mnemonic_label(&self, label: &impl IsA<Widget>) { ... }
fn allocate(
&self,
width: i32,
height: i32,
baseline: i32,
transform: Option<Transform>,
) { ... }
fn child_focus(&self, direction: DirectionType) -> bool { ... }
fn compute_bounds(&self, target: &impl IsA<Widget>) -> Option<Rect> { ... }
fn compute_expand(&self, orientation: Orientation) -> bool { ... }
fn compute_point(
&self,
target: &impl IsA<Widget>,
point: &Point,
) -> Option<Point> { ... }
fn compute_transform(&self, target: &impl IsA<Widget>) -> Option<Matrix> { ... }
fn contains(&self, x: f64, y: f64) -> bool { ... }
fn create_pango_context(&self) -> Context { ... }
fn create_pango_layout(&self, text: Option<&str>) -> Layout { ... }
fn drag_check_threshold(
&self,
start_x: i32,
start_y: i32,
current_x: i32,
current_y: i32,
) -> bool { ... }
fn error_bell(&self) { ... }
fn allocated_baseline(&self) -> i32 { ... }
fn allocated_height(&self) -> i32 { ... }
fn allocated_width(&self) -> i32 { ... }
fn allocation(&self) -> Allocation { ... }
fn ancestor(&self, widget_type: Type) -> Option<Widget> { ... }
fn baseline(&self) -> i32 { ... }
fn can_focus(&self) -> bool { ... }
fn can_target(&self) -> bool { ... }
fn is_child_visible(&self) -> bool { ... }
fn clipboard(&self) -> Clipboard { ... }
fn color(&self) -> RGBA { ... }
fn css_classes(&self) -> Vec<GString> { ... }
fn css_name(&self) -> GString { ... }
fn cursor(&self) -> Option<Cursor> { ... }
fn direction(&self) -> TextDirection { ... }
fn display(&self) -> Display { ... }
fn first_child(&self) -> Option<Widget> { ... }
fn focus_child(&self) -> Option<Widget> { ... }
fn gets_focus_on_click(&self) -> bool { ... }
fn is_focusable(&self) -> bool { ... }
fn font_map(&self) -> Option<FontMap> { ... }
fn font_options(&self) -> Option<FontOptions> { ... }
fn frame_clock(&self) -> Option<FrameClock> { ... }
fn halign(&self) -> Align { ... }
fn has_tooltip(&self) -> bool { ... }
fn height(&self) -> i32 { ... }
fn hexpands(&self) -> bool { ... }
fn is_hexpand_set(&self) -> bool { ... }
fn last_child(&self) -> Option<Widget> { ... }
fn layout_manager(&self) -> Option<LayoutManager> { ... }
fn is_mapped(&self) -> bool { ... }
fn margin_bottom(&self) -> i32 { ... }
fn margin_end(&self) -> i32 { ... }
fn margin_start(&self) -> i32 { ... }
fn margin_top(&self) -> i32 { ... }
fn widget_name(&self) -> GString { ... }
fn native(&self) -> Option<Native> { ... }
fn next_sibling(&self) -> Option<Widget> { ... }
fn opacity(&self) -> f64 { ... }
fn overflow(&self) -> Overflow { ... }
fn pango_context(&self) -> Context { ... }
fn parent(&self) -> Option<Widget> { ... }
fn preferred_size(&self) -> (Requisition, Requisition) { ... }
fn prev_sibling(&self) -> Option<Widget> { ... }
fn primary_clipboard(&self) -> Clipboard { ... }
fn is_realized(&self) -> bool { ... }
fn receives_default(&self) -> bool { ... }
fn request_mode(&self) -> SizeRequestMode { ... }
fn root(&self) -> Option<Root> { ... }
fn scale_factor(&self) -> i32 { ... }
fn get_sensitive(&self) -> bool { ... }
fn settings(&self) -> Settings { ... }
fn size(&self, orientation: Orientation) -> i32 { ... }
fn size_request(&self) -> (i32, i32) { ... }
fn state_flags(&self) -> StateFlags { ... }
fn style_context(&self) -> StyleContext { ... }
fn tooltip_markup(&self) -> Option<GString> { ... }
fn tooltip_text(&self) -> Option<GString> { ... }
fn valign(&self) -> Align { ... }
fn vexpands(&self) -> bool { ... }
fn is_vexpand_set(&self) -> bool { ... }
fn get_visible(&self) -> bool { ... }
fn width(&self) -> i32 { ... }
fn grab_focus(&self) -> bool { ... }
fn has_css_class(&self, css_class: &str) -> bool { ... }
fn has_default(&self) -> bool { ... }
fn has_focus(&self) -> bool { ... }
fn has_visible_focus(&self) -> bool { ... }
fn hide(&self) { ... }
fn in_destruction(&self) -> bool { ... }
fn insert_action_group(
&self,
name: &str,
group: Option<&impl IsA<ActionGroup>>,
) { ... }
fn insert_after(
&self,
parent: &impl IsA<Widget>,
previous_sibling: Option<&impl IsA<Widget>>,
) { ... }
fn insert_before(
&self,
parent: &impl IsA<Widget>,
next_sibling: Option<&impl IsA<Widget>>,
) { ... }
fn is_ancestor(&self, ancestor: &impl IsA<Widget>) -> bool { ... }
fn is_drawable(&self) -> bool { ... }
fn is_focus(&self) -> bool { ... }
fn is_sensitive(&self) -> bool { ... }
fn is_visible(&self) -> bool { ... }
fn keynav_failed(&self, direction: DirectionType) -> bool { ... }
fn list_mnemonic_labels(&self) -> Vec<Widget> { ... }
fn map(&self) { ... }
fn measure(
&self,
orientation: Orientation,
for_size: i32,
) -> (i32, i32, i32, i32) { ... }
fn mnemonic_activate(&self, group_cycling: bool) -> bool { ... }
fn observe_children(&self) -> ListModel { ... }
fn observe_controllers(&self) -> ListModel { ... }
fn pick(&self, x: f64, y: f64, flags: PickFlags) -> Option<Widget> { ... }
fn queue_allocate(&self) { ... }
fn queue_draw(&self) { ... }
fn queue_resize(&self) { ... }
fn realize(&self) { ... }
fn remove_controller(&self, controller: &impl IsA<EventController>) { ... }
fn remove_css_class(&self, css_class: &str) { ... }
fn remove_mnemonic_label(&self, label: &impl IsA<Widget>) { ... }
fn set_can_focus(&self, can_focus: bool) { ... }
fn set_can_target(&self, can_target: bool) { ... }
fn set_child_visible(&self, child_visible: bool) { ... }
fn set_css_classes(&self, classes: &[&str]) { ... }
fn set_cursor(&self, cursor: Option<&Cursor>) { ... }
fn set_cursor_from_name(&self, name: Option<&str>) { ... }
fn set_direction(&self, dir: TextDirection) { ... }
fn set_focus_child(&self, child: Option<&impl IsA<Widget>>) { ... }
fn set_focus_on_click(&self, focus_on_click: bool) { ... }
fn set_focusable(&self, focusable: bool) { ... }
fn set_font_map(&self, font_map: Option<&impl IsA<FontMap>>) { ... }
fn set_font_options(&self, options: Option<&FontOptions>) { ... }
fn set_halign(&self, align: Align) { ... }
fn set_has_tooltip(&self, has_tooltip: bool) { ... }
fn set_hexpand(&self, expand: bool) { ... }
fn set_hexpand_set(&self, set: bool) { ... }
fn set_layout_manager(
&self,
layout_manager: Option<impl IsA<LayoutManager>>,
) { ... }
fn set_margin_bottom(&self, margin: i32) { ... }
fn set_margin_end(&self, margin: i32) { ... }
fn set_margin_start(&self, margin: i32) { ... }
fn set_margin_top(&self, margin: i32) { ... }
fn set_widget_name(&self, name: &str) { ... }
fn set_opacity(&self, opacity: f64) { ... }
fn set_overflow(&self, overflow: Overflow) { ... }
fn set_parent(&self, parent: &impl IsA<Widget>) { ... }
fn set_receives_default(&self, receives_default: bool) { ... }
fn set_sensitive(&self, sensitive: bool) { ... }
fn set_size_request(&self, width: i32, height: i32) { ... }
fn set_state_flags(&self, flags: StateFlags, clear: bool) { ... }
fn set_tooltip_markup(&self, markup: Option<&str>) { ... }
fn set_tooltip_text(&self, text: Option<&str>) { ... }
fn set_valign(&self, align: Align) { ... }
fn set_vexpand(&self, expand: bool) { ... }
fn set_vexpand_set(&self, set: bool) { ... }
fn set_visible(&self, visible: bool) { ... }
fn should_layout(&self) -> bool { ... }
fn show(&self) { ... }
fn size_allocate(&self, allocation: &Allocation, baseline: i32) { ... }
fn snapshot_child(
&self,
child: &impl IsA<Widget>,
snapshot: &impl IsA<Snapshot>,
) { ... }
fn translate_coordinates(
&self,
dest_widget: &impl IsA<Widget>,
src_x: f64,
src_y: f64,
) -> Option<(f64, f64)> { ... }
fn trigger_tooltip_query(&self) { ... }
fn unmap(&self) { ... }
fn unparent(&self) { ... }
fn unrealize(&self) { ... }
fn unset_state_flags(&self, flags: StateFlags) { ... }
fn height_request(&self) -> i32 { ... }
fn set_height_request(&self, height_request: i32) { ... }
fn width_request(&self) -> i32 { ... }
fn set_width_request(&self, width_request: i32) { ... }
fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_keynav_failed<F: Fn(&Self, DirectionType) -> Propagation + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_mnemonic_activate<F: Fn(&Self, bool) -> Propagation + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn emit_move_focus(&self, direction: DirectionType) { ... }
fn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_can_focus_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_can_target_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_css_classes_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_cursor_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_focus_on_click_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_focusable_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_halign_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_has_default_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_has_focus_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_has_tooltip_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_height_request_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_hexpand_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_hexpand_set_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_layout_manager_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_margin_bottom_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_margin_end_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_margin_start_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_margin_top_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_opacity_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_overflow_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_parent_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_receives_default_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_root_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_sensitive_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_tooltip_markup_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_tooltip_text_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_valign_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_vexpand_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_vexpand_set_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_visible_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_width_request_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Trait containing all Widget
methods.
§Implementors
ActionBar
, Actionable
, AppChooserButton
, AppChooserWidget
, AppChooser
, AspectFrame
, Box
, Button
, Calendar
, CellEditable
, CellView
, CenterBox
, CheckButton
, ColorButton
, ColorChooserWidget
, ColorDialogButton
, ColumnView
, ComboBox
, DragIcon
, DrawingArea
, DropDown
, EditableLabel
, Editable
, Entry
, Expander
, FileChooserWidget
, Fixed
, FlowBoxChild
, FlowBox
, FontButton
, FontChooserWidget
, FontDialogButton
, Frame
, GLArea
, GraphicsOffload
, Grid
, HeaderBar
, IconView
, Image
, InfoBar
, Inscription
, Label
, LevelBar
, ListBase
, ListBoxRow
, ListBox
, MediaControls
, MenuButton
, Native
, Notebook
, Overlay
, Paned
, PasswordEntry
, Picture
, PopoverMenuBar
, Popover
, ProgressBar
, Range
, Revealer
, Root
, ScaleButton
, Scrollbar
, ScrolledWindow
, SearchBar
, SearchEntry
, Separator
, ShortcutLabel
, ShortcutsShortcut
, SpinButton
, Spinner
, StackSidebar
, StackSwitcher
, Stack
, Statusbar
, Switch
, TextView
, Text
, TreeExpander
, TreeView
, Video
, Viewport
, Widget
, WindowControls
, WindowHandle
, Window
Provided Methods§
Sourcefn action_set_enabled(&self, action_name: &str, enabled: bool)
fn action_set_enabled(&self, action_name: &str, enabled: bool)
Enables or disables an action installed with
WidgetClassExt::install_action()
.
§action_name
action name, such as “clipboard.paste”
§enabled
whether the action is now enabled
Sourcefn activate(&self) -> bool
fn activate(&self) -> bool
Activates the widget.
The activation will emit the signal set using
WidgetClassExt::set_activate_signal()
during class initialization.
Activation is what happens when you press Enter on a widget.
If you wish to handle the activation keybinding yourself,
it is recommended to use WidgetClassExt::add_shortcut()
with an action created with SignalAction::new()
.
If @self is not activatable, the function returns false.
§Returns
true if the widget was activated
Sourcefn activate_action(
&self,
name: &str,
args: Option<&Variant>,
) -> Result<(), BoolError>
fn activate_action( &self, name: &str, args: Option<&Variant>, ) -> Result<(), BoolError>
Activates an action for the widget.
The action is looked up in the action groups associated with @self and its ancestors.
If the action is in an action group added with
insert_action_group()
, the @name is expected
to be prefixed with the prefix that was used when the group was
inserted.
The arguments must match the actions expected parameter type,
as returned by [ActionExtManual::parameter_type()
][crate::gio::prelude::ActionExtManual::parameter_type()].
§name
the name of the action to activate
§args
parameters to use
§Returns
true if the action was activated
Sourcefn activate_default(&self)
fn activate_default(&self)
Activates the default.activate
action for the widget.
The action is looked up in the same was as for
Gtk::Widget::activate_action()
.
Sourcefn add_controller(&self, controller: impl IsA<EventController>)
fn add_controller(&self, controller: impl IsA<EventController>)
Adds an event controller to the widget.
The event controllers of a widget handle the events that are propagated to the widget.
You will usually want to call this function right after
creating any kind of EventController
.
§controller
an event controller that hasn’t been added to a widget yet
Sourcefn add_css_class(&self, css_class: &str)
fn add_css_class(&self, css_class: &str)
Adds a style class to the widget.
After calling this function, the widget’s style will match for @css_class, according to CSS matching rules.
Use remove_css_class()
to remove the
style again.
§css_class
style class to add to @self, without the leading period
Sourcefn add_mnemonic_label(&self, label: &impl IsA<Widget>)
fn add_mnemonic_label(&self, label: &impl IsA<Widget>)
Adds a widget to the list of mnemonic labels for this widget.
Note that 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.
§label
a widget that acts as a mnemonic label for @self
Sourcefn allocate(
&self,
width: i32,
height: i32,
baseline: i32,
transform: Option<Transform>,
)
fn allocate( &self, width: i32, height: i32, baseline: i32, transform: Option<Transform>, )
Assigns size, position, (optionally) a baseline and transform to a child widget.
In this function, the allocation and baseline may be adjusted. The given allocation will be forced to be bigger than the widget’s minimum size, as well as at least 0×0 in size.
This function is only used by widget implementations.
For a version that does not take a transform, see
size_allocate()
.
§width
new width
§height
new height
§baseline
new baseline, or -1
§transform
transformation to be applied
Sourcefn child_focus(&self, direction: DirectionType) -> bool
fn child_focus(&self, direction: DirectionType) -> bool
Called by widgets as the user moves around the window using keyboard shortcuts.
The @direction argument indicates what kind of motion is taking place (up, down, left, right, tab forward, tab backward).
This function calls the WidgetImpl::focus()
virtual function;
widgets can override the virtual function in order to implement
appropriate focus behavior.
The default focus()
virtual function 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. When returning true, widgets normally call
grab_focus()
to place the focus accordingly;
when returning false, they don’t modify the current focus location.
This function is used by custom widget implementations; if you’re
writing an app, you’d use grab_focus()
to move
the focus to a particular widget.
§direction
direction of focus movement
§Returns
true if focus ended up inside @self
Sourcefn compute_bounds(&self, target: &impl IsA<Widget>) -> Option<Rect>
fn compute_bounds(&self, target: &impl IsA<Widget>) -> Option<Rect>
Computes the bounds for @self in the coordinate space of @target.
The bounds of widget are (the bounding box of) the region that it is expected to draw in. See the coordinate system overview to learn more.
If the operation is successful, true is returned. If @self has no bounds or the bounds cannot be expressed in @target’s coordinate space (for example if both widgets are in different windows), false is returned and @bounds is set to the zero rectangle.
It is valid for @self and @target to be the same widget.
§target
the target widget
§Returns
true if the bounds could be computed
§out_bounds
the rectangle taking the bounds
Sourcefn compute_expand(&self, orientation: Orientation) -> bool
fn compute_expand(&self, orientation: Orientation) -> bool
Computes whether a parent widget should give this widget extra space when possible.
Widgets with children should check this, rather than looking at
hexpands()
or vexpands()
.
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.
§orientation
expand direction
§Returns
whether widget tree rooted here should be expanded
Sourcefn compute_point(
&self,
target: &impl IsA<Widget>,
point: &Point,
) -> Option<Point>
fn compute_point( &self, target: &impl IsA<Widget>, point: &Point, ) -> Option<Point>
Translates the given @point in @self’s coordinates to coordinates in @target’s coordinate system.
In order to perform this operation, both widgets must share a a common ancestor. If that is not the case, @out_point is set to (0, 0) and false is returned.
§target
the widget to transform into
§point
a point in @self’s coordinate system
§Returns
true if @src_widget and @dest_widget have a common ancestor, false otherwise
§out_point
set to the corresponding coordinates in @target’s coordinate system
Sourcefn compute_transform(&self, target: &impl IsA<Widget>) -> Option<Matrix>
fn compute_transform(&self, target: &impl IsA<Widget>) -> Option<Matrix>
Computes a matrix suitable to describe a transformation from @self’s coordinate system into @target’s coordinate system.
The transform can not be computed in certain cases, for example when @self and @target do not share a common ancestor. In that case @out_transform gets set to the identity matrix.
To learn more about widget coordinate systems, see the coordinate system overview.
§target
the target widget that the matrix will transform to
§Returns
true if the transform could be computed
§out_transform
location to store the final transformation
Sourcefn contains(&self, x: f64, y: f64) -> bool
fn contains(&self, x: f64, y: f64) -> bool
Tests if a given point is contained in the widget.
The coordinates for (x, y) must be in widget coordinates, so (0, 0) is assumed to be the top left of @self’s content area.
§x
X coordinate to test, relative to @self’s origin
§y
Y coordinate to test, relative to @self’s origin
§Returns
true if @self contains the point (x, y)
Sourcefn create_pango_context(&self) -> Context
fn create_pango_context(&self) -> Context
Creates a new pango::Context
that is configured for the widget.
The pango::Context
will have the appropriate font map,
font options, font description, and base direction set.
See also pango_context()
.
§Returns
the new pango::Context
Sourcefn create_pango_layout(&self, text: Option<&str>) -> Layout
fn create_pango_layout(&self, text: Option<&str>) -> Layout
Creates a new pango::Layout
that is configured for the widget.
The pango::Layout
will have the appropriate font map,
font description, and base direction set.
If you keep a pango::Layout
created in this way around,
you need to re-create it when the widgets pango::Context
is replaced. This can be tracked by listening to changes
of the root
property on the widget.
§text
text to set on the layout
§Returns
the new pango::Layout
Sourcefn drag_check_threshold(
&self,
start_x: i32,
start_y: i32,
current_x: i32,
current_y: i32,
) -> bool
fn drag_check_threshold( &self, start_x: i32, start_y: i32, current_x: i32, current_y: i32, ) -> bool
Sourcefn error_bell(&self)
fn error_bell(&self)
Notifies the user about an input-related error on the widget.
If the gtk-error-bell
setting is true,
it calls Gdk::Surface::beep()
, otherwise it does nothing.
Note that the effect of Gdk::Surface::beep()
can be configured
in many ways, depending on the windowing backend and the desktop
environment or window manager that is used.
Sourcefn allocated_baseline(&self) -> i32
👎Deprecated: Since 4.12
fn allocated_baseline(&self) -> i32
Returns the baseline that has currently been allocated to the widget.
This function is intended to be used when implementing handlers
for the Widget
Class.snapshot() function, and when allocating
child widgets in Widget
Class.size_allocate().
§Deprecated since 4.12
Use baseline()
instead
§Returns
the baseline of the @self, or -1 if none
Sourcefn allocated_height(&self) -> i32
👎Deprecated: Since 4.12
fn allocated_height(&self) -> i32
Sourcefn allocated_width(&self) -> i32
👎Deprecated: Since 4.12
fn allocated_width(&self) -> i32
Sourcefn allocation(&self) -> Allocation
👎Deprecated: Since 4.12
fn allocation(&self) -> Allocation
Retrieves the widget’s allocation.
Note, when implementing a layout widget: a widget’s allocation
will be its “adjusted” allocation, that is, the widget’s parent
typically calls size_allocate()
with an allocation,
and that allocation is then adjusted (to handle margin
and alignment for example) before assignment to the widget.
allocation()
returns the adjusted allocation that
was actually assigned to the widget. The adjusted allocation is
guaranteed to be completely contained within the
size_allocate()
allocation, however.
So a layout widget is guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the widget assigned.
§Deprecated since 4.12
Use compute_bounds()
,
width()
or height()
instead.
§Returns
§allocation
a pointer to a GtkAllocation
to copy to
Sourcefn ancestor(&self, widget_type: Type) -> Option<Widget>
fn ancestor(&self, widget_type: Type) -> Option<Widget>
Gets the first ancestor of the widget with type @widget_type.
For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)
gets the first Box
that’s an ancestor of @self. No
reference will be added to the returned widget; it should
not be unreferenced.
Note that unlike is_ancestor()
, this function
considers @self to be an ancestor of itself.
§widget_type
ancestor type
§Returns
the ancestor widget
Sourcefn baseline(&self) -> i32
Available on crate feature v4_12
only.
fn baseline(&self) -> i32
v4_12
only.Returns the baseline that has currently been allocated to the widget.
This function is intended to be used when implementing handlers
for the GtkWidgetClass.snapshot()
function, and when allocating
child widgets in GtkWidgetClass.size_allocate()
.
§Returns
the baseline of the @self, or -1 if none
Sourcefn can_focus(&self) -> bool
fn can_focus(&self) -> bool
Determines whether the input focus can enter the widget or any of its children.
See set_can_focus()
.
§Returns
true if the input focus can enter @self
Sourcefn can_target(&self) -> bool
fn can_target(&self) -> bool
Queries whether the widget can be the target of pointer events.
§Returns
true if @self can receive pointer events
Sourcefn is_child_visible(&self) -> bool
fn is_child_visible(&self) -> bool
Gets the value set with set_child_visible()
.
If you feel a need to use this function, your code probably needs reorganization.
This function is only useful for widget implementations and should never be called by an application.
§Returns
true if the widget is mapped with the parent
Sourcefn clipboard(&self) -> Clipboard
fn clipboard(&self) -> Clipboard
Gets the clipboard object for the widget.
This is a utility function to get the clipboard object for the display that @self is using.
Note that this function always works, even when @self is not realized yet.
§Returns
the appropriate clipboard object
Sourcefn css_classes(&self) -> Vec<GString>
fn css_classes(&self) -> Vec<GString>
Returns the list of style classes applied to the widget.
§Returns
a NULL
-terminated list of
css classes currently applied to @self
Sourcefn cursor(&self) -> Option<Cursor>
fn cursor(&self) -> Option<Cursor>
Gets the cursor set on the widget.
See set_cursor()
for details.
§Returns
the cursor that is set on @self
Sourcefn direction(&self) -> TextDirection
fn direction(&self) -> TextDirection
Gets the reading direction for the widget.
See set_direction()
.
§Returns
the reading direction for the widget
Sourcefn display(&self) -> Display
fn display(&self) -> Display
Get the display for the window that the widget belongs to.
This function can only be called after the widget has been
added to a widget hierarchy with a Root
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.
§Returns
the display for this widget
Sourcefn first_child(&self) -> Option<Widget>
fn first_child(&self) -> Option<Widget>
Returns the widget’s first child.
This function is primarily meant for widget implementations.
§Returns
the widget’s first child
Sourcefn focus_child(&self) -> Option<Widget>
fn focus_child(&self) -> Option<Widget>
Sourcefn gets_focus_on_click(&self) -> bool
fn gets_focus_on_click(&self) -> bool
Returns whether the widget should grab focus when it is clicked with the mouse.
See set_focus_on_click()
.
§Returns
true if the widget should grab focus when it is clicked with the mouse
Sourcefn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Determines whether the widget can own the input focus.
See set_focusable()
.
§Returns
true if @self can own the input focus
Sourcefn font_options(&self) -> Option<FontOptions>
👎Deprecated: Since 4.16
fn font_options(&self) -> Option<FontOptions>
Returns the cairo::FontOptions
of the widget.
Seee set_font_options()
.
§Deprecated since 4.16
§Returns
the cairo::FontOptions
of widget
Sourcefn frame_clock(&self) -> Option<FrameClock>
fn frame_clock(&self) -> Option<FrameClock>
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 FrameClock::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
FrameClock::frame_time()
, and then update the animation
by calling FrameClock::frame_time()
again during each repaint.
FrameClock::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 queue_draw()
which invalidates the
widget (thus scheduling it to receive a draw on the next frame).
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.
§Returns
the frame clock
Sourcefn halign(&self) -> Align
fn halign(&self) -> Align
Gets the horizontal alignment of the widget.
For backwards compatibility reasons this method will never return one of the baseline alignments, but instead it will convert it to [enum@Gtk.Align.fill] or [enum@Gtk.Align.center].
Baselines are not supported for horizontal alignment.
§Returns
the horizontal alignment of @self
Sourcefn has_tooltip(&self) -> bool
fn has_tooltip(&self) -> bool
Returns the current value of the has-tooltip
property.
§Returns
current value of has-tooltip
on @self
Sourcefn height(&self) -> i32
fn height(&self) -> i32
Returns the content height of the widget.
This function returns the height passed to its
size-allocate implementation, which is the height you
should be using in WidgetImpl::snapshot()
.
For pointer events, see contains()
.
To learn more about widget sizes, see the coordinate system overview.
§Returns
The height of @self
Sourcefn hexpands(&self) -> bool
fn hexpands(&self) -> bool
Gets whether the widget would like any available extra horizontal space.
When a user resizes a window, widgets with expand set to true generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.
Widgets with children should use compute_expand()
rather than this function, to see whether 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.
§Returns
whether hexpand flag is set
Sourcefn is_hexpand_set(&self) -> bool
fn is_hexpand_set(&self) -> bool
Gets whether the hexpand
flag has been explicitly set.
If hexpand
property 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.
§Returns
whether hexpand has been explicitly set
Sourcefn last_child(&self) -> Option<Widget>
fn last_child(&self) -> Option<Widget>
Returns the widget’s last child.
This function is primarily meant for widget implementations.
§Returns
the widget’s last child
Sourcefn layout_manager(&self) -> Option<LayoutManager>
fn layout_manager(&self) -> Option<LayoutManager>
Retrieves the layout manager of the widget.
See set_layout_manager()
.
§Returns
the layout manager of @self
Sourcefn margin_bottom(&self) -> i32
fn margin_bottom(&self) -> i32
Sourcefn margin_end(&self) -> i32
fn margin_end(&self) -> i32
Sourcefn margin_start(&self) -> i32
fn margin_start(&self) -> i32
Sourcefn margin_top(&self) -> i32
fn margin_top(&self) -> i32
Sourcefn widget_name(&self) -> GString
fn widget_name(&self) -> GString
Retrieves the name of a widget.
See set_widget_name()
for the significance of widget names.
§Returns
name of the widget
Sourcefn next_sibling(&self) -> Option<Widget>
fn next_sibling(&self) -> Option<Widget>
Returns the widget’s next sibling.
This function is primarily meant for widget implementations.
§Returns
the widget’s next sibling
Sourcefn opacity(&self) -> f64
fn opacity(&self) -> f64
Fetches the requested opacity for the widget.
See set_opacity()
.
§Returns
the requested opacity for this widget
Sourcefn pango_context(&self) -> Context
fn pango_context(&self) -> Context
Gets a pango::Context
that is configured for the widget.
The pango::Context
will have the appropriate font map, font description,
and base direction set.
Unlike the context returned by 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 listening to changes of the
root
property on the widget.
§Returns
the pango::Context
for the widget
Sourcefn preferred_size(&self) -> (Requisition, Requisition)
fn preferred_size(&self) -> (Requisition, Requisition)
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 Fixed
.
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 measure()
if you want to support baseline alignment.
§Returns
§minimum_size
location for storing the minimum size
§natural_size
location for storing the natural size
Sourcefn prev_sibling(&self) -> Option<Widget>
fn prev_sibling(&self) -> Option<Widget>
Returns the widget’s previous sibling.
This function is primarily meant for widget implementations.
§Returns
the widget’s previous sibling
Sourcefn primary_clipboard(&self) -> Clipboard
fn primary_clipboard(&self) -> Clipboard
Gets the primary clipboard of the widget.
This is a utility function to get the primary clipboard object for the display that @self is using.
Note that this function always works, even when @self is not realized yet.
§Returns
the appropriate clipboard object
Sourcefn is_realized(&self) -> bool
fn is_realized(&self) -> bool
Sourcefn receives_default(&self) -> bool
fn receives_default(&self) -> bool
Determines whether the widget is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default.
§Returns
true if @self acts as the default widget when focused
Sourcefn request_mode(&self) -> SizeRequestMode
fn request_mode(&self) -> SizeRequestMode
Gets whether the widget prefers a height-for-width layout or a width-for-height layout.
Single-child widgets generally propagate the preference of their child, more complex widgets need to request something either in context of their children or in context of their allocation capabilities.
§Returns
The SizeRequestMode
preferred by @self.
Sourcefn scale_factor(&self) -> i32
fn scale_factor(&self) -> i32
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::Surface::get_scale_factor()
.
Note that modern systems may support fractional scaling,
where the scale factor is not an integer. On such systems,
this function will return the next higher integer value,
but you probably want to use [SurfaceExtManual::scale()
][crate::gdk::prelude::SurfaceExtManual::scale()]
to get the fractional scale value.
§Returns
the scale factor for @self
Sourcefn get_sensitive(&self) -> bool
fn get_sensitive(&self) -> bool
Returns the widget’s sensitivity.
This function returns the value that has been set using
set_sensitive()
).
The effective sensitivity of a widget is however determined
by both its own and its parent widget’s sensitivity.
See is_sensitive()
.
§Returns
true if the widget is sensitive
Sourcefn settings(&self) -> Settings
fn settings(&self) -> Settings
Gets the settings object holding the settings used for the widget.
Note that this function can only be called when the Widget
is attached to a toplevel, since the settings object is specific
to a particular display. If you want to monitor the widget for
changes in its settings, connect to the notify::display
signal.
§Returns
the relevant settings object
Sourcefn size(&self, orientation: Orientation) -> i32
fn size(&self, orientation: Orientation) -> i32
Returns the content width or height of the widget.
Which dimension is returned depends on @orientation.
This is equivalent to calling width()
for [enum@Gtk.Orientation.horizontal] or height()
for [enum@Gtk.Orientation.vertical], but can be used when
writing orientation-independent code, such as when
implementing Orientable
widgets.
To learn more about widget sizes, see the coordinate system overview.
§orientation
the orientation to query
§Returns
the size of @self in @orientation
Sourcefn size_request(&self) -> (i32, i32)
fn size_request(&self) -> (i32, i32)
Gets the size request that was explicitly set for the widget.
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 set_size_request()
.
To get the size a widget will actually request, call
measure()
instead of this function.
§Returns
§width
return location for width
§height
return location for height
Sourcefn state_flags(&self) -> StateFlags
fn state_flags(&self) -> StateFlags
Returns the widget state as a flag set.
It is worth mentioning that the effective [flags@Gtk.StateFlags.insensitive] state will be returned, that is, also based on parent insensitivity, even if @self itself is sensitive.
Also note that if you are looking for a way to obtain the
StateFlags
to pass to a StyleContext
method, you should look at StyleContextExt::state()
.
§Returns
the state flags of widget
Sourcefn style_context(&self) -> StyleContext
👎Deprecated: Since 4.10
fn style_context(&self) -> StyleContext
Sourcefn tooltip_markup(&self) -> Option<GString>
fn tooltip_markup(&self) -> Option<GString>
Gets the contents of the tooltip for the widget.
If the tooltip has not been set using
set_tooltip_markup()
, this
function returns NULL
.
§Returns
the tooltip text
Sourcefn tooltip_text(&self) -> Option<GString>
fn tooltip_text(&self) -> Option<GString>
Gets the contents of the tooltip for the widget.
If the @self’s tooltip was set using
set_tooltip_markup()
,
this function will return the escaped text.
§Returns
the tooltip text
Sourcefn vexpands(&self) -> bool
fn vexpands(&self) -> bool
Gets whether the widget would like any available extra vertical space.
See hexpands()
for more detail.
§Returns
whether vexpand flag is set
Sourcefn is_vexpand_set(&self) -> bool
fn is_vexpand_set(&self) -> bool
Gets whether the vexpand
flag has been explicitly set.
See is_hexpand_set()
for more detail.
§Returns
whether vexpand has been explicitly set
Sourcefn get_visible(&self) -> bool
fn get_visible(&self) -> bool
Determines whether the widget is visible.
If you want to take into account whether the widget’s
parent is also marked as visible, use
is_visible()
instead.
This function does not check if the widget is obscured in any way.
See set_visible()
.
§Returns
true if the widget is visible
Sourcefn width(&self) -> i32
fn width(&self) -> i32
Returns the content width of the widget.
This function returns the width passed to its
size-allocate implementation, which is the width you
should be using in WidgetImpl::snapshot()
.
For pointer events, see contains()
.
To learn more about widget sizes, see the coordinate system overview.
§Returns
The width of @self
Sourcefn grab_focus(&self) -> bool
fn grab_focus(&self) -> bool
Causes @self to have the keyboard focus for the window that it belongs to.
If @self is not focusable, or its WidgetImpl::grab_focus()
implementation cannot transfer the focus to a descendant of @self
that is focusable, it will not take focus and false will be returned.
Calling grab_focus()
on an already focused widget
is allowed, should not have an effect, and return true.
§Returns
true if focus is now inside @self
Sourcefn has_css_class(&self, css_class: &str) -> bool
fn has_css_class(&self, css_class: &str) -> bool
Sourcefn has_default(&self) -> bool
fn has_default(&self) -> bool
Determines whether the widget is the current default widget within its toplevel.
§Returns
true if @self is the current default widget within its toplevel
Sourcefn has_focus(&self) -> bool
fn has_focus(&self) -> bool
Determines if the widget has the global input focus.
See is_focus()
for the difference between
having the global input focus, and only having the focus
within a toplevel.
§Returns
true if the widget has the global input focus
Sourcefn has_visible_focus(&self) -> bool
fn has_visible_focus(&self) -> bool
Determines if the widget should show a visible indication that it has the global input focus.
This is a convenience function that takes into account whether
focus indication should currently be shown in the toplevel window
of @self. See GtkWindowExt::gets_focus_visible()
for more
information about focus indication.
To find out if the widget has the global input focus, use
has_focus()
.
§Returns
true if the widget should display a “focus rectangle”
Sourcefn hide(&self)
👎Deprecated: Since 4.10
fn hide(&self)
Reverses the effects of [method.Gtk.Widget.show].
This is causing the widget to be hidden (invisible to the user).
§Deprecated since 4.10
Use set_visible()
instead
Sourcefn in_destruction(&self) -> bool
fn in_destruction(&self) -> bool
Returns whether the widget is currently being destroyed.
This information can sometimes be used to avoid doing unnecessary work.
§Returns
true if @self is being destroyed
Sourcefn insert_action_group(&self, name: &str, group: Option<&impl IsA<ActionGroup>>)
fn insert_action_group(&self, name: &str, group: Option<&impl IsA<ActionGroup>>)
Inserts an action group into the widget’s actions.
Children of @self that implement Actionable
can
then be associated with actions in @group by setting their
“action-name” to @prefix.action-name
.
Note that inheritance is defined for individual actions. I.e. even if you insert a group with prefix @prefix, actions with the same prefix will still be inherited from the parent, unless the group contains an action with the same name.
If @group is NULL
, a previously inserted group for @name is
removed from @self.
§name
the prefix for actions in @group
§group
an action group
Sourcefn insert_after(
&self,
parent: &impl IsA<Widget>,
previous_sibling: Option<&impl IsA<Widget>>,
)
fn insert_after( &self, parent: &impl IsA<Widget>, previous_sibling: Option<&impl IsA<Widget>>, )
Sets the parent widget of the widget.
In contrast to set_parent()
, this function
inserts @self at a specific position into the list of children
of the @parent widget.
It will be placed after @previous_sibling, or at the beginning if
@previous_sibling is NULL
.
After calling this function, gtk_widget_get_prev_sibling (widget)
will return @previous_sibling.
If @parent is already set as the parent widget of @self, this function can also be used to reorder @self in the child widget list of @parent.
This function is primarily meant for widget implementations; if you are just using a widget, you must use its own API for adding children.
§parent
the parent widget to insert @self into
§previous_sibling
the new previous sibling of @self
Sourcefn insert_before(
&self,
parent: &impl IsA<Widget>,
next_sibling: Option<&impl IsA<Widget>>,
)
fn insert_before( &self, parent: &impl IsA<Widget>, next_sibling: Option<&impl IsA<Widget>>, )
Sets the parent widget of the widget.
In contrast to set_parent()
, this function
inserts @self at a specific position into the list of children
of the @parent widget.
It will be placed before @next_sibling, or at the end if
@next_sibling is NULL
.
After calling this function, gtk_widget_get_next_sibling (widget)
will return @next_sibling.
If @parent is already set as the parent widget of @self, this function can also be used to reorder @self in the child widget list of @parent.
This function is primarily meant for widget implementations; if you are just using a widget, you must use its own API for adding children.
§parent
the parent widget to insert @self into
§next_sibling
the new next sibling of @self
Sourcefn is_ancestor(&self, ancestor: &impl IsA<Widget>) -> bool
fn is_ancestor(&self, ancestor: &impl IsA<Widget>) -> bool
Sourcefn is_drawable(&self) -> bool
fn is_drawable(&self) -> bool
Determines whether the widget can be drawn to.
A widget can be drawn if it is mapped and visible.
§Returns
true if @self is drawable
Sourcefn is_sensitive(&self) -> bool
fn is_sensitive(&self) -> bool
Returns the widget’s effective sensitivity.
This means it is sensitive itself and also its parent widget is sensitive.
§Returns
true if the widget is effectively sensitive
Sourcefn is_visible(&self) -> bool
fn is_visible(&self) -> bool
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 get_visible()
and
set_visible()
.
§Returns
true if the widget and all its parents are visible
Emits the keynav-failed
signal on the widget.
This function should be called whenever keyboard navigation within a single widget hits a boundary.
The return value of this function should be interpreted
in a way similar to the return value of
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
child_focus()
on the widget’s toplevel.
The default keynav-failed
handler returns
false for [enum@Gtk.DirectionType.tab-forward] and
[enum@Gtk.DirectionType.tab-backward]. For the other values
of DirectionType
it returns true.
Whenever the default handler returns true, it also calls
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
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
direction of focus movement
§Returns
true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
Sourcefn list_mnemonic_labels(&self) -> Vec<Widget>
fn list_mnemonic_labels(&self) -> Vec<Widget>
Returns the widgets for which this widget is the target of a mnemonic.
Typically, these widgets will be labels. See, for example,
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.
§Returns
the list of mnemonic labels
Sourcefn map(&self)
fn map(&self)
Causes a widget to be mapped if it isn’t already.
This function is only for use in widget implementations.
Sourcefn measure(
&self,
orientation: Orientation,
for_size: i32,
) -> (i32, i32, i32, i32)
fn measure( &self, orientation: Orientation, for_size: i32, ) -> (i32, i32, i32, i32)
Measures @self in the orientation @orientation and for the given @for_size.
As an example, if @orientation is Orientation::Horizontal
and @for_size
is 300, this functions will compute the minimum and natural width of @self
if it is allocated at a height of 300 pixels.
See GtkWidget’s geometry management section for
a more details on implementing GtkWidgetClass.measure()
.
§orientation
the orientation to measure
§for_size
Size for the opposite of @orientation, i.e.
if @orientation is Orientation::Horizontal
, this is
the height the widget should be measured with. The Orientation::Vertical
case is analogous. This way, both height-for-width and width-for-height
requests can be implemented. If no size is known, -1 can be passed.
§Returns
§minimum
location to store the minimum size
§natural
location to store the natural size
§minimum_baseline
location to store the baseline position for the minimum size, or -1 to report no baseline
§natural_baseline
location to store the baseline position for the natural size, or -1 to report no baseline
Sourcefn mnemonic_activate(&self, group_cycling: bool) -> bool
fn mnemonic_activate(&self, group_cycling: bool) -> bool
Emits the mnemonic-activate
signal.
§group_cycling
true if there are other widgets with the same mnemonic
§Returns
true if the signal has been handled
Sourcefn observe_children(&self) -> ListModel
fn observe_children(&self) -> ListModel
Returns a list model to track the children of the widget.
Calling this function will enable extra internal bookkeeping to track children and emit signals on the returned listmodel. It may slow down operations a lot.
Applications should try hard to avoid calling this function because of the slowdowns.
§Returns
a list model tracking @self’s children
Sourcefn observe_controllers(&self) -> ListModel
fn observe_controllers(&self) -> ListModel
Returns a list model to track the event controllers of the widget.
Calling this function will enable extra internal bookkeeping to track controllers and emit signals on the returned listmodel. It may slow down operations a lot.
Applications should try hard to avoid calling this function because of the slowdowns.
§Returns
a list model tracking @self’s controllers
Sourcefn pick(&self, x: f64, y: f64, flags: PickFlags) -> Option<Widget>
fn pick(&self, x: f64, y: f64, flags: PickFlags) -> Option<Widget>
Finds the descendant of the widget closest to a point.
The point (x, y) must be given in widget coordinates, so (0, 0) is assumed to be the top left of @self’s content area.
Usually widgets will return NULL
if the given coordinate is not
contained in @self checked via contains()
.
Otherwise they will recursively try to find a child that does
not return NULL
. Widgets are however free to customize their
picking algorithm.
This function is used on the toplevel to determine the widget below the mouse cursor for purposes of hover highlighting and delivering events.
§x
x coordinate to test, relative to @self’s origin
§y
y coordinate to test, relative to @self’s origin
§flags
flags to influence what is picked
§Returns
the widget’s descendant at (x, y)
Sourcefn queue_allocate(&self)
fn queue_allocate(&self)
Flags the widget for a rerun of the WidgetImpl::size_allocate()
function.
Use this function instead of queue_resize()
when the @self’s size request didn’t change but it wants to
reposition its contents.
An example user of this function is set_halign()
.
This function is only for use in widget implementations.
Sourcefn queue_draw(&self)
fn queue_draw(&self)
Schedules this widget to be redrawn.
The redraw will happen in the paint phase of the current or the next frame.
This means @self’s WidgetImpl::snapshot()
implementation will be called.
Sourcefn queue_resize(&self)
fn queue_resize(&self)
Flags a widget to have its size renegotiated.
This should be called when a widget for some reason has a new
size request. For example, when you change the text in a
Label
, the 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 WidgetImpl::size_allocate()
virtual method. Calls to gtk_widget_queue_resize() from inside
WidgetImpl::size_allocate()
will be silently ignored.
This function is only for use in widget implementations.
Sourcefn realize(&self)
fn realize(&self)
Creates the GDK resources associated with a widget.
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 this function realizes the widget’s parents in addition to @self 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
realize
.
Sourcefn remove_controller(&self, controller: &impl IsA<EventController>)
fn remove_controller(&self, controller: &impl IsA<EventController>)
Removes an event controller from the widget.
The removed event controller will not receive any more events, and should not be used again.
Widgets will remove all event controllers automatically when they are destroyed, there is normally no need to call this function.
§controller
an event controller
Sourcefn remove_css_class(&self, css_class: &str)
fn remove_css_class(&self, css_class: &str)
Removes a style from the widget.
After this, the style of @self will stop matching for @css_class.
§css_class
style class to remove from @self, without the leading period
Sourcefn remove_mnemonic_label(&self, label: &impl IsA<Widget>)
fn remove_mnemonic_label(&self, label: &impl IsA<Widget>)
Removes a widget from the list of mnemonic labels for this widget.
The widget must have previously been added to the list with
add_mnemonic_label()
.
§label
a widget that is a mnemonic label for @self
Sourcefn set_can_focus(&self, can_focus: bool)
fn set_can_focus(&self, can_focus: bool)
Sets whether the input focus can enter the widget or any of its children.
Applications should set @can_focus to false to mark a widget as for pointer/touch use only.
Note that having @can_focus be true is only one of the necessary conditions for being focusable. A widget must also be sensitive and focusable and not have an ancestor that is marked as not can-focus in order to receive input focus.
See grab_focus()
for actually setting
the input focus on a widget.
§can_focus
whether the input focus can enter the widget or any of its children
Sourcefn set_can_target(&self, can_target: bool)
fn set_can_target(&self, can_target: bool)
Sets whether the widget can be the target of pointer events.
§can_target
whether this widget should be able to receive pointer events
Sourcefn set_child_visible(&self, child_visible: bool)
fn set_child_visible(&self, child_visible: bool)
Sets whether the widget should be mapped along with its parent.
The child visibility can be set for widget before it is added
to a container with 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 widget implementations and should never be called by an application.
§child_visible
whether @self should be mapped along with its parent
Sourcefn set_css_classes(&self, classes: &[&str])
fn set_css_classes(&self, classes: &[&str])
Replaces the current style classes of the widget with @classes.
§classes
NULL
-terminated list of style classes
Sourcefn set_cursor(&self, cursor: Option<&Cursor>)
fn set_cursor(&self, cursor: Option<&Cursor>)
Sets the cursor to be shown when the pointer hovers over the widget.
If the @cursor is NULL
, @self will use the cursor
inherited from its parent.
§cursor
the new cursor
Sourcefn set_cursor_from_name(&self, name: Option<&str>)
fn set_cursor_from_name(&self, name: Option<&str>)
Sets the cursor to be shown when the pointer hovers over the widget.
This is a utility function that creates a cursor via
gdk::Cursor::from_name()
and then sets it on @self
with set_cursor()
. See those functions for
details.
On top of that, this function allows @name to be NULL
, which
will do the same as calling set_cursor()
with a NULL
cursor.
§name
the name of the cursor
Sourcefn set_direction(&self, dir: TextDirection)
fn set_direction(&self, dir: TextDirection)
Sets the reading direction on the 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 prevail, except for widgets where the children are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification).
If the direction is set to [enum@Gtk.TextDirection.none], then
the value set by Widget::set_default_direction()
will be used.
§dir
the new direction
Sourcefn set_focus_child(&self, child: Option<&impl IsA<Widget>>)
fn set_focus_child(&self, child: Option<&impl IsA<Widget>>)
Set the focus child of the widget.
This function is only suitable for widget implementations.
If you want a certain widget to get the input focus, call
grab_focus()
on it.
§child
a direct child widget of @self
or NULL
to unset the focus child
Sourcefn set_focus_on_click(&self, focus_on_click: bool)
fn set_focus_on_click(&self, focus_on_click: bool)
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.
§focus_on_click
whether the widget should grab focus when clicked with the mouse
Sourcefn set_focusable(&self, focusable: bool)
fn set_focusable(&self, focusable: bool)
Sets whether the widget can own the input focus.
Widget implementations should set @focusable to true in their init() function if they want to receive keyboard input.
Note that having @focusable be true is only one of the necessary conditions for being focusable. A widget must also be sensitive and can-focus and not have an ancestor that is marked as not can-focus in order to receive input focus.
See grab_focus()
for actually setting
the input focus on a widget.
§focusable
whether or not @self can own the input focus
Sourcefn set_font_map(&self, font_map: Option<&impl IsA<FontMap>>)
fn set_font_map(&self, font_map: Option<&impl IsA<FontMap>>)
Sets the font map to use for text rendering in the widget.
The font map is the object that is used to look up fonts. Setting a custom font map can be useful in special situations, e.g. when you need to add application-specific fonts to the set of available fonts.
When not set, the widget will inherit the font map from its parent.
§font_map
Sourcefn set_font_options(&self, options: Option<&FontOptions>)
👎Deprecated: Since 4.16
fn set_font_options(&self, options: Option<&FontOptions>)
Sets the cairo::FontOptions
used for text rendering
in the widget.
When not set, the default font options for the gdk::Display
will be used.
§Deprecated since 4.16
§options
a cairo::FontOptions
struct
to unset any previously set default font options
Sourcefn set_halign(&self, align: Align)
fn set_halign(&self, align: Align)
Sourcefn set_has_tooltip(&self, has_tooltip: bool)
fn set_has_tooltip(&self, has_tooltip: bool)
Sourcefn set_hexpand(&self, expand: bool)
fn set_hexpand(&self, expand: bool)
Sets whether the widget would like any available extra horizontal space.
When a user resizes a window, widgets with expand set to 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 compute_expand()
.
A widget can decide how the expandability of children affects its
own expansion by overriding the compute_expand
virtual method on
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
set_hexpand()
sets the hexpand-set property (see
set_hexpand_set()
) which causes the widget’s hexpand
value to be used, rather than looking at children and widget state.
§expand
whether to expand
Sourcefn set_hexpand_set(&self, set: bool)
fn set_hexpand_set(&self, set: bool)
Sets whether the hexpand flag will be used.
The hexpand-set
property will be set
automatically when you call 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.
§set
value for hexpand-set property
Sourcefn set_layout_manager(&self, layout_manager: Option<impl IsA<LayoutManager>>)
fn set_layout_manager(&self, layout_manager: Option<impl IsA<LayoutManager>>)
Sets the layout manager to use for measuring and allocating children of the widget.
§layout_manager
a layout manager
Sourcefn set_margin_bottom(&self, margin: i32)
fn set_margin_bottom(&self, margin: i32)
Sourcefn set_margin_end(&self, margin: i32)
fn set_margin_end(&self, margin: i32)
Sourcefn set_margin_start(&self, margin: i32)
fn set_margin_start(&self, margin: i32)
Sourcefn set_margin_top(&self, margin: i32)
fn set_margin_top(&self, margin: i32)
Sourcefn set_widget_name(&self, name: &str)
fn set_widget_name(&self, name: &str)
Sets a widgets name.
Setting a name allows you to refer to the widget from a
CSS file. You can apply a style to widgets with a particular name
in the CSS file. See the documentation for the CSS syntax (on the
same page as the docs for StyleContext
.
Note that the CSS syntax has certain special characters to delimit and represent elements in a selector (period, #, >, *…), so using these will make your widget impossible to match by name. Any combination of alphanumeric symbols, dashes and underscores will suffice.
§name
name for the widget
Sourcefn set_opacity(&self, opacity: f64)
fn set_opacity(&self, opacity: f64)
Requests the widget to be rendered partially transparent.
An opacity of 0 is fully transparent and an opacity of 1 is fully opaque.
Opacity works on both toplevel widgets and child widgets, although
there are some limitations: For toplevel widgets, applying opacity
depends on the capabilities of the windowing system. On X11, this
has any effect only on X displays with a compositing manager, see
Gdk::Display::is_composited()
. On Windows and Wayland it will
always work, although setting a window’s opacity after the window
has been shown may cause some flicker.
Note that the opacity is inherited through inclusion — if you set
a toplevel to be partially translucent, all of its content will
appear translucent, since it is ultimatively rendered on that
toplevel. The opacity value itself is not inherited by child
widgets (since that would make widgets deeper in the hierarchy
progressively more translucent). As a consequence, Popover
instances and other Native
widgets with their own surface
will use their own opacity value, and thus by default appear
non-translucent, even if they are attached to a toplevel that
is translucent.
§opacity
desired opacity, between 0 and 1
Sourcefn set_overflow(&self, overflow: Overflow)
fn set_overflow(&self, overflow: Overflow)
Sets how the widget treats content that is drawn outside the it’s content area.
See the definition of Overflow
for details.
This setting is provided for widget implementations and should not be used by application code.
The default value is [enum@Gtk.Overflow.visible].
§overflow
desired overflow value
Sourcefn set_parent(&self, parent: &impl IsA<Widget>)
fn set_parent(&self, parent: &impl IsA<Widget>)
Sets the parent widget of the widget.
This takes care of details such as updating the state and style
of the child to reflect its new location and resizing the parent.
The opposite function is unparent()
.
This function is useful only when implementing subclasses of
Widget
.
§parent
parent widget
Sourcefn set_receives_default(&self, receives_default: bool)
fn set_receives_default(&self, receives_default: bool)
Sets whether the widget will be treated as the default widget within its toplevel when it has the focus, even if another widget is the default.
§receives_default
whether or not @self can be a default widget
Sourcefn set_sensitive(&self, sensitive: bool)
fn set_sensitive(&self, sensitive: bool)
Sets the sensitivity of the 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.
§sensitive
true to make the widget sensitive
Sourcefn set_size_request(&self, width: i32, height: i32)
fn set_size_request(&self, width: i32, height: i32)
Sets the minimum size of the 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, GtkWindowExt::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.
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 is basically impossible to hardcode a size that will always work.
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
properties
margin-start
,
margin-end
,
margin-top
, and
margin-bottom
, but it does include pretty
much all other padding or border properties set by any subclass
of Widget
.
§width
width @self should request, or -1 to unset
§height
height @self should request, or -1 to unset
Sourcefn set_state_flags(&self, flags: StateFlags, clear: bool)
fn set_state_flags(&self, flags: StateFlags, clear: bool)
Turns on flag values in the current widget state.
Typical widget states are insensitive, prelighted, etc.
This function accepts the values [flags@Gtk.StateFlags.dir-ltr] and
[flags@Gtk.StateFlags.dir-rtl] but ignores them. If you want to set
the widget’s direction, use set_direction()
.
This function is for use in widget implementations.
§flags
state flags to turn on
§clear
whether to clear state before turning on @flags
Sourcefn set_tooltip_markup(&self, markup: Option<&str>)
fn set_tooltip_markup(&self, markup: Option<&str>)
Sets the contents of the tooltip for widget.
@markup must contain Pango markup.
This function will take care of setting the
has-tooltip
as a side effect, and of the
default handler for the query-tooltip
signal.
See also Tooltip::set_markup()
.
§markup
the contents of the tooltip for @self
Sourcefn set_tooltip_text(&self, text: Option<&str>)
fn set_tooltip_text(&self, text: Option<&str>)
Sets the contents of the tooltip for the widget.
If @text contains any markup, it will be escaped.
This function will take care of setting
has-tooltip
as a side effect,
and of the default handler for the
query-tooltip
signal.
See also Tooltip::set_text()
.
§text
the contents of the tooltip for @self
Sourcefn set_valign(&self, align: Align)
fn set_valign(&self, align: Align)
Sourcefn set_vexpand(&self, expand: bool)
fn set_vexpand(&self, expand: bool)
Sets whether the widget would like any available extra vertical space.
See set_hexpand()
for more detail.
§expand
whether to expand
Sourcefn set_vexpand_set(&self, set: bool)
fn set_vexpand_set(&self, set: bool)
Sets whether the vexpand flag will be used.
See set_hexpand_set()
for more detail.
§set
value for vexpand-set property
Sourcefn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Sets the visibility state of @self.
Note that setting this to true doesn’t mean the widget is
actually viewable, see get_visible()
.
§visible
whether the widget should be shown or not
Sourcefn should_layout(&self) -> bool
fn should_layout(&self) -> bool
Sourcefn show(&self)
👎Deprecated: Since 4.10
fn show(&self)
Flags a widget to be displayed.
Any widget that isn’t shown will not appear on the screen.
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 widget is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel widget is realized and mapped.
§Deprecated since 4.10
Use set_visible()
instead
Sourcefn size_allocate(&self, allocation: &Allocation, baseline: i32)
fn size_allocate(&self, allocation: &Allocation, baseline: i32)
Allocates widget with a transformation that translates the origin to the position in @allocation.
This is a simple form of allocate()
.
§allocation
position and size to be allocated to @self
§baseline
the baseline of the child, or -1
Sourcefn snapshot_child(
&self,
child: &impl IsA<Widget>,
snapshot: &impl IsA<Snapshot>,
)
fn snapshot_child( &self, child: &impl IsA<Widget>, snapshot: &impl IsA<Snapshot>, )
Snapshots a child of the widget.
When a widget receives a call to the snapshot function,
it must send synthetic WidgetImpl::snapshot()
calls
to all children. This function provides a convenient way
of doing this. A widget, when it receives a call to its
WidgetImpl::snapshot()
function, calls
gtk_widget_snapshot_child() once for each child, passing in
the @snapshot the widget received.
This function takes care of translating the origin of @snapshot, and deciding whether the child needs to be snapshot.
It does nothing for children that implement Native
.
§child
a child of @self
§snapshot
snapshot as passed to the widget. In particular, no
calls to SnapshotExt::translate()
or other transform calls
should have been made
Sourcefn translate_coordinates(
&self,
dest_widget: &impl IsA<Widget>,
src_x: f64,
src_y: f64,
) -> Option<(f64, f64)>
👎Deprecated: Since 4.12
fn translate_coordinates( &self, dest_widget: &impl IsA<Widget>, src_x: f64, src_y: f64, ) -> Option<(f64, f64)>
Translates coordinates relative to @self’s allocation to coordinates relative to @dest_widget’s allocations.
In order to perform this operation, both widget must share a common ancestor. If that is not the case, @dest_x and @dest_y are set to 0 and false is returned.
§Deprecated since 4.12
Use compute_point()
instead
§dest_widget
another widget
§src_x
X position in widget coordinates of @self
§src_y
Y position in widget coordinates of @self
§Returns
true if @self and @dest_widget have a common ancestor, false otherwise
§dest_x
location to store X position in widget coordinates of @dest_widget
§dest_y
location to store Y position in widget coordinates of @dest_widget
Sourcefn trigger_tooltip_query(&self)
fn trigger_tooltip_query(&self)
Triggers a tooltip query on the display of the widget.
Sourcefn unmap(&self)
fn unmap(&self)
Causes a widget to be unmapped if it’s currently mapped.
This function is only for use in widget implementations.
Sourcefn unparent(&self)
fn unparent(&self)
Removes @self from its parent.
This function is only for use in widget implementations, typically in dispose.
Sourcefn unrealize(&self)
fn unrealize(&self)
Causes a widget to be unrealized.
This frees all GDK resources associated with the widget.
This function is only useful in widget implementations.
Sourcefn unset_state_flags(&self, flags: StateFlags)
fn unset_state_flags(&self, flags: StateFlags)
Turns off flag values for the current widget state.
See set_state_flags()
.
This function is for use in widget implementations.
§flags
state flags to turn off
Sourcefn height_request(&self) -> i32
fn height_request(&self) -> i32
Overrides for height request of the widget.
If this is -1, the natural request will be used.
Sourcefn set_height_request(&self, height_request: i32)
fn set_height_request(&self, height_request: i32)
Overrides for height request of the widget.
If this is -1, the natural request will be used.
Sourcefn width_request(&self) -> i32
fn width_request(&self) -> i32
Overrides for width request of the widget.
If this is -1, the natural request will be used.
Sourcefn set_width_request(&self, width_request: i32)
fn set_width_request(&self, width_request: i32)
Overrides for width request of the widget.
If this is -1, the natural request will be used.
Sourcefn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Signals that all holders of a reference to the widget should release the reference that they hold.
May result in finalization of the widget if all references are released.
This signal is not suitable for saving widget state.
Sourcefn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted when the text direction of a widget changes.
§previous_direction
the previous text direction
Sourcefn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when @widget is hidden.
Emitted if keyboard navigation fails.
See keynav_failed()
for details.
§direction
the direction of movement
§Returns
true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
Sourcefn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when @widget is going to be mapped.
A widget is mapped when the widget is visible (which is controlled with
visible
) and all its parents up to the toplevel widget
are also visible.
The ::map
signal can be used to determine whether a widget will be drawn,
for instance it can resume an animation that was stopped during the
emission of unmap
.
Sourcefn connect_mnemonic_activate<F: Fn(&Self, bool) -> Propagation + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_mnemonic_activate<F: Fn(&Self, bool) -> Propagation + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted when a widget is activated via a mnemonic.
The default handler for this signal activates @widget if @group_cycling is false, or just makes @widget grab focus if @group_cycling is true.
§group_cycling
true if there are other widgets with the same mnemonic
§Returns
true to stop other handlers from being invoked for the event, false to propagate the event further
Sourcefn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted when the focus is moved.
The ::move-focus
signal is a keybinding signal.
The default bindings for this signal are Tab to move forward, and Shift+Tab to move backward.
§direction
the direction of the focus move
fn emit_move_focus(&self, direction: DirectionType)
Sourcefn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted when the widget’s tooltip is about to be shown.
This happens when the has-tooltip
property
is true and the hover timeout has expired with the cursor hovering
above @widget; or emitted when @widget got focus in keyboard mode.
Using the given coordinates, the signal handler should determine whether a tooltip should be shown for @widget. If this is the case true should be returned, false otherwise. Note that if @keyboard_mode is true, the values of @x and @y are undefined and should not be used.
The signal handler is free to manipulate @tooltip with the therefore destined function calls.
§x
the x coordinate of the cursor position in widget coordinates
§y
the y coordinate of the cursor position in widget coordinates
§keyboard_mode
true if the tooltip was triggered using the keyboard
§tooltip
a Tooltip
§Returns
true if @tooltip should be shown right now, false otherwise
Sourcefn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when @widget is associated with a gdk::Surface
.
This means that realize()
has been called
or the widget has been mapped (that is, it is going to be drawn).
Sourcefn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when @widget is shown.
Sourcefn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>( &self, f: F, ) -> SignalHandlerId
Sourcefn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when @widget is going to be unmapped.
A widget is unmapped when either it or any of its parents up to the toplevel widget have been set as hidden.
As ::unmap
indicates that a widget will not be shown any longer,
it can be used to, for example, stop an animation on the widget.
Sourcefn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the gdk::Surface
associated with @widget is destroyed.
This means that unrealize()
has been called
or the widget has been unmapped (that is, it is going to be hidden).
fn connect_can_focus_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_can_target_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_css_classes_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_focus_on_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_focusable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_halign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_has_default_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_has_focus_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_has_tooltip_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_height_request_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_hexpand_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_hexpand_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_layout_manager_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_margin_bottom_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_margin_end_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_margin_start_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_margin_top_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_opacity_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_overflow_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_receives_default_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_root_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_scale_factor_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_sensitive_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_tooltip_markup_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_tooltip_text_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_valign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_vexpand_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_vexpand_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_visible_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_width_request_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.