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§
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, )
Sourcefn child_notify(&self, child_property: &ParamSpec)
fn child_notify(&self, child_property: &ParamSpec)
Emits a child-notify signal for the
[child property][child-properties] child_property
on self.
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 self’s parent
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
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.
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 self.
Sourcefn preferred_width(&self) -> (i32, i32)
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
Sourcefn preferred_width_for_height(&self, height: i32) -> (i32, i32)
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
Sourcefn preferred_height(&self) -> (i32, i32)
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
Sourcefn preferred_height_for_width(&self, width: i32) -> (i32, i32)
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
Sourcefn size_allocate(&self, allocation: &Allocation)
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 self
Sourcefn realize(&self)
fn realize(&self)
Creates the GDK (windowing system) resources associated with a
widget. For example, 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
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
draw. Or simply g_signal_connect () to the
realize signal.
Sourcefn unrealize(&self)
fn unrealize(&self)
This function is only useful in widget implementations.
Causes a widget to be unrealized (frees all GDK resources
associated with the widget, such as self->window).
Sourcefn map(&self)
fn map(&self)
This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.
Sourcefn unmap(&self)
fn unmap(&self)
This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped.
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".