Trait cushy::widget::WrapperWidget

source ·
pub trait WrapperWidget:
    Debug
    + Send
    + 'static {
Show 27 methods // Required method fn child_mut(&mut self) -> &mut WidgetRef; // Provided methods fn summarize(&self, f: &mut Formatter<'_>) -> Result { ... } fn root_behavior( &mut self, context: &mut EventContext<'_>, ) -> Option<RootBehavior> { ... } fn redraw_background( &mut self, context: &mut GraphicsContext<'_, '_, '_, '_>, ) { ... } fn redraw_foreground( &mut self, context: &mut GraphicsContext<'_, '_, '_, '_>, ) { ... } fn layout_child( &mut self, available_space: Size<ConstraintLimit>, context: &mut LayoutContext<'_, '_, '_, '_>, ) -> WrappedLayout { ... } fn adjust_child_constraints( &mut self, available_space: Size<ConstraintLimit>, context: &mut LayoutContext<'_, '_, '_, '_>, ) -> Size<ConstraintLimit> { ... } fn position_child( &mut self, size: Size<Px>, available_space: Size<ConstraintLimit>, context: &mut LayoutContext<'_, '_, '_, '_>, ) -> WrappedLayout { ... } fn background_color(&mut self, context: &WidgetContext<'_>) -> Option<Color> { ... } fn mounted(&mut self, context: &mut EventContext<'_>) { ... } fn unmounted(&mut self, context: &mut EventContext<'_>) { ... } fn hit_test( &mut self, location: Point<Px>, context: &mut EventContext<'_>, ) -> bool { ... } fn hover( &mut self, location: Point<Px>, context: &mut EventContext<'_>, ) -> Option<CursorIcon> { ... } fn unhover(&mut self, context: &mut EventContext<'_>) { ... } fn accept_focus(&mut self, context: &mut EventContext<'_>) -> bool { ... } fn advance_focus( &mut self, direction: VisualOrder, context: &mut EventContext<'_>, ) -> EventHandling { ... } fn focus(&mut self, context: &mut EventContext<'_>) { ... } fn allow_blur(&mut self, context: &mut EventContext<'_>) -> bool { ... } fn blur(&mut self, context: &mut EventContext<'_>) { ... } fn activate(&mut self, context: &mut EventContext<'_>) { ... } fn deactivate(&mut self, context: &mut EventContext<'_>) { ... } fn mouse_down( &mut self, location: Point<Px>, device_id: DeviceId, button: MouseButton, context: &mut EventContext<'_>, ) -> EventHandling { ... } fn mouse_drag( &mut self, location: Point<Px>, device_id: DeviceId, button: MouseButton, context: &mut EventContext<'_>, ) { ... } fn mouse_up( &mut self, location: Option<Point<Px>>, device_id: DeviceId, button: MouseButton, context: &mut EventContext<'_>, ) { ... } fn keyboard_input( &mut self, device_id: DeviceId, input: KeyEvent, is_synthetic: bool, context: &mut EventContext<'_>, ) -> EventHandling { ... } fn ime(&mut self, ime: Ime, context: &mut EventContext<'_>) -> EventHandling { ... } fn mouse_wheel( &mut self, device_id: DeviceId, delta: MouseScrollDelta, phase: TouchPhase, context: &mut EventContext<'_>, ) -> EventHandling { ... }
}
Expand description

A Widget that contains a single child.

Required Methods§

source

fn child_mut(&mut self) -> &mut WidgetRef

Returns the child widget.

Provided Methods§

source

fn summarize(&self, f: &mut Formatter<'_>) -> Result

Writes a summary of this widget into fmt.

The default implementation calls Debug::fmt. This function allows widget authors to print only publicly relevant information that will appear when debug formatting a WidgetInstance.

source

fn root_behavior( &mut self, context: &mut EventContext<'_>, ) -> Option<RootBehavior>

Returns the behavior this widget should apply when positioned at the root of the window.

The provided implementation for WrapperWidget returns RootBehavior::PassThrough. This is different from the provided implementation for Widget.

source

fn redraw_background(&mut self, context: &mut GraphicsContext<'_, '_, '_, '_>)

Draws the background of the widget.

This is invoked before the wrapped widget is drawn.

source

fn redraw_foreground(&mut self, context: &mut GraphicsContext<'_, '_, '_, '_>)

Draws the foreground of the widget.

This is invoked after the wrapped widget is drawn.

source

fn layout_child( &mut self, available_space: Size<ConstraintLimit>, context: &mut LayoutContext<'_, '_, '_, '_>, ) -> WrappedLayout

Returns the rectangle that the child widget should occupy given available_space.

source

fn adjust_child_constraints( &mut self, available_space: Size<ConstraintLimit>, context: &mut LayoutContext<'_, '_, '_, '_>, ) -> Size<ConstraintLimit>

Returns the adjusted contraints to use when laying out the child.

source

fn position_child( &mut self, size: Size<Px>, available_space: Size<ConstraintLimit>, context: &mut LayoutContext<'_, '_, '_, '_>, ) -> WrappedLayout

Returns the layout after positioning the child that occupies size.

source

fn background_color(&mut self, context: &WidgetContext<'_>) -> Option<Color>

Returns the background color to render behind the wrapped widget.

source

fn mounted(&mut self, context: &mut EventContext<'_>)

The widget has been mounted into a parent widget.

source

fn unmounted(&mut self, context: &mut EventContext<'_>)

The widget has been removed from its parent widget.

source

fn hit_test( &mut self, location: Point<Px>, context: &mut EventContext<'_>, ) -> bool

Returns true if this widget should respond to mouse input at location.

source

fn hover( &mut self, location: Point<Px>, context: &mut EventContext<'_>, ) -> Option<CursorIcon>

The widget is currently has a cursor hovering it at location.

source

fn unhover(&mut self, context: &mut EventContext<'_>)

The widget is no longer being hovered.

source

fn accept_focus(&mut self, context: &mut EventContext<'_>) -> bool

This widget has been targeted to be focused. If this function returns true, the widget will be focused. If false, Cushy will continue searching for another focus target.

source

fn advance_focus( &mut self, direction: VisualOrder, context: &mut EventContext<'_>, ) -> EventHandling

The widget should switch to the next focusable area within this widget, honoring direction in a consistent manner. Returning HANDLED will cause the search for the next focus widget stop.

source

fn focus(&mut self, context: &mut EventContext<'_>)

The widget has received focus for user input.

source

fn allow_blur(&mut self, context: &mut EventContext<'_>) -> bool

The widget is about to lose focus. Returning true allows the focus to switch away from this widget.

source

fn blur(&mut self, context: &mut EventContext<'_>)

The widget is no longer focused for user input.

source

fn activate(&mut self, context: &mut EventContext<'_>)

The widget has become the active widget.

source

fn deactivate(&mut self, context: &mut EventContext<'_>)

The widget is no longer active.

source

fn mouse_down( &mut self, location: Point<Px>, device_id: DeviceId, button: MouseButton, context: &mut EventContext<'_>, ) -> EventHandling

A mouse button event has occurred at location. Returns whether the event has been handled or not.

If an event is handled, the widget will receive callbacks for mouse_drag and mouse_up.

source

fn mouse_drag( &mut self, location: Point<Px>, device_id: DeviceId, button: MouseButton, context: &mut EventContext<'_>, )

A mouse button is being held down as the cursor is moved across the widget.

source

fn mouse_up( &mut self, location: Option<Point<Px>>, device_id: DeviceId, button: MouseButton, context: &mut EventContext<'_>, )

A mouse button is no longer being pressed.

source

fn keyboard_input( &mut self, device_id: DeviceId, input: KeyEvent, is_synthetic: bool, context: &mut EventContext<'_>, ) -> EventHandling

A keyboard event has been sent to this widget. Returns whether the event has been handled or not.

source

fn ime(&mut self, ime: Ime, context: &mut EventContext<'_>) -> EventHandling

An input manager event has been sent to this widget. Returns whether the event has been handled or not.

source

fn mouse_wheel( &mut self, device_id: DeviceId, delta: MouseScrollDelta, phase: TouchPhase, context: &mut EventContext<'_>, ) -> EventHandling

A mouse wheel event has been sent to this widget. Returns whether the event has been handled or not.

Implementors§