Struct below_view::command_palette::CommandPalette [−][src]
pub struct CommandPalette { /* fields omitted */ }
Expand description
TextView that used to display extra information
Currently, we will use command palette to display extra information like full cgroup name. But the idea for this view is something like vim’s command palette that use for input operation command like search, filter, rearrange, apply config, etc.
Implementations
pub fn new<V: 'static + ViewBridge>(
name: &'static str,
content: &str,
cmd_controllers: Rc<RefCell<HashMap<&'static str, Controllers>>>
) -> Self
pub fn new<V: 'static + ViewBridge>(
name: &'static str,
content: &str,
cmd_controllers: Rc<RefCell<HashMap<&'static str, Controllers>>>
) -> Self
Create a new CommandPalette
Run the captured command
Turn cmd_palette into command input mode
Check if command palette is in command mode
Set alert This will preempt the command palette mode.
Trait Implementations
Draws the view with the given printer (includes bounds) and focus. Read more
Called when an event is received (key press, mouse event, …). Read more
Returns the minimum size the view requires with the given restrictions. Read more
fn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Should return true
if the view content changed since the last call
to layout()
. Read more
fn call_on_any(
&mut self,
&Selector<'_>,
&'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a)
)
fn call_on_any(
&mut self,
&Selector<'_>,
&'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a)
)
Runs a closure on the view identified by the given selector. Read more
fn focus_view(&mut self, &Selector<'_>) -> Result<(), ViewNotFound>
fn focus_view(&mut self, &Selector<'_>) -> Result<(), ViewNotFound>
Moves the focus to the view identified by the given selector. Read more
fn take_focus(&mut self, source: Direction) -> bool
fn take_focus(&mut self, source: Direction) -> bool
This view is offered focus. Will it take it? Read more
fn important_area(&self, view_size: XY<usize>) -> Rect
fn important_area(&self, view_size: XY<usize>) -> Rect
What part of the view is important and should be visible? Read more
Auto Trait Implementations
impl !RefUnwindSafe for CommandPalette
impl !Send for CommandPalette
impl !Sync for CommandPalette
impl Unpin for CommandPalette
impl !UnwindSafe for CommandPalette
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F) where
V: View,
F: FnMut(&mut V),
pub fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F) where
V: View,
F: FnMut(&mut V),
Runs a callback on all views identified by sel
. Read more
Runs a callback on the view identified by sel
. Read more
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R> where
V: View,
F: FnOnce(&mut V) -> R,
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R> where
V: View,
F: FnOnce(&mut V) -> R,
Convenient method to use call_on
with a view::Selector::Name
.
fn call_on_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R> where
V: View,
F: FnOnce(&mut V) -> R,
fn call_on_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R> where
V: View,
F: FnOnce(&mut V) -> R,
call_on_id
is being renamed to call_on_name
Same as call_on_name
.
Convenient method to find a view wrapped in an [NamedView
].
pub fn into_boxed_view(self) -> Box<dyn View + 'static, Global>
pub fn into_boxed_view(self) -> Box<dyn View + 'static, Global>
Returns a Box<View>
.
fn boxed(
self,
width: SizeConstraint,
height: SizeConstraint
) -> ResizedView<Self>
fn boxed(
self,
width: SizeConstraint,
height: SizeConstraint
) -> ResizedView<Self>
Use Resizable::resized()
instead.
Same as resized
fn resized(
self,
width: SizeConstraint,
height: SizeConstraint
) -> ResizedView<Self>
fn resized(
self,
width: SizeConstraint,
height: SizeConstraint
) -> ResizedView<Self>
Wraps self
in a ResizedView
with the given size constraints.
fn fixed_size<S>(self, size: S) -> ResizedView<Self> where
S: Into<XY<usize>>,
fn fixed_size<S>(self, size: S) -> ResizedView<Self> where
S: Into<XY<usize>>,
Wraps self
into a fixed-size ResizedView
.
fn fixed_width(self, width: usize) -> ResizedView<Self>
fn fixed_width(self, width: usize) -> ResizedView<Self>
Wraps self
into a fixed-width ResizedView
.
fn fixed_height(self, height: usize) -> ResizedView<Self>
fn fixed_height(self, height: usize) -> ResizedView<Self>
Wraps self
into a fixed-width ResizedView
.
fn full_screen(self) -> ResizedView<Self>
fn full_screen(self) -> ResizedView<Self>
Wraps self
into a full-screen ResizedView
.
fn full_width(self) -> ResizedView<Self>
fn full_width(self) -> ResizedView<Self>
Wraps self
into a full-width ResizedView
.
fn full_height(self) -> ResizedView<Self>
fn full_height(self) -> ResizedView<Self>
Wraps self
into a full-height ResizedView
.
Wraps self
into a limited-size ResizedView
.
Wraps self
into a limited-width ResizedView
.
fn max_height(self, max_height: usize) -> ResizedView<Self>
fn max_height(self, max_height: usize) -> ResizedView<Self>
Wraps self
into a limited-height ResizedView
.
Wraps self
into a ResizedView
at least sized size
.
Wraps self
in a ResizedView
at least min_width
wide.
fn min_height(self, min_height: usize) -> ResizedView<Self>
fn min_height(self, min_height: usize) -> ResizedView<Self>
Wraps self
in a ResizedView
at least min_height
tall.
fn scrollable(self) -> ScrollView<Self>
fn scrollable(self) -> ScrollView<Self>
Wraps self
in a ScrollView
.
Calls the given closure and return the result. Read more
Calls the given closure on self
.