pub struct SeparatorOptions {
pub orientation: SeparatorOrientation,
pub layout: Option<LayoutStyle>,
pub visual: UiVisual,
pub thickness: f32,
pub margin: f32,
pub accessibility_label: Option<String>,
}Fields§
§orientation: SeparatorOrientation§layout: Option<LayoutStyle>§visual: UiVisual§thickness: f32§margin: f32§accessibility_label: Option<String>Implementations§
Source§impl SeparatorOptions
impl SeparatorOptions
pub fn horizontal() -> Self
Sourcepub fn vertical() -> Self
pub fn vertical() -> Self
Examples found in repository?
examples/showcase.rs (line 7614)
7508fn styling_widgets(ui: &mut UiDocument, parent: UiNodeId, state: &ShowcaseState) {
7509 let body = section(ui, parent, "styling", "Styling");
7510 let grid_layout = operad::layout::with_grid_template_columns(
7511 Layout::grid()
7512 .size(LayoutSize::percent(1.0, 1.0))
7513 .gap(LayoutGap::points(10.0, 10.0))
7514 .to_layout_style(),
7515 [
7516 LayoutGridTrack::points(300.0),
7517 LayoutGridTrack::points(1.0),
7518 LayoutGridTrack::points(210.0),
7519 ],
7520 );
7521 let grid = ui.add_child(body, UiNode::container("styling.grid", grid_layout));
7522 let controls = ui.add_child(
7523 grid,
7524 UiNode::container(
7525 "styling.controls",
7526 LayoutStyle::column()
7527 .with_width(300.0)
7528 .with_height_percent(1.0)
7529 .with_flex_shrink(0.0)
7530 .gap(6.0),
7531 ),
7532 );
7533 style_edge_group(
7534 ui,
7535 controls,
7536 "styling.inner",
7537 "Inner margin",
7538 "styling.inner_same",
7539 state.styling.inner_same,
7540 [
7541 ("Left", "styling.inner", state.styling.inner_margin),
7542 ("Right", "styling.inner_right", state.styling.inner_right),
7543 ("Top", "styling.inner_top", state.styling.inner_top),
7544 ("Bottom", "styling.inner_bottom", state.styling.inner_bottom),
7545 ],
7546 0.0..32.0,
7547 );
7548 style_edge_group(
7549 ui,
7550 controls,
7551 "styling.outer",
7552 "Outer margin",
7553 "styling.outer_same",
7554 state.styling.outer_same,
7555 [
7556 ("Left", "styling.outer", state.styling.outer_margin),
7557 ("Right", "styling.outer_right", state.styling.outer_right),
7558 ("Top", "styling.outer_top", state.styling.outer_top),
7559 ("Bottom", "styling.outer_bottom", state.styling.outer_bottom),
7560 ],
7561 0.0..40.0,
7562 );
7563 style_edge_group(
7564 ui,
7565 controls,
7566 "styling.radius",
7567 "Corner radius",
7568 "styling.radius_same",
7569 state.styling.radius_same,
7570 [
7571 ("NW", "styling.radius", state.styling.corner_radius),
7572 ("NE", "styling.radius_ne", state.styling.corner_ne),
7573 ("SW", "styling.radius_sw", state.styling.corner_sw),
7574 ("SE", "styling.radius_se", state.styling.corner_se),
7575 ],
7576 0.0..28.0,
7577 );
7578 style_shadow_group(ui, controls, state);
7579 style_color_button_row(
7580 ui,
7581 controls,
7582 "styling.fill_color_button",
7583 "Fill",
7584 state.styling.fill_color(),
7585 "Pick fill color",
7586 );
7587 if state.styling_fill_picker_open {
7588 ext_widgets::color_picker(
7589 ui,
7590 controls,
7591 "styling.fill_picker",
7592 &state.styling_fill_picker,
7593 ext_widgets::ColorPickerOptions::default()
7594 .with_label("Fill")
7595 .with_action_prefix("styling.fill_picker"),
7596 );
7597 }
7598 style_stroke_row(ui, controls, state);
7599 if state.styling_stroke_picker_open {
7600 ext_widgets::color_picker(
7601 ui,
7602 controls,
7603 "styling.stroke_picker",
7604 &state.styling_stroke_picker,
7605 ext_widgets::ColorPickerOptions::default()
7606 .with_label("Stroke color")
7607 .with_action_prefix("styling.stroke_picker"),
7608 );
7609 }
7610 widgets::separator(
7611 ui,
7612 grid,
7613 "styling.preview.separator",
7614 widgets::SeparatorOptions::vertical().with_layout(
7615 LayoutStyle::new()
7616 .with_width(1.0)
7617 .with_height_percent(1.0)
7618 .with_flex_shrink(0.0),
7619 ),
7620 );
7621
7622 let preview = ui.add_child(
7623 grid,
7624 UiNode::container(
7625 "styling.preview",
7626 LayoutStyle::column()
7627 .with_width(210.0)
7628 .with_height_percent(1.0)
7629 .with_flex_shrink(0.0)
7630 .padding(8.0),
7631 )
7632 .with_visual(UiVisual::panel(color(17, 20, 25), None, 0.0)),
7633 );
7634 style_preview(ui, preview, state.styling);
7635}Sourcepub fn with_layout(self, layout: impl Into<LayoutStyle>) -> Self
pub fn with_layout(self, layout: impl Into<LayoutStyle>) -> Self
Examples found in repository?
examples/showcase.rs (lines 7614-7619)
7508fn styling_widgets(ui: &mut UiDocument, parent: UiNodeId, state: &ShowcaseState) {
7509 let body = section(ui, parent, "styling", "Styling");
7510 let grid_layout = operad::layout::with_grid_template_columns(
7511 Layout::grid()
7512 .size(LayoutSize::percent(1.0, 1.0))
7513 .gap(LayoutGap::points(10.0, 10.0))
7514 .to_layout_style(),
7515 [
7516 LayoutGridTrack::points(300.0),
7517 LayoutGridTrack::points(1.0),
7518 LayoutGridTrack::points(210.0),
7519 ],
7520 );
7521 let grid = ui.add_child(body, UiNode::container("styling.grid", grid_layout));
7522 let controls = ui.add_child(
7523 grid,
7524 UiNode::container(
7525 "styling.controls",
7526 LayoutStyle::column()
7527 .with_width(300.0)
7528 .with_height_percent(1.0)
7529 .with_flex_shrink(0.0)
7530 .gap(6.0),
7531 ),
7532 );
7533 style_edge_group(
7534 ui,
7535 controls,
7536 "styling.inner",
7537 "Inner margin",
7538 "styling.inner_same",
7539 state.styling.inner_same,
7540 [
7541 ("Left", "styling.inner", state.styling.inner_margin),
7542 ("Right", "styling.inner_right", state.styling.inner_right),
7543 ("Top", "styling.inner_top", state.styling.inner_top),
7544 ("Bottom", "styling.inner_bottom", state.styling.inner_bottom),
7545 ],
7546 0.0..32.0,
7547 );
7548 style_edge_group(
7549 ui,
7550 controls,
7551 "styling.outer",
7552 "Outer margin",
7553 "styling.outer_same",
7554 state.styling.outer_same,
7555 [
7556 ("Left", "styling.outer", state.styling.outer_margin),
7557 ("Right", "styling.outer_right", state.styling.outer_right),
7558 ("Top", "styling.outer_top", state.styling.outer_top),
7559 ("Bottom", "styling.outer_bottom", state.styling.outer_bottom),
7560 ],
7561 0.0..40.0,
7562 );
7563 style_edge_group(
7564 ui,
7565 controls,
7566 "styling.radius",
7567 "Corner radius",
7568 "styling.radius_same",
7569 state.styling.radius_same,
7570 [
7571 ("NW", "styling.radius", state.styling.corner_radius),
7572 ("NE", "styling.radius_ne", state.styling.corner_ne),
7573 ("SW", "styling.radius_sw", state.styling.corner_sw),
7574 ("SE", "styling.radius_se", state.styling.corner_se),
7575 ],
7576 0.0..28.0,
7577 );
7578 style_shadow_group(ui, controls, state);
7579 style_color_button_row(
7580 ui,
7581 controls,
7582 "styling.fill_color_button",
7583 "Fill",
7584 state.styling.fill_color(),
7585 "Pick fill color",
7586 );
7587 if state.styling_fill_picker_open {
7588 ext_widgets::color_picker(
7589 ui,
7590 controls,
7591 "styling.fill_picker",
7592 &state.styling_fill_picker,
7593 ext_widgets::ColorPickerOptions::default()
7594 .with_label("Fill")
7595 .with_action_prefix("styling.fill_picker"),
7596 );
7597 }
7598 style_stroke_row(ui, controls, state);
7599 if state.styling_stroke_picker_open {
7600 ext_widgets::color_picker(
7601 ui,
7602 controls,
7603 "styling.stroke_picker",
7604 &state.styling_stroke_picker,
7605 ext_widgets::ColorPickerOptions::default()
7606 .with_label("Stroke color")
7607 .with_action_prefix("styling.stroke_picker"),
7608 );
7609 }
7610 widgets::separator(
7611 ui,
7612 grid,
7613 "styling.preview.separator",
7614 widgets::SeparatorOptions::vertical().with_layout(
7615 LayoutStyle::new()
7616 .with_width(1.0)
7617 .with_height_percent(1.0)
7618 .with_flex_shrink(0.0),
7619 ),
7620 );
7621
7622 let preview = ui.add_child(
7623 grid,
7624 UiNode::container(
7625 "styling.preview",
7626 LayoutStyle::column()
7627 .with_width(210.0)
7628 .with_height_percent(1.0)
7629 .with_flex_shrink(0.0)
7630 .padding(8.0),
7631 )
7632 .with_visual(UiVisual::panel(color(17, 20, 25), None, 0.0)),
7633 );
7634 style_preview(ui, preview, state.styling);
7635}pub fn with_margin(self, margin: f32) -> Self
Trait Implementations§
Source§impl Clone for SeparatorOptions
impl Clone for SeparatorOptions
Source§fn clone(&self) -> SeparatorOptions
fn clone(&self) -> SeparatorOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SeparatorOptions
impl Debug for SeparatorOptions
Auto Trait Implementations§
impl Freeze for SeparatorOptions
impl RefUnwindSafe for SeparatorOptions
impl !Send for SeparatorOptions
impl !Sync for SeparatorOptions
impl Unpin for SeparatorOptions
impl UnsafeUnpin for SeparatorOptions
impl UnwindSafe for SeparatorOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.