pub trait WidgetImpl: ObjectImpl + ObjectSubclass<Type: WidgetImplBounds> {
Show 24 methods
// Provided methods
fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool) { ... }
fn contains(&self, x: f64, y: f64) -> bool { ... }
fn direction_changed(&self, previous_direction: TextDirection) { ... }
fn focus(&self, direction_type: DirectionType) -> bool { ... }
fn request_mode(&self) -> SizeRequestMode { ... }
fn grab_focus(&self) -> bool { ... }
fn hide(&self) { ... }
fn keynav_failed(&self, direction_type: DirectionType) -> bool { ... }
fn map(&self) { ... }
fn measure(
&self,
orientation: Orientation,
for_size: i32,
) -> (i32, i32, i32, i32) { ... }
fn mnemonic_activate(&self, group_cycling: bool) -> bool { ... }
fn move_focus(&self, direction_type: DirectionType) { ... }
fn query_tooltip(
&self,
x: i32,
y: i32,
keyboard_tooltip: bool,
tooltip: &Tooltip,
) -> bool { ... }
fn realize(&self) { ... }
fn root(&self) { ... }
fn set_focus_child(&self, child: Option<&Widget>) { ... }
fn show(&self) { ... }
fn size_allocate(&self, width: i32, height: i32, baseline: i32) { ... }
fn snapshot(&self, snapshot: &Snapshot) { ... }
fn state_flags_changed(&self, state_flags: &StateFlags) { ... }
fn system_setting_changed(&self, settings: &SystemSetting) { ... }
fn unmap(&self) { ... }
fn unrealize(&self) { ... }
fn unroot(&self) { ... }
}Provided Methods§
Sourcefn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool)
fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool)
Computes whether a container should give this widget extra space when possible.
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 @widget’s content area.
§x
X coordinate to test, relative to @widget’s origin
§y
Y coordinate to test, relative to @widget’s origin
§Returns
true if @widget contains the point (x, y)
Sourcefn direction_changed(&self, previous_direction: TextDirection)
fn direction_changed(&self, previous_direction: TextDirection)
Signal emitted when the text direction of a widget changes.
Sourcefn focus(&self, direction_type: DirectionType) -> bool
fn focus(&self, direction_type: DirectionType) -> bool
Vfunc for gtk_widget_child_focus()
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 @widget.
Sourcefn grab_focus(&self) -> bool
fn grab_focus(&self) -> bool
Causes @widget to have the keyboard focus for the window that it belongs to.
If @widget is not focusable, or its WidgetImpl::grab_focus()
implementation cannot transfer the focus to a descendant of @widget
that is focusable, it will not take focus and false will be returned.
Calling WidgetExt::grab_focus() on an already focused widget
is allowed, should not have an effect, and return true.
§Returns
true if focus is now inside @widget
Sourcefn hide(&self)
👎Deprecated: Since 4.10
fn hide(&self)
Since 4.10
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 WidgetExt::set_visible() instead
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
WidgetExt::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 measure(
&self,
orientation: Orientation,
for_size: i32,
) -> (i32, i32, i32, i32)
fn measure( &self, orientation: Orientation, for_size: i32, ) -> (i32, i32, i32, i32)
s geometry management section](class.Widget.html#height-for-width-geometry-management) 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 move_focus(&self, direction_type: DirectionType)
fn move_focus(&self, direction_type: DirectionType)
Signal emitted when a change of focus is requested
Sourcefn query_tooltip(
&self,
x: i32,
y: i32,
keyboard_tooltip: bool,
tooltip: &Tooltip,
) -> bool
fn query_tooltip( &self, x: i32, y: i32, keyboard_tooltip: bool, tooltip: &Tooltip, ) -> bool
widget; or emitted when widget got focus in keyboard mode.
Sourcefn realize(&self)
fn realize(&self)
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 set_focus_child(&self, child: Option<&Widget>)
fn set_focus_child(&self, child: Option<&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
WidgetExt::grab_focus() on it.
§child
a direct child widget of @widget
or NULL to unset the focus child
Sourcefn show(&self)
👎Deprecated: Since 4.10
fn show(&self)
Since 4.10
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 WidgetExt::set_visible() instead
Sourcefn size_allocate(&self, width: i32, height: i32, baseline: i32)
fn size_allocate(&self, width: i32, height: i32, baseline: i32)
Called to set the allocation, if the widget does not have a layout manager.
Sourcefn snapshot(&self, snapshot: &Snapshot)
fn snapshot(&self, snapshot: &Snapshot)
Vfunc called when a new snapshot of the widget has to be taken.
Sourcefn state_flags_changed(&self, state_flags: &StateFlags)
fn state_flags_changed(&self, state_flags: &StateFlags)
Signal emitted when the widget state changes, see gtk_widget_get_state_flags().
Sourcefn system_setting_changed(&self, settings: &SystemSetting)
fn system_setting_changed(&self, settings: &SystemSetting)
Emitted when a system setting was changed. Must chain up.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".