Add wip-dialog protocol to display ConfirmationDialogPanel
This commit is contained in:
parent
f33100cfa8
commit
218e2fde74
|
@ -24,6 +24,7 @@ fn bind_panel_impl(panel: Panel, protocol: Message, msg: Message) -> Box<dyn Pan
|
||||||
|
|
||||||
match protocol.as_str() {
|
match protocol.as_str() {
|
||||||
"tebibyte-media.desktop.music-player-controller" => MusicPlayerPanel::bind(panel, msg),
|
"tebibyte-media.desktop.music-player-controller" => MusicPlayerPanel::bind(panel, msg),
|
||||||
|
"wip-dialog" => ConfirmationDialogPanel::bind(panel, msg),
|
||||||
_ => MainMenuPanel::bind(panel, msg),
|
_ => MainMenuPanel::bind(panel, msg),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,15 +52,23 @@ impl PanelImpl for ConfirmationDialogPanel {
|
||||||
self.dialog.on_cursor_event(kind, at.into());
|
self.dialog.on_cursor_event(kind, at.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_resize(&mut self, _size: Vec2) {}
|
fn on_resize(&mut self, size: Vec2) {
|
||||||
|
self.dialog.resize(size);
|
||||||
|
}
|
||||||
|
|
||||||
fn on_message(&mut self, _msg: Message) {}
|
fn on_message(&mut self, _msg: Message) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfirmationDialogPanel {
|
impl ConfirmationDialogPanel {
|
||||||
pub fn bind(panel: Panel, msg: Message) -> Box<dyn PanelImpl> {
|
pub fn bind(panel: Panel, msg: Message) -> Box<dyn PanelImpl> {
|
||||||
let msg = msg.to_vec();
|
// let msg = msg.to_vec();
|
||||||
let info: DialogInfo = serde_json::from_slice(&msg).unwrap();
|
// let info: DialogInfo = serde_json::from_slice(&msg).unwrap();
|
||||||
|
|
||||||
|
let info = DialogInfo {
|
||||||
|
title: "Hello world!".to_string(),
|
||||||
|
content: "Testing, testing...".to_string(),
|
||||||
|
responses: vec![DialogResponse::Yes, DialogResponse::No],
|
||||||
|
};
|
||||||
|
|
||||||
use widgets::dialog::*;
|
use widgets::dialog::*;
|
||||||
let style = DialogStyle::default();
|
let style = DialogStyle::default();
|
||||||
|
|
Loading…
Reference in New Issue