pub trait WidgetImpl: WidgetImplExt + ObjectImpl {
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§

source

fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool)

Computes whether a container should give this widget extra space when possible.

source

fn contains(&self, x: f64, y: f64) -> bool

Tests if the point at (@x, @y) is contained in @self.

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 (@x, @y).

source

fn direction_changed(&self, previous_direction: TextDirection)

Signal emitted when the text direction of a widget changes.

source

fn focus(&self, direction_type: DirectionType) -> bool

Vfunc for gtk_widget_child_focus()

source

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.

source

fn grab_focus(&self) -> bool

Causes @self to have the keyboard focus for the Window it’s inside.

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 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 @self.

source

fn hide(&self)

👎Deprecated: Since 4.10

Reverses the effects of gtk_widget_show().

This is causing the widget to be hidden (invisible to the user).

§Deprecated since 4.10

Use WidgetExt::set_visible() instead

source

fn keynav_failed(&self, direction_type: DirectionType) -> bool

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 WidgetExt::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 WidgetExt::child_focus() on the widget’s toplevel.

The default keynav-failed handler returns false for DirectionType::TabForward and DirectionType::TabBackward. 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 container(s).

source

fn map(&self)

Causes a widget to be mapped if it isn’t already.

This function is only for use in widget implementations.

source

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

source

fn mnemonic_activate(&self, group_cycling: bool) -> bool

Emits the ::mnemonic-activate signal.

See mnemonic-activate.

§group_cycling

true if there are other widgets with the same mnemonic

§Returns

true if the signal has been handled

source

fn move_focus(&self, direction_type: DirectionType)

Signal emitted when a change of focus is requested

source

fn query_tooltip( &self, x: i32, y: i32, keyboard_tooltip: bool, tooltip: &Tooltip ) -> bool

Signal emitted when “has-tooltip” is true and the hover timeout has expired with the cursor hovering “above” widget; or emitted when widget got focus in keyboard mode.

source

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.

source

fn root(&self)

Called when the widget gets added to a Root widget. Must chain up

source

fn set_focus_child(&self, child: Option<&Widget>)

Set @child as the current focus child of @self.

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 @self or None to unset the focus child of @self

source

fn show(&self)

👎Deprecated: Since 4.10

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 container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.

§Deprecated since 4.10

Use WidgetExt::set_visible() instead

source

fn size_allocate(&self, width: i32, height: i32, baseline: i32)

Called to set the allocation, if the widget does not have a layout manager.

source

fn snapshot(&self, snapshot: &Snapshot)

Vfunc called when a new snapshot of the widget has to be taken.

source

fn state_flags_changed(&self, state_flags: &StateFlags)

Signal emitted when the widget state changes, see gtk_widget_get_state_flags().

source

fn system_setting_changed(&self, settings: &SystemSetting)

Emitted when a system setting was changed. Must chain up.

source

fn unmap(&self)

Causes a widget to be unmapped if it’s currently mapped.

This function is only for use in widget implementations.

source

fn unrealize(&self)

Causes a widget to be unrealized (frees all GDK resources associated with the widget).

This function is only useful in widget implementations.

source

fn unroot(&self)

Called when the widget is about to be removed from its Root widget. Must chain up

Object Safety§

This trait is not object safe.

Implementors§