mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-16 01:18:50 +00:00
better menu
This commit is contained in:
parent
c93454358f
commit
d2e8f5f818
1
babylonia-terminal-gui/Cargo.lock
generated
1
babylonia-terminal-gui/Cargo.lock
generated
@ -70,6 +70,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"babylonia-terminal-sdk",
|
||||
"glib-build-tools",
|
||||
"libadwaita",
|
||||
"log",
|
||||
"relm4",
|
||||
"relm4-components",
|
||||
|
||||
@ -10,6 +10,7 @@ log = "0.4.22"
|
||||
relm4-components = "0.9.1"
|
||||
wincompatlib = "0.7.5"
|
||||
relm4 = { version = "0.9.1", features = ["libadwaita"] }
|
||||
libadwaita = { version = "0.7.1", features = ["v1_4"] }
|
||||
|
||||
[build-dependencies]
|
||||
glib-build-tools = "0.20.0"
|
||||
|
||||
@ -3,6 +3,7 @@ use std::convert::identity;
|
||||
use crate::manager;
|
||||
use babylonia_terminal_sdk::game_state::GameState;
|
||||
|
||||
use log::debug;
|
||||
use relm4::{
|
||||
adw::{
|
||||
self,
|
||||
@ -21,6 +22,8 @@ use relm4::{
|
||||
view, Component, ComponentController, Controller, RelmApp, RelmWidgetExt, WorkerController,
|
||||
};
|
||||
|
||||
use libadwaita::OverlaySplitView;
|
||||
|
||||
use crate::APP_RESOURCE_PATH;
|
||||
|
||||
pub fn run(app: RelmApp<MainWindowMsg>) {
|
||||
@ -68,36 +71,10 @@ impl SimpleAsyncComponent for MainWindow {
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
||||
adw::Flap {
|
||||
OverlaySplitView {
|
||||
#[watch]
|
||||
set_reveal_flap: model.is_menu_visible,
|
||||
set_margin_all: 0,
|
||||
set_fold_policy: adw::FlapFoldPolicy::Auto,
|
||||
|
||||
#[wrap(Some)]
|
||||
set_flap = >k::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
||||
gtk::ListBox {
|
||||
set_width_request: 250,
|
||||
set_margin_all: 10,
|
||||
|
||||
append = >k::Button {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Item 1",
|
||||
},
|
||||
|
||||
append = >k::Button {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Item 2"
|
||||
},
|
||||
|
||||
append = >k::Button {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Item 3",
|
||||
},
|
||||
},
|
||||
},
|
||||
set_show_sidebar: model.is_menu_visible,
|
||||
set_collapsed: true,
|
||||
|
||||
#[wrap(Some)]
|
||||
set_content = >k::Box {
|
||||
@ -105,7 +82,7 @@ impl SimpleAsyncComponent for MainWindow {
|
||||
|
||||
adw::HeaderBar {
|
||||
pack_start = >k::Button {
|
||||
set_label: "Menu",
|
||||
set_icon_name: "open-menu-symbolic",
|
||||
connect_clicked => MainWindowMsg::ToggleMenuVisibility,
|
||||
},
|
||||
},
|
||||
@ -149,8 +126,46 @@ impl SimpleAsyncComponent for MainWindow {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
#[wrap(Some)]
|
||||
set_sidebar = >k::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
||||
gtk::ListBox {
|
||||
set_width_request: 250,
|
||||
set_margin_all: 10,
|
||||
|
||||
append = >k::Button {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Item 1",
|
||||
},
|
||||
|
||||
append = >k::Button {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Item 2"
|
||||
},
|
||||
|
||||
append = >k::Button {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Item 3",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
//adw::Flap {
|
||||
// #[watch]
|
||||
// set_reveal_flap: model.is_menu_visible,
|
||||
// set_margin_all: 0,
|
||||
// set_fold_policy: adw::FlapFoldPolicy::Auto,
|
||||
|
||||
// #[wrap(Some)]
|
||||
// set_flap =
|
||||
|
||||
// #[wrap(Some)]
|
||||
// set_content =
|
||||
//},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
babylonia-terminal/Cargo.lock
generated
1
babylonia-terminal/Cargo.lock
generated
@ -148,6 +148,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"babylonia-terminal-sdk",
|
||||
"glib-build-tools",
|
||||
"libadwaita",
|
||||
"log",
|
||||
"relm4",
|
||||
"relm4-components",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user