Trait cushy::widget::MakeWidget

source ·
pub trait MakeWidget: Sized {
Show 58 methods // Required method fn make_widget(self) -> WidgetInstance; // Provided methods fn into_window(self) -> Window<WidgetInstance> { ... } fn build_virtual_window(self) -> CushyWindowBuilder { ... } fn build_recorder(self) -> VirtualRecorderBuilder<Rgb8> { ... } fn with_styles(self, styles: impl IntoValue<Styles>) -> Style where Self: Sized { ... } fn with<C: ComponentDefinition>( self, name: &C, component: impl IntoValue<C::ComponentType> ) -> Style where Value<C::ComponentType>: IntoComponentValue { ... } fn with_dynamic<C: ComponentDefinition>( self, name: &C, dynamic: impl IntoDynamicComponentValue ) -> Style where Value<C::ComponentType>: IntoComponentValue { ... } fn h1(self) -> Style { ... } fn h2(self) -> Style { ... } fn h3(self) -> Style { ... } fn h4(self) -> Style { ... } fn h5(self) -> Style { ... } fn h6(self) -> Style { ... } fn xxxx_large(self) -> Style { ... } fn xxx_large(self) -> Style { ... } fn xx_large(self) -> Style { ... } fn x_large(self) -> Style { ... } fn large(self) -> Style { ... } fn default_size(self) -> Style { ... } fn small(self) -> Style { ... } fn x_small(self) -> Style { ... } fn with_next_focus( self, next_focus: impl IntoValue<Option<WidgetId>> ) -> WidgetInstance { ... } fn with_enabled(self, enabled: impl IntoValue<bool>) -> WidgetInstance { ... } fn into_default(self) -> WidgetInstance { ... } fn into_escape(self) -> WidgetInstance { ... } fn and(self, other: impl MakeWidget) -> WidgetList { ... } fn expand(self) -> Expand { ... } fn expand_weighted(self, weight: u8) -> Expand { ... } fn expand_horizontally(self) -> Expand { ... } fn expand_vertically(self) -> Expand { ... } fn size<T>(self, size: Size<T>) -> Resize where T: Into<DimensionRange> { ... } fn width(self, width: impl Into<DimensionRange>) -> Resize { ... } fn height(self, height: impl Into<DimensionRange>) -> Resize { ... } fn into_button(self) -> Button { ... } fn into_checkbox(self, value: impl IntoDynamic<CheckboxState>) -> Checkbox { ... } fn centered(self) -> Align { ... } fn align_left(self) -> Align { ... } fn align_right(self) -> Align { ... } fn align_top(self) -> Align { ... } fn align_bottom(self) -> Align { ... } fn fit_horizontally(self) -> Align { ... } fn fit_vertically(self) -> Align { ... } fn scroll(self) -> Scroll { ... } fn vertical_scroll(self) -> Scroll { ... } fn horizontal_scroll(self) -> Scroll { ... } fn widget_ref(self) -> WidgetRef { ... } fn contain(self) -> Container { ... } fn contain_level(self, level: impl IntoValue<ContainerLevel>) -> Container { ... } fn background_color(self, color: impl IntoValue<Color>) -> Container { ... } fn pad(self) -> Container { ... } fn pad_by(self, padding: impl IntoValue<Edges<Dimension>>) -> Container { ... } fn themed(self, theme: impl IntoValue<ThemePair>) -> Themed { ... } fn themed_mode(self, mode: impl IntoValue<ThemeMode>) -> ThemedMode { ... } fn collapse_horizontally( self, collapse_when: impl IntoDynamic<bool> ) -> Collapse { ... } fn collapse_vertically( self, collapse_when: impl IntoDynamic<bool> ) -> Collapse { ... } fn disclose(self) -> Disclose { ... } fn validation(self, validation: impl IntoDynamic<Validation>) -> Validated { ... } fn tooltip(self, layer: &OverlayLayer, tip: impl MakeWidget) -> Tooltipped { ... }
}
Expand description

A type that can create a WidgetInstance.

Required Methods§

source

fn make_widget(self) -> WidgetInstance

Returns a new widget.

Provided Methods§

source

fn into_window(self) -> Window<WidgetInstance>

Returns a new window containing self as the root widget.

source

fn build_virtual_window(self) -> CushyWindowBuilder

Returns a builder for a VirtualWindow.

source

fn build_recorder(self) -> VirtualRecorderBuilder<Rgb8>

Returns a builder for a VirtualRecorder

source

fn with_styles(self, styles: impl IntoValue<Styles>) -> Style
where Self: Sized,

Associates styles with this widget.

This is equivalent to Style::new(styles, self).

source

fn with<C: ComponentDefinition>( self, name: &C, component: impl IntoValue<C::ComponentType> ) -> Style

Associates a style component with self.

source

fn with_dynamic<C: ComponentDefinition>( self, name: &C, dynamic: impl IntoDynamicComponentValue ) -> Style

Associates a style component with self, resolving its value using dynamic at runtime.

source

fn h1(self) -> Style

Styles self with the largest of 6 heading styles.

source

fn h2(self) -> Style

Styles self with the second largest of 6 heading styles.

source

fn h3(self) -> Style

Styles self with the third largest of 6 heading styles.

source

fn h4(self) -> Style

Styles self with the third smallest of 6 heading styles.

source

fn h5(self) -> Style

Styles self with the second smallest of 6 heading styles.

source

fn h6(self) -> Style

Styles self with the smallest of 6 heading styles.

source

fn xxxx_large(self) -> Style

Styles self with the largest text size.

source

fn xxx_large(self) -> Style

Styles self with the second largest text size.

source

fn xx_large(self) -> Style

Styles self with the third largest text size.

source

fn x_large(self) -> Style

Styles self with the fourth largest text size.

source

fn large(self) -> Style

Styles self with the fifth largest text size.

source

fn default_size(self) -> Style

Styles self with the third smallest text size.

source

fn small(self) -> Style

Styles self with the second smallest text size.

source

fn x_small(self) -> Style

Styles self with the smallest text size.

source

fn with_next_focus( self, next_focus: impl IntoValue<Option<WidgetId>> ) -> WidgetInstance

Sets the widget that should be focused next.

Cushy automatically determines reverse tab order by using this same relationship.

source

fn with_enabled(self, enabled: impl IntoValue<bool>) -> WidgetInstance

Sets this widget to be enabled/disabled based on enabled and returns self.

If this widget is disabled, all children widgets will also be disabled.

§Panics

This function can only be called when one instance of the widget exists. If any clones exist, a panic will occur.

source

fn into_default(self) -> WidgetInstance

Sets this widget as a “default” widget.

Default widgets are automatically activated when the user signals they are ready for the default action to occur.

Example widgets this is used for are:

  • Submit buttons on forms
  • Ok buttons
source

fn into_escape(self) -> WidgetInstance

Sets this widget as an “escape” widget.

Escape widgets are automatically activated when the user signals they are ready to escape their current situation.

Example widgets this is used for are:

  • Close buttons
  • Cancel buttons
source

fn and(self, other: impl MakeWidget) -> WidgetList

Returns a collection of widgets using self and other.

source

fn expand(self) -> Expand

Expands self to grow to fill its parent.

source

fn expand_weighted(self, weight: u8) -> Expand

Expands self to grow to fill its parent proportionally with other weighted siblings.

source

fn expand_horizontally(self) -> Expand

Expands self to grow to fill its parent horizontally.

source

fn expand_vertically(self) -> Expand

Expands self to grow to fill its parent vertically.

source

fn size<T>(self, size: Size<T>) -> Resize
where T: Into<DimensionRange>,

Resizes self to size.

source

fn width(self, width: impl Into<DimensionRange>) -> Resize

Resizes self to width.

width can be an any of:

source

fn height(self, height: impl Into<DimensionRange>) -> Resize

Resizes self to height.

height can be an any of:

source

fn into_button(self) -> Button

Returns this widget as the contents of a clickable button.

source

fn into_checkbox(self, value: impl IntoDynamic<CheckboxState>) -> Checkbox

Returns this widget as the label of a Checkbox.

source

fn centered(self) -> Align

Aligns self to the center vertically and horizontally.

source

fn align_left(self) -> Align

Aligns self to the left.

source

fn align_right(self) -> Align

Aligns self to the right.

source

fn align_top(self) -> Align

Aligns self to the top.

source

fn align_bottom(self) -> Align

Aligns self to the bottom.

source

fn fit_horizontally(self) -> Align

Fits self horizontally within its parent.

source

fn fit_vertically(self) -> Align

Fits self vertically within its parent.

source

fn scroll(self) -> Scroll

Allows scrolling self both vertically and horizontally.

source

fn vertical_scroll(self) -> Scroll

Allows scrolling self vertically.

source

fn horizontal_scroll(self) -> Scroll

Allows scrolling self horizontally.

source

fn widget_ref(self) -> WidgetRef

Creates a WidgetRef for use as child widget.

source

fn contain(self) -> Container

Wraps self in a Container.

source

fn contain_level(self, level: impl IntoValue<ContainerLevel>) -> Container

Wraps self in a Container with the specified level.

source

fn background_color(self, color: impl IntoValue<Color>) -> Container

Returns a new widget that renders color behind self.

source

fn pad(self) -> Container

Wraps self with the default padding.

source

fn pad_by(self, padding: impl IntoValue<Edges<Dimension>>) -> Container

Wraps self with the specified padding.

source

fn themed(self, theme: impl IntoValue<ThemePair>) -> Themed

Applies theme to self and its children.

source

fn themed_mode(self, mode: impl IntoValue<ThemeMode>) -> ThemedMode

Applies mode to self and its children.

source

fn collapse_horizontally( self, collapse_when: impl IntoDynamic<bool> ) -> Collapse

Returns a widget that collapses self horizontally based on the dynamic boolean value.

This widget will be collapsed when the dynamic contains true, and revealed when the dynamic contains false.

source

fn collapse_vertically(self, collapse_when: impl IntoDynamic<bool>) -> Collapse

Returns a widget that collapses self vertically based on the dynamic boolean value.

This widget will be collapsed when the dynamic contains true, and revealed when the dynamic contains false.

source

fn disclose(self) -> Disclose

Returns a new widget that allows hiding and showing contents.

source

fn validation(self, validation: impl IntoDynamic<Validation>) -> Validated

Returns a widget that shows validation errors and/or hints.

source

fn tooltip(self, layer: &OverlayLayer, tip: impl MakeWidget) -> Tooltipped

Returns a widget that shows tip on layer when self is hovered.

Object Safety§

This trait is not object safe.

Implementors§