Struct kas_widgets::Splitter
source · pub struct Splitter<W: Widget, D: Directional = Direction> { /* private fields */ }
Expand description
A resizable row/column widget
Similar to crate::List
but with draggable handles between items.
Implementations§
source§impl<W: Widget, D: Directional> Splitter<W, D>
impl<W: Widget, D: Directional> Splitter<W, D>
source§impl<W: Widget, D: Directional> Splitter<W, D>
impl<W: Widget, D: Directional> Splitter<W, D>
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,
cx: &mut ConfigCx<'_>,
data: &W::Data,
widget: W
) -> usize
pub fn push( &mut self, cx: &mut ConfigCx<'_>, data: &W::Data, 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, cx: &mut EventState) -> Option<W>
pub fn pop(&mut self, cx: &mut EventState) -> Option<W>
Remove the last child widget (if any) and return
Triggers Action::RESIZE
.
sourcepub fn insert(
&mut self,
cx: &mut ConfigCx<'_>,
data: &W::Data,
index: usize,
widget: W
)
pub fn insert( &mut self, cx: &mut ConfigCx<'_>, data: &W::Data, 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, cx: &mut EventState, index: usize) -> W
pub fn remove(&mut self, cx: &mut EventState, 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,
cx: &mut ConfigCx<'_>,
data: &W::Data,
index: usize,
w: W
) -> W
pub fn replace( &mut self, cx: &mut ConfigCx<'_>, data: &W::Data, 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
.
sourcepub fn extend<T: IntoIterator<Item = W>>(
&mut self,
data: &W::Data,
cx: &mut ConfigCx<'_>,
iter: T
)
pub fn extend<T: IntoIterator<Item = W>>( &mut self, data: &W::Data, cx: &mut ConfigCx<'_>, iter: T )
Append child widgets from an iterator
New children are configured immediately. Triggers Action::RESIZE
.
sourcepub fn resize_with<F: Fn(usize) -> W>(
&mut self,
data: &W::Data,
cx: &mut ConfigCx<'_>,
len: usize,
f: F
)
pub fn resize_with<F: Fn(usize) -> W>( &mut self, data: &W::Data, cx: &mut ConfigCx<'_>, len: usize, f: F )
Resize, using the given closure to construct new widgets
New children are configured immediately. Triggers Action::RESIZE
.
Trait Implementations§
source§impl<W: Widget, D: Directional> Events for Splitter<W, D>
impl<W: Widget, D: Directional> Events for Splitter<W, D>
source§fn make_child_id(&mut self, child_index: usize) -> Id
fn make_child_id(&mut self, child_index: usize) -> Id
source§fn handle_messages(&mut self, cx: &mut EventCx<'_>, _: &Self::Data)
fn handle_messages(&mut self, cx: &mut EventCx<'_>, _: &Self::Data)
source§fn steal_event(
&mut self,
_: &mut EventCx<'_>,
_: &Self::Data,
_: &Id,
_: &Event
) -> IsUsed
fn steal_event( &mut self, _: &mut EventCx<'_>, _: &Self::Data, _: &Id, _: &Event ) -> IsUsed
source§fn configure_recurse(&mut self, cx: &mut ConfigCx<'_>, data: &Self::Data)
fn configure_recurse(&mut self, cx: &mut ConfigCx<'_>, data: &Self::Data)
source§fn update(&mut self, cx: &mut ConfigCx<'_>, data: &Self::Data)
fn update(&mut self, cx: &mut ConfigCx<'_>, data: &Self::Data)
source§fn update_recurse(&mut self, cx: &mut ConfigCx<'_>, data: &Self::Data)
fn update_recurse(&mut self, cx: &mut ConfigCx<'_>, data: &Self::Data)
source§impl<W: Widget, D: Directional> Layout for Splitter<W, D>
impl<W: Widget, D: Directional> Layout for Splitter<W, D>
source§fn num_children(&self) -> usize
fn num_children(&self) -> usize
source§fn get_child(&self, index: usize) -> Option<&dyn Layout>
fn get_child(&self, index: usize) -> Option<&dyn Layout>
dyn Layout
Read moresource§fn find_child_index(&self, id: &Id) -> Option<usize>
fn find_child_index(&self, id: &Id) -> Option<usize>
id
, if any Read moresource§fn size_rules(&mut self, sizer: SizeCx<'_>, axis: AxisInfo) -> SizeRules
fn size_rules(&mut self, sizer: SizeCx<'_>, axis: AxisInfo) -> SizeRules
source§fn widget_name(&self) -> &'static str
fn widget_name(&self) -> &'static str
source§fn translation(&self) -> Offset
fn translation(&self) -> Offset
Auto Trait Implementations§
impl<W, D> RefUnwindSafe for Splitter<W, D>where
D: RefUnwindSafe,
W: RefUnwindSafe,
impl<W, D = Direction> !Send for Splitter<W, D>
impl<W, D = Direction> !Sync for Splitter<W, D>
impl<W, D> Unpin for Splitter<W, D>
impl<W, D> UnwindSafe for Splitter<W, D>where
D: UnwindSafe,
W: UnwindSafe,
Blanket Implementations§
source§impl<W> AdaptWidget for Wwhere
W: Widget,
impl<W> AdaptWidget for Wwhere
W: Widget,
source§fn on_configure<F>(self, f: F) -> AdaptEvents<Self>
fn on_configure<F>(self, f: F) -> AdaptEvents<Self>
Events::configure
Read moresource§fn on_update<F>(self, f: F) -> AdaptEvents<Self>
fn on_update<F>(self, f: F) -> AdaptEvents<Self>
Events::update
Read moresource§fn on_message<M, H>(self, handler: H) -> AdaptEvents<Self>
fn on_message<M, H>(self, handler: H) -> AdaptEvents<Self>
M
Read moresource§fn on_messages<H>(self, handler: H) -> AdaptEvents<Self>
fn on_messages<H>(self, handler: H) -> AdaptEvents<Self>
source§fn with_min_size_px(self, w: i32, h: i32) -> Reserve<Self>
fn with_min_size_px(self, w: i32, h: i32) -> Reserve<Self>
source§fn with_min_size_em(self, w: f32, h: f32) -> Reserve<Self>
fn with_min_size_em(self, w: f32, h: f32) -> Reserve<Self>
source§fn with_label<D, T>(self, direction: D, label: T) -> WithLabel<Self, D>
fn with_label<D, T>(self, direction: D, label: T) -> WithLabel<Self, D>
source§impl<W> AdaptWidgetAny for W
impl<W> AdaptWidgetAny for W
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
§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> LayoutExt for W
impl<W> LayoutExt for W
source§fn identify(&self) -> IdentifyWidget<'_>
fn identify(&self) -> IdentifyWidget<'_>
source§fn is_strict_ancestor_of(&self, id: &Id) -> bool
fn is_strict_ancestor_of(&self, id: &Id) -> bool
id
is not self and is a descendant Read more