Skip to main content

WidgetImpl

Trait WidgetImpl 

Source
pub trait WidgetImpl: WidgetImplExt + ObjectImpl {
Show 41 methods // Provided methods fn adjust_baseline_allocation(&self, baseline: &mut i32) { ... } fn adjust_baseline_request( &self, minimum_baseline: &mut i32, natural_baseline: &mut i32, ) { ... } fn adjust_size_allocation( &self, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, allocated_pos: &mut i32, allocated_size: &mut i32, ) { ... } fn adjust_size_request( &self, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, ) { ... } fn button_press_event(&self, event: &EventButton) -> Propagation { ... } fn button_release_event(&self, event: &EventButton) -> Propagation { ... } fn child_notify(&self, child_property: &ParamSpec) { ... } fn composited_changed(&self) { ... } fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool) { ... } fn configure_event(&self, event: &EventConfigure) -> Propagation { ... } fn window_state_event(&self, event: &EventWindowState) -> Propagation { ... } fn damage_event(&self, event: &EventExpose) -> Propagation { ... } fn delete_event(&self, event: &Event) -> Propagation { ... } fn destroy(&self) { ... } fn destroy_event(&self, event: &Event) -> Propagation { ... } fn direction_changed(&self, previous_direction: TextDirection) { ... } fn dispatch_child_properties_changed(&self, pspecs: &[ParamSpec]) { ... } fn drag_begin(&self, context: &DragContext) { ... } fn drag_data_delete(&self, context: &DragContext) { ... } fn drag_data_get( &self, context: &DragContext, selection_data: &SelectionData, info: u32, time: u32, ) { ... } fn drag_data_received( &self, context: &DragContext, x: i32, y: i32, selection_data: &SelectionData, info: u32, time: u32, ) { ... } fn drag_drop( &self, context: &DragContext, x: i32, y: i32, time: u32, ) -> Propagation { ... } fn drag_end(&self, context: &DragContext) { ... } fn drag_failed( &self, context: &DragContext, result: DragResult, ) -> Propagation { ... } fn drag_leave(&self, context: &DragContext, time: u32) { ... } fn drag_motion( &self, context: &DragContext, x: i32, y: i32, time: u32, ) -> Propagation { ... } fn draw(&self, cr: &Context) -> Propagation { ... } fn request_mode(&self) -> SizeRequestMode { ... } fn preferred_width(&self) -> (i32, i32) { ... } fn preferred_width_for_height(&self, height: i32) -> (i32, i32) { ... } fn preferred_height(&self) -> (i32, i32) { ... } fn preferred_height_for_width(&self, width: i32) -> (i32, i32) { ... } fn size_allocate(&self, allocation: &Allocation) { ... } fn realize(&self) { ... } fn unrealize(&self) { ... } fn map(&self) { ... } fn unmap(&self) { ... } fn motion_notify_event(&self, event: &EventMotion) -> Propagation { ... } fn scroll_event(&self, event: &EventScroll) -> Propagation { ... } fn enter_notify_event(&self, event: &EventCrossing) -> Propagation { ... } fn leave_notify_event(&self, event: &EventCrossing) -> Propagation { ... }
}

Provided Methods§

Source

fn adjust_baseline_allocation(&self, baseline: &mut i32)

Source

fn adjust_baseline_request( &self, minimum_baseline: &mut i32, natural_baseline: &mut i32, )

Source

fn adjust_size_allocation( &self, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, allocated_pos: &mut i32, allocated_size: &mut i32, )

Convert an initial size allocation assigned by a Container using WidgetExt::size_allocate(), into an actual size allocation to be used by the widget. adjust_size_allocation adjusts to a child widget’s actual allocation from what a parent container computed for the child. The adjusted allocation must be entirely within the original allocation. In any custom implementation, chain up to the default Widget implementation of this method, which applies the margin and alignment properties of Widget. Chain up before performing your own adjustments so your own adjustments remove more allocation after the Widget base class has already removed margin and alignment. The natural size passed in should be adjusted in the same way as the allocated size, which allows adjustments to perform alignments or other changes based on natural size.

Source

fn adjust_size_request( &self, orientation: Orientation, minimum_size: &mut i32, natural_size: &mut i32, )

Convert an initial size request from a widget’s SizeRequestMode virtual method implementations into a size request to be used by parent containers in laying out the widget. adjust_size_request adjusts from a child widget’s original request to what a parent container should use for layout. The for_size argument will be -1 if the request should not be for a particular size in the opposing orientation, i.e. if the request is not height-for-width or width-for-height. If for_size is greater than -1, it is the proposed allocation in the opposing orientation that we need the request for. Implementations of adjust_size_request should chain up to the default implementation, which applies Widget’s margin properties and imposes any values from WidgetExt::set_size_request(). Chaining up should be last, after your subclass adjusts the request, so Widget can apply constraints and add the margin properly.

Source

fn button_press_event(&self, event: &EventButton) -> Propagation

Signal will be emitted when a button (typically from a mouse) is pressed.

Source

fn button_release_event(&self, event: &EventButton) -> Propagation

Signal will be emitted when a button (typically from a mouse) is released.

Source

fn child_notify(&self, child_property: &ParamSpec)

Emits a child-notify signal for the [child property][child-properties] child_property on widget.

This is the analogue of ObjectExt::notify() for child properties.

Also see ContainerExt::child_notify().

§child_property

the name of a child property installed on the class of widget’s parent

Source

fn composited_changed(&self)

Signal emitted when the composited status of widgets screen changes. See Screen::is_composited().

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 configure_event(&self, event: &EventConfigure) -> Propagation

Signal will be emitted when the size, position or stacking of the widget’s window has changed.

Source

fn window_state_event(&self, event: &EventWindowState) -> Propagation

Signal emitted when the state of the toplevel window associated to the widget changes.

Source

fn damage_event(&self, event: &EventExpose) -> Propagation

Signal emitted when a redirected window belonging to widget gets drawn into.

Source

fn delete_event(&self, event: &Event) -> Propagation

Signal emitted if a user requests that a toplevel window is closed.

Source

fn destroy(&self)

Source

fn destroy_event(&self, event: &Event) -> Propagation

Signal is emitted when a gdk::Window is destroyed.

Source

fn direction_changed(&self, previous_direction: TextDirection)

Signal emitted when the text direction of a widget changes.

Source

fn dispatch_child_properties_changed(&self, pspecs: &[ParamSpec])

Seldomly overidden.

Source

fn drag_begin(&self, context: &DragContext)

Signal emitted on the drag source when a drag is started.

Source

fn drag_data_delete(&self, context: &DragContext)

Signal emitted on the drag source when a drag with the action gdk::DragAction::MOVE is successfully completed.

Source

fn drag_data_get( &self, context: &DragContext, selection_data: &SelectionData, info: u32, time: u32, )

Signal emitted on the drag source when the drop site requests the data which is dragged.

Source

fn drag_data_received( &self, context: &DragContext, x: i32, y: i32, selection_data: &SelectionData, info: u32, time: u32, )

Signal emitted on the drop site when the dragged data has been received.

Source

fn drag_drop( &self, context: &DragContext, x: i32, y: i32, time: u32, ) -> Propagation

Signal emitted on the drop site when the user drops the data onto the widget.

Source

fn drag_end(&self, context: &DragContext)

Signal emitted on the drag source when a drag is finished.

Source

fn drag_failed(&self, context: &DragContext, result: DragResult) -> Propagation

Signal emitted on the drag source when a drag has failed.

Source

fn drag_leave(&self, context: &DragContext, time: u32)

Signal emitted on the drop site when the cursor leaves the widget.

Source

fn drag_motion( &self, context: &DragContext, x: i32, y: i32, time: u32, ) -> Propagation

signal emitted on the drop site when the user moves the cursor over the widget during a drag.

Source

fn draw(&self, cr: &Context) -> Propagation

Signal emitted when a widget is supposed to render itself.

Source

fn request_mode(&self) -> SizeRequestMode

Gets whether the widget prefers a height-for-width layout or a width-for-height layout.

Bin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.

§Returns

The SizeRequestMode preferred by widget.

Source

fn preferred_width(&self) -> (i32, i32)

Retrieves a widget’s initial minimum and natural width.

This call is specific to height-for-width requests.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

§Returns
§minimum_width

location to store the minimum width, or None

§natural_width

location to store the natural width, or None

Source

fn preferred_width_for_height(&self, height: i32) -> (i32, i32)

Retrieves a widget’s minimum and natural width if it would be given the specified height.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

§height

the height which is available for allocation

§Returns
§minimum_width

location for storing the minimum width, or None

§natural_width

location for storing the natural width, or None

Source

fn preferred_height(&self) -> (i32, i32)

Retrieves a widget’s initial minimum and natural height.

This call is specific to width-for-height requests.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

§Returns
§minimum_height

location to store the minimum height, or None

§natural_height

location to store the natural height, or None

Source

fn preferred_height_for_width(&self, width: i32) -> (i32, i32)

Retrieves a widget’s minimum and natural height if it would be given the specified width.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

§width

the width which is available for allocation

§Returns
§minimum_height

location for storing the minimum height, or None

§natural_height

location for storing the natural height, or None

Source

fn size_allocate(&self, allocation: &Allocation)

This function is only used by Container subclasses, to assign a size and position to their child widgets.

In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s halign and valign properties.

For baseline support in containers you need to use WidgetExt::size_allocate_with_baseline() instead.

§allocation

position and size to be allocated to widget

Source

fn realize(&self)

window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically.

Realizing a widget requires all the widget’s parent widgets to be realized; calling WidgetExt::realize() realizes the widget’s parents in addition to widget itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.

This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as draw. Or simply g_signal_connect () to the realize signal.

Source

fn unrealize(&self)

window).

Source

fn map(&self)

This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.

Source

fn unmap(&self)

This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped.

Source

fn motion_notify_event(&self, event: &EventMotion) -> Propagation

Signal emitted when the pointer moves over the widget’s gdk::Window.

Source

fn scroll_event(&self, event: &EventScroll) -> Propagation

Signal emitted when a button in the 4 to 7 range is pressed.

Source

fn enter_notify_event(&self, event: &EventCrossing) -> Propagation

Signal event will be emitted when the pointer enters the widget’s window.

Source

fn leave_notify_event(&self, event: &EventCrossing) -> Propagation

Will be emitted when the pointer leaves the widget’s window.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§