Struct kas_widgets::Splitter
source · pub struct Splitter<D: Directional, W: Widget> { /* private fields */ }
Expand description
A resizable row/column widget
Similar to crate::List
but with draggable handles between items.
Implementations§
source§impl<D: Directional + Default, W: Widget> Splitter<D, W>
impl<D: Directional + Default, W: Widget> Splitter<D, W>
sourcepub fn new(widgets: Vec<W>) -> Self
pub fn new(widgets: Vec<W>) -> Self
Construct a new instance
This constructor is available where the direction is determined by the
type: for D: Directional + Default
. In other cases, use
Splitter::new_with_direction
.
source§impl<D: Directional, W: Widget> Splitter<D, W>
impl<D: Directional, W: Widget> Splitter<D, W>
sourcepub fn new_with_direction(direction: D, widgets: Vec<W>) -> Self
pub fn new_with_direction(direction: D, widgets: Vec<W>) -> Self
Construct a new instance with explicit direction
sourcepub fn edit<F: FnOnce(&mut Vec<W>)>(&mut self, f: F) -> Action
pub fn edit<F: FnOnce(&mut Vec<W>)>(&mut self, f: F) -> Action
Edit the list of children directly
This may be used to edit children before window construction. It may
also be used from a running UI, but in this case a full reconfigure
of the window’s widgets is required (triggered by the the return
value, Action::RECONFIGURE
).
sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut W>
pub fn get_mut(&mut self, index: usize) -> Option<&mut W>
Returns a mutable reference to the child, if any
sourcepub fn push(&mut self, mgr: &mut ConfigMgr<'_>, widget: W) -> usize
pub fn push(&mut self, mgr: &mut ConfigMgr<'_>, widget: W) -> usize
Append a child widget
The new child is configured immediately. Action::RESIZE
is
triggered.
Returns the new element’s index.
sourcepub fn pop(&mut self, mgr: &mut ConfigMgr<'_>) -> Option<W>
pub fn pop(&mut self, mgr: &mut ConfigMgr<'_>) -> Option<W>
Remove the last child widget (if any) and return
Triggers Action::RESIZE
.
sourcepub fn insert(&mut self, mgr: &mut ConfigMgr<'_>, index: usize, widget: W)
pub fn insert(&mut self, mgr: &mut ConfigMgr<'_>, index: usize, widget: W)
Inserts a child widget position index
Panics if index > len
.
The new child is configured immediately. Triggers Action::RESIZE
.
sourcepub fn remove(&mut self, mgr: &mut ConfigMgr<'_>, index: usize) -> W
pub fn remove(&mut self, mgr: &mut ConfigMgr<'_>, index: usize) -> W
Removes the child widget at position index
Panics if index
is out of bounds.
Triggers Action::RESIZE
.
sourcepub fn replace(&mut self, mgr: &mut ConfigMgr<'_>, index: usize, w: W) -> W
pub fn replace(&mut self, mgr: &mut ConfigMgr<'_>, index: usize, w: W) -> W
Replace the child at index
Panics if index
is out of bounds.
The new child is configured immediately. Triggers Action::RESIZE
.
Trait Implementations§
source§impl<D: Directional, W: Widget> Layout for Splitter<D, W>
impl<D: Directional, W: Widget> Layout for Splitter<D, W>
source§impl<D: Directional, W: Widget> Widget for Splitter<D, W>
impl<D: Directional, W: Widget> Widget for Splitter<D, W>
source§fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
source§fn translation(&self) -> Offset
fn translation(&self) -> Offset
source§fn steal_event(
&mut self,
mgr: &mut EventMgr<'_>,
id: &WidgetId,
event: &Event
) -> Response
fn steal_event( &mut self, mgr: &mut EventMgr<'_>, id: &WidgetId, event: &Event ) -> Response
source§impl<D: Directional, W: Widget> WidgetChildren for Splitter<D, W>
impl<D: Directional, W: Widget> WidgetChildren for Splitter<D, W>
source§fn num_children(&self) -> usize
fn num_children(&self) -> usize
source§fn get_child(&self, index: usize) -> Option<&dyn Widget>
fn get_child(&self, index: usize) -> Option<&dyn Widget>
None
if the index is
out of bounds. Read moresource§fn get_child_mut(&mut self, index: usize) -> Option<&mut dyn Widget>
fn get_child_mut(&mut self, index: usize) -> Option<&mut dyn Widget>
source§impl<D: Directional, W: Widget> WidgetCore for Splitter<D, W>
impl<D: Directional, W: Widget> WidgetCore for Splitter<D, W>
source§fn widget_name(&self) -> &'static str
fn widget_name(&self) -> &'static str
source§fn as_widget_mut(&mut self) -> &mut dyn Widget
fn as_widget_mut(&mut self) -> &mut dyn Widget
Auto Trait Implementations§
impl<D, W> RefUnwindSafe for Splitter<D, W>where D: RefUnwindSafe, W: RefUnwindSafe,
impl<D, W> !Send for Splitter<D, W>
impl<D, W> !Sync for Splitter<D, W>
impl<D, W> Unpin for Splitter<D, W>where D: Unpin, W: Unpin,
impl<D, W> UnwindSafe for Splitter<D, W>where D: UnwindSafe, W: UnwindSafe,
Blanket Implementations§
§impl<S, T> Cast<T> for Swhere
T: Conv<S>,
impl<S, T> Cast<T> for Swhere T: Conv<S>,
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
source§impl<W> WidgetExt for Wwhere
W: Widget + ?Sized,
impl<W> WidgetExt for Wwhere W: Widget + ?Sized,
source§fn eq_id<T>(&self, rhs: T) -> boolwhere
WidgetId: PartialEq<T>,
fn eq_id<T>(&self, rhs: T) -> boolwhere WidgetId: PartialEq<T>,
source§fn identify(&self) -> IdentifyWidget
fn identify(&self) -> IdentifyWidget
source§fn is_ancestor_of(&self, id: &WidgetId) -> bool
fn is_ancestor_of(&self, id: &WidgetId) -> bool
id
is self or a descendant Read moresource§fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
id
is not self and is a descendant Read more