Struct iced_native::widget::pane_grid::PaneGrid
source · pub struct PaneGrid<'a, Message, Renderer>where
Renderer: Renderer,
Renderer::Theme: StyleSheet + StyleSheet,{ /* private fields */ }
Expand description
A collection of panes distributed using either vertical or horizontal splits to completely fill the space available.
This distribution of space is common in tiling window managers (like
awesome
, i3
, or even
tmux
).
A PaneGrid
supports:
- Vertical and horizontal splits
- Tracking of the last active pane
- Mouse-based resizing
- Drag and drop to reorganize panes
- Hotkey support
- Configurable modifier keys
State
API to perform actions programmatically (split
,swap
,resize
, etc.)
Example
enum PaneState {
SomePane,
AnotherKindOfPane,
}
enum Message {
PaneDragged(pane_grid::DragEvent),
PaneResized(pane_grid::ResizeEvent),
}
let (mut state, _) = pane_grid::State::new(PaneState::SomePane);
let pane_grid =
PaneGrid::new(&state, |pane, state, is_maximized| {
pane_grid::Content::new(match state {
PaneState::SomePane => text("This is some pane"),
PaneState::AnotherKindOfPane => text("This is another kind of pane"),
})
})
.on_drag(Message::PaneDragged)
.on_resize(10, Message::PaneResized);
Implementations§
source§impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer>where
Renderer: Renderer,
Renderer::Theme: StyleSheet + StyleSheet,
impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer>where Renderer: Renderer, Renderer::Theme: StyleSheet + StyleSheet,
sourcepub fn new<T>(
state: &'a State<T>,
view: impl Fn(Pane, &'a T, bool) -> Content<'a, Message, Renderer>
) -> Self
pub fn new<T>( state: &'a State<T>, view: impl Fn(Pane, &'a T, bool) -> Content<'a, Message, Renderer> ) -> Self
sourcepub fn spacing(self, amount: impl Into<Pixels>) -> Self
pub fn spacing(self, amount: impl Into<Pixels>) -> Self
Sets the spacing between the panes of the PaneGrid
.
sourcepub fn on_drag<F>(self, f: F) -> Selfwhere
F: 'a + Fn(DragEvent) -> Message,
pub fn on_drag<F>(self, f: F) -> Selfwhere F: 'a + Fn(DragEvent) -> Message,
Enables the drag and drop interactions of the PaneGrid
, which will
use the provided function to produce messages.
sourcepub fn on_resize<F>(self, leeway: impl Into<Pixels>, f: F) -> Selfwhere
F: 'a + Fn(ResizeEvent) -> Message,
pub fn on_resize<F>(self, leeway: impl Into<Pixels>, f: F) -> Selfwhere F: 'a + Fn(ResizeEvent) -> Message,
Enables the resize interactions of the PaneGrid
, which will
use the provided function to produce messages.
The leeway
describes the amount of space around a split that can be
used to grab it.
The grabbable area of a split will have a length of spacing + leeway
,
properly centered. In other words, a length of
(spacing + leeway) / 2.0
on either side of the split line.
Trait Implementations§
source§impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>> for Element<'a, Message, Renderer>where
Message: 'a,
Renderer: 'a + Renderer,
Renderer::Theme: StyleSheet + StyleSheet,
impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>> for Element<'a, Message, Renderer>where Message: 'a, Renderer: 'a + Renderer, Renderer::Theme: StyleSheet + StyleSheet,
source§impl<'a, Message, Renderer> Widget<Message, Renderer> for PaneGrid<'a, Message, Renderer>where
Renderer: Renderer,
Renderer::Theme: StyleSheet + StyleSheet,
impl<'a, Message, Renderer> Widget<Message, Renderer> for PaneGrid<'a, Message, Renderer>where Renderer: Renderer, Renderer::Theme: StyleSheet + StyleSheet,
source§fn operate(
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>
)
fn operate( &self, tree: &mut Tree, layout: Layout<'_>, renderer: &Renderer, operation: &mut dyn Operation<Message> )
source§fn on_event(
&mut self,
tree: &mut Tree,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>
) -> Status
fn on_event( &mut self, tree: &mut Tree, event: Event, layout: Layout<'_>, cursor_position: Point, renderer: &Renderer, clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message> ) -> Status
source§fn mouse_interaction(
&self,
tree: &Tree,
layout: Layout<'_>,
cursor_position: Point,
viewport: &Rectangle,
renderer: &Renderer
) -> Interaction
fn mouse_interaction( &self, tree: &Tree, layout: Layout<'_>, cursor_position: Point, viewport: &Rectangle, renderer: &Renderer ) -> Interaction
Auto Trait Implementations§
impl<'a, Message, Renderer> !RefUnwindSafe for PaneGrid<'a, Message, Renderer>
impl<'a, Message, Renderer> !Send for PaneGrid<'a, Message, Renderer>
impl<'a, Message, Renderer> !Sync for PaneGrid<'a, Message, Renderer>
impl<'a, Message, Renderer> Unpin for PaneGrid<'a, Message, Renderer>where <<Renderer as Renderer>::Theme as StyleSheet>::Style: Unpin, <<Renderer as Renderer>::Theme as StyleSheet>::Style: Unpin,
impl<'a, Message, Renderer> !UnwindSafe for PaneGrid<'a, Message, Renderer>
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere T: FloatComponent, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere U: FromColor<T>,
source§fn into_color(self) -> U
fn into_color(self) -> U
source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere U: FromColorUnclamped<T>,
source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere U: TryFromColor<T>,
source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more