tui: Pass widget props to command handler
Signed-off-by: Erik Kundt <erik@zirkular.io>
This commit is contained in:
parent
8325eb69d7
commit
a0695005f5
|
|
@ -25,7 +25,7 @@ impl WidgetComponent for GlobalListener {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ impl WidgetComponent for Tabs {
|
||||||
State::One(StateValue::U16(self.state.selected))
|
State::One(StateValue::U16(self.state.selected))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, cmd: Cmd) -> CmdResult {
|
||||||
use tuirealm::command::Direction;
|
use tuirealm::command::Direction;
|
||||||
|
|
||||||
match cmd {
|
match cmd {
|
||||||
|
|
@ -147,7 +147,7 @@ impl WidgetComponent for Header {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -205,7 +205,7 @@ impl WidgetComponent for LabeledContainer {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, cmd: Cmd) -> CmdResult {
|
||||||
self.component.perform(cmd)
|
self.component.perform(cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ impl WidgetComponent for Shortcut {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +98,7 @@ impl WidgetComponent for Shortcuts {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ impl WidgetComponent for Label {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ impl WidgetComponent for Property {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +99,7 @@ impl WidgetComponent for PropertyList {
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, _cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||||
CmdResult::None
|
CmdResult::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ pub trait WidgetComponent {
|
||||||
|
|
||||||
fn state(&self) -> State;
|
fn state(&self) -> State;
|
||||||
|
|
||||||
fn perform(&mut self, cmd: Cmd) -> CmdResult;
|
fn perform(&mut self, properties: &Props, cmd: Cmd) -> CmdResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
@ -95,6 +95,6 @@ impl<T: WidgetComponent> MockComponent for Widget<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform(&mut self, cmd: Cmd) -> CmdResult {
|
fn perform(&mut self, cmd: Cmd) -> CmdResult {
|
||||||
self.component.perform(cmd)
|
self.component.perform(&self.properties, cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue