gui: navigation base

This commit is contained in:
ardocrat 2023-04-27 01:28:55 +03:00
parent 61f02c338d
commit e02fc5c811
19 changed files with 460 additions and 264 deletions

View file

@ -1,5 +1,5 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Main" parent="Theme.AppCompat.Light.NoActionBar">
<style name="Theme.Main" parent="Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">@color/yellow</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>

BIN
fonts/material.otf Normal file

Binary file not shown.

View file

@ -1 +1 @@
wallets: Wallets
accounts: Accounts

View file

@ -1 +1 @@
wallets: Кошельки
accounts: Аккаунты

View file

@ -12,12 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use eframe::{AppCreator, NativeOptions, Renderer, Theme};
use log::LevelFilter::{Debug, Info, Trace, Warn};
#[cfg(target_os = "android")]
use winit::platform::android::activity::AndroidApp;
use eframe::{AppCreator, NativeOptions, Renderer};
use crate::gui::PlatformApp;
#[allow(dead_code)]
@ -31,7 +30,9 @@ unsafe fn android_main(app: AndroidApp) {
android_logger::Config::default().with_max_level(Info).with_tag("grim"),
);
}
let _app = app.clone();
use crate::gui::platform::Android;
let platform = Android::new(app.clone());
use winit::platform::android::EventLoopBuilderExtAndroid;
let mut options = NativeOptions::default();
@ -39,9 +40,8 @@ unsafe fn android_main(app: AndroidApp) {
builder.with_android_app(app);
}));
use crate::gui::platform::Android;
start(options, Box::new(|_cc| Box::new(
PlatformApp::new(_cc, Android::new(_app))
PlatformApp::new(_cc, platform)
)));
}
@ -54,14 +54,19 @@ fn main() {
.parse_default_env()
.init();
use crate::gui::platform::Desktop;
let options = NativeOptions::default();
start(options, Box::new(|_cc| Box::new(App::new(_cc))));
start(options, Box::new(|_cc| Box::new(
PlatformApp::new(_cc, Desktop::default())
)));
}
fn start(mut options: NativeOptions, app_creator: AppCreator) {
options.default_theme = Theme::Light;
options.renderer = Renderer::Wgpu;
setup_i18n();
options.renderer = Renderer::Wgpu;
eframe::run_native("Grim", options, app_creator);
}

View file

@ -12,79 +12,41 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::any::Any;
use std::collections::BTreeSet;
use eframe::emath::Align;
use eframe::epaint::FontFamily;
use std::cmp::min;
use eframe::Frame;
use egui::{Color32, Context, Direction, Id, Layout, RichText, Rounding, Sense, Separator, Stroke, Widget};
use egui::{Color32, Context, Stroke};
use egui::epaint::Shadow;
use egui::panel::PanelState;
use egui::style::Margin;
use egui_extras::Size;
use egui_extras::StripBuilder;
use wgpu::Color;
use crate::gui::*;
use crate::gui::screens::{Screen};
use crate::gui::COLOR_YELLOW;
use crate::gui::platform::PlatformCallbacks;
use crate::gui::screens::{Root, Screen};
pub struct PlatformApp<Platform> {
pub(crate) screens: Screens,
pub(crate) app: App,
pub(crate) platform: Platform,
}
pub struct Screens {
screens: Vec<Box<dyn Screen>>,
navigation: BTreeSet<String>,
network_screen_open: bool,
pub struct App {
root: Root,
network_panel_open: bool
}
impl Default for Screens {
impl Default for App {
fn default() -> Self {
Self::from_screens(vec![
Box::new(screens::Wallets::default())
])
Self {
root: Root::default(),
network_panel_open: false
}
}
}
impl Screens {
fn from_screens(screens: Vec<Box<dyn Screen>>) -> Self {
let current = screens[0].name().to_owned();
let mut navigation = BTreeSet::new();
navigation.insert(current);
Self { screens, navigation, network_screen_open: false }
}
fn show_screens(&mut self, ui: &mut egui::Ui, frame: &mut Frame, cb: &dyn PlatformCallbacks) {
let Self { screens, navigation, .. } = self;
for screen in screens {
let id = screen.name();
let show = navigation.contains(id.as_str());
if show {
screen.show(ui, frame, cb);
}
Self::set_show_screen(navigation, id, show);
}
}
fn set_show_screen(navigation: &mut BTreeSet<String>, key: String, show: bool) {
if show {
if !navigation.contains(key.as_str()) {
navigation.insert(key.to_owned());
}
} else {
navigation.remove(key.as_str());
}
}
fn current_screen_title(&self) -> &String {
self.navigation.last().unwrap()
}
fn menu_is_open(&mut self, frame: &mut Frame) -> bool {
return self.network_screen_open;
}
impl App {
pub fn ui(&mut self, ctx: &Context, frame: &mut Frame, cb: &dyn PlatformCallbacks) {
let network_panel_open = self.network_panel_open || dual_panel_available(frame);
egui::CentralPanel::default()
.frame(egui::Frame {
inner_margin: Margin::same(0.0),
@ -93,18 +55,13 @@ impl Screens {
.. Default::default()
})
.show(ctx, |ui| {
let menu_open = self.menu_is_open(frame);
let bg_stroke_default = ui.style().visuals.widgets.noninteractive.bg_stroke;
ui.style_mut().visuals.widgets.noninteractive.bg_stroke = Stroke::NONE;
ui.style_mut().visuals.widgets.active.bg_stroke = Stroke::NONE;
egui::SidePanel::left("menu_panel")
egui::SidePanel::left("network_panel")
.resizable(false)
.exact_width(if !is_landscape(frame) {
frame.info().window_info.size.x - 58.0
.exact_width(if dual_panel_available(frame) {
min(frame.info().window_info.size.x as i64, 500) as f32
} else {
frame.info().window_info.size.y - 58.0
frame.info().window_info.size.x
})
.frame(egui::Frame {
inner_margin: Margin::same(0.0),
@ -114,8 +71,8 @@ impl Screens {
fill: COLOR_YELLOW,
stroke: Stroke::NONE,
})
.show_animated_inside(ui, menu_open, |ui| {
//TODO: Menu content
.show_animated_inside(ui, network_panel_open, |ui| {
//TODO: Network content
ui.vertical_centered(|ui| {
ui.heading("🖧 Node");
});
@ -123,113 +80,21 @@ impl Screens {
ui.separator();
});
egui::TopBottomPanel::top("title_panel")
.resizable(false)
// .default_height(120.0)
.frame(egui::Frame {
fill: COLOR_YELLOW,
inner_margin: Margin::same(0.0),
outer_margin: Margin::same(0.0),
rounding: Default::default(),
..Default::default()
})
.show_inside(ui, |ui| {
StripBuilder::new(ui)
.size(Size::exact(58.0))
.vertical(|mut strip| {
strip.strip(|builder| {
builder
.size(Size::exact(58.0))
.size(Size::remainder())
.size(Size::exact(58.0))
.horizontal(|mut strip| {
strip.cell(|ui| {
ui.centered_and_justified(|ui| {
let b = egui::widgets::Button::new(
RichText::new(if !menu_open {
SYM_NETWORK
} else {
if is_landscape(frame) {
SYM_MENU
} else {
SYM_WALLET
}
}).size(24.0)
).fill(Color32::TRANSPARENT)
.ui(ui)
.interact(Sense::click_and_drag());
if b.drag_released() || b.clicked() {
self.network_screen_open = !menu_open
};
});
});
if !menu_open || is_landscape(frame) {
strip.strip(|builder| {
builder
.size(Size::remainder())
.vertical(|mut strip| {
strip.cell(|ui| {
ui.centered_and_justified(|ui| {
ui.label(RichText::new(self.current_screen_title()
.to_uppercase())
.size(20.0)
.color(Color32::BLACK)
);
});
});
});
});
strip.cell(|ui| {
ui.centered_and_justified(|ui| {
let b = egui::widgets::Button::new(
RichText::new(SYM_ADD).size(24.0)
).fill(Color32::TRANSPARENT).ui(ui).interact(Sense::click_and_drag());
if b.drag_released() || b.clicked() {
//TODO: Add wallet
//self.menu_open = !menu_open
};
});
});
}
});
});
});
});
// ctx.style_mut().visuals.widgets.noninteractive.bg_stroke = bg_stroke_default;
// egui::SidePanel::right("screens_content")
// .resizable(false)
// .min_width(frame.info().window_info.size.x)
// .frame(egui::Frame {
// inner_margin: Margin::same(3.0),
// outer_margin: Margin::same(0.0),
// rounding: Default::default(),
// shadow: Shadow::NONE,
// fill: Color32::KHAKI,
// stroke: Stroke::NONE,
// })
// .show_inside(ui, |ui| {
// self.show_screens(ui, frame, cb);
// });
if !menu_open || is_landscape(frame) {
egui::CentralPanel::default().frame(egui::containers::Frame {
inner_margin: Margin::same(3.0),
fill: Color32::from_gray(30),
stroke: Stroke::new(1.0, Color32::from_gray(5)),
..Default::default()
})
.show_inside(ui, |ui| {
self.show_screens(ui, frame, cb);
});
}
}).show_inside(ui, |ui| {
self.root.show(ui, None, cb);
});
});
}
}
pub fn dual_panel_available(frame: &mut Frame) -> bool {
is_landscape(frame) && frame.info().window_info.size.x > 500.0
}
pub fn is_landscape(frame: &mut Frame) -> bool {
return frame.info().window_info.size.x > frame.info().window_info.size.y
}

View file

@ -12,15 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
mod app;
pub use app::PlatformApp;
pub use app::Screens;
pub use app::App;
pub use app::is_landscape;
pub use app::PlatformApp;
pub mod platform;
pub mod screens;
pub mod nav;
pub mod views;
mod app;
pub const COLOR_YELLOW: egui::Color32 = egui::Color32::from_rgb(254, 241, 2);
@ -28,12 +29,6 @@ pub const SYM_ARROW_BACK: &str = "⇦";
pub const SYM_ARROW_FORWARD: &str = "";
pub const SYM_ADD: &str = "";
pub const SYM_MENU: &str = "";
pub const SYM_WALLET: &str = "💼";
pub const SYM_ACCOUNTS: &str = "🗄";
pub const SYM_NETWORK: &str = "🖧";
pub trait PlatformCallbacks {
fn show_keyboard(&mut self);
fn hide_keyboard(&mut self);
fn copy_string_to_buffer(&mut self, data: String);
fn get_string_from_buffer(&mut self) -> String;
}

View file

@ -12,9 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use egui::Context;
use winit::platform::android::activity::AndroidApp;
use crate::gui::{PlatformApp, PlatformCallbacks, Screens};
use crate::gui::{App, PlatformApp};
use crate::gui::platform::PlatformCallbacks;
#[derive(Clone)]
pub struct Android {
@ -43,20 +45,41 @@ impl PlatformCallbacks for Android {
}
fn copy_string_to_buffer(&mut self, data: String) {
//TODO
}
fn get_string_from_buffer(&mut self) -> String {
//TODO
"".to_string()
}
}
//TODO
// pub trait PlatformSetup<T> {
// fn new(cc: &eframe::CreationContext<'_>, platform: T) -> Box<Self> {
// Self::setup_visuals(&cc.egui_ctx);
// return Self {
// app: App::default(),
// platform
// }
// }
// fn setup_visuals(ctx: &egui::Context);
//
// }
//
// impl PlatformSetup<Android> for PlatformApp<Android> {
// fn setup_visuals(ctx: &Context) {
//
// }
// }
impl PlatformApp<Android> {
pub fn new(cc: &eframe::CreationContext<'_>, platform: Android) -> Self {
Self::setup_visuals(&cc.egui_ctx);
Self::setup_fonts(&cc.egui_ctx);
Self {
screens: Screens::default(),
app: App::default(),
platform,
}
}
@ -155,7 +178,7 @@ impl eframe::App for PlatformApp<Android> {
self.platform.cutouts = Self::get_display_cutouts(&self.platform.android_app);
}
padding_panels(self, ctx);
self.screens.ui(ctx, frame, &self.platform);
self.app.ui(ctx, frame, &self.platform);
}
}

View file

@ -20,3 +20,9 @@ pub mod platform;
#[path = "desktop/mod.rs"]
pub mod app;
pub trait PlatformCallbacks {
fn show_keyboard(&mut self);
fn hide_keyboard(&mut self);
fn copy_string_to_buffer(&mut self, data: String);
fn get_string_from_buffer(&mut self) -> String;
}

View file

@ -0,0 +1,42 @@
// Copyright 2023 The Grim Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::gui::App;
use crate::gui::platform::PlatformCallbacks;
use crate::gui::screens::{Navigator, ScreenId};
pub struct Account {
}
impl Default for Account {
fn default() -> Self {
Self {
}
}
}
impl super::Screen for Account {
fn id(&self) -> ScreenId {
ScreenId::Account
}
fn show(&mut self,
ui: &mut egui::Ui,
nav: Option<&mut Navigator>,
cb: &dyn PlatformCallbacks) {
todo!()
}
}

View file

@ -0,0 +1,54 @@
// Copyright 2023 The Grim Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::gui::app::App;
use crate::gui::platform::PlatformCallbacks;
use crate::gui::screens::{Account, Navigator, Screen, ScreenId};
use crate::gui::views::title_panel::TitlePanel;
use crate::gui::views::View;
#[derive(Default)]
pub struct Accounts {
title: String,
}
impl Accounts {
pub(crate) fn new() -> Self {
Self {
title: t!("accounts"),
}
}
}
impl Screen for Accounts {
fn id(&self) -> ScreenId {
ScreenId::Accounts
}
fn show(&mut self,
ui: &mut egui::Ui,
nav: Option<&mut Navigator>,
cb: &dyn PlatformCallbacks) {
TitlePanel::default()
.title(self.title.to_owned())
.ui(ui);
if ui.button("test").clicked() {
nav.unwrap().to(ScreenId::Account)
};
//TODO: content
}
}

View file

@ -12,15 +12,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
mod wallets;
mod main;
pub use navigator::Navigator;
pub use root::Root;
pub use accounts::Accounts;
pub use account::Account;
pub use wallets::Wallets;
use crate::gui::PlatformCallbacks;
use crate::gui::App;
use crate::gui::platform::PlatformCallbacks;
mod navigator;
mod root;
mod accounts;
mod account;
// pub trait TitlePanelActions {
// fn left(&self) -> Option<PanelAction>;
// fn right(&self) -> Option<PanelAction>;
// }
#[derive(Ord, Eq, PartialOrd, PartialEq)]
pub enum ScreenId {
Root,
Accounts,
Account
}
pub trait Screen {
fn name(&self) -> String;
fn show(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks);
// fn option_on_panel(&mut self, ui: &mut egui::Ui);
fn id(&self) -> ScreenId;
fn show(
&mut self,
ui: &mut egui::Ui,
navigator: Option<&mut Navigator>,
cb: &dyn PlatformCallbacks
);
}

View file

@ -0,0 +1,54 @@
// Copyright 2023 The Grim Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::collections::BTreeSet;
use crate::gui::platform::PlatformCallbacks;
use crate::gui::screens::{Accounts, Screen, ScreenId};
pub struct Navigator {
stack: BTreeSet<ScreenId>,
screens: Vec<Box<dyn Screen>>,
}
impl Navigator {
pub fn new(screens: Vec<Box<dyn Screen>>) -> Self {
let mut stack = BTreeSet::new();
stack.insert(ScreenId::Accounts);
Self { stack, screens }
}
pub fn to(&mut self, id: ScreenId) {
self.stack.insert(id);
}
pub fn back(&mut self) {
self.stack.pop_last();
}
pub fn get_current_screen(&mut self) -> Option<&Box<dyn Screen>> {
let Self { stack, screens } = self;
let current = stack.last().unwrap();
let mut result = screens.get(0);
for screen in screens.iter() {
if screen.id() == *current {
result = Some(screen);
break;
}
}
return result;
}
}

43
src/gui/screens/root.rs Normal file
View file

@ -0,0 +1,43 @@
// Copyright 2023 The Grim Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use egui::Ui;
use crate::gui::platform::PlatformCallbacks;
use crate::gui::screens::{Account, Accounts, Navigator, Screen, ScreenId};
pub struct Root {
navigator: Navigator,
// screens: Vec<Box<dyn Screen>>,
}
impl Default for Root {
fn default() -> Self {
Self {
navigator: Navigator::new(vec![
Box::new(Accounts::default()),
Box::new(Account::default())
])
}
}
}
impl Screen for Root {
fn id(&self) -> ScreenId {
ScreenId::Root
}
fn show(&mut self, ui: &mut Ui, navigator: Option<&mut Navigator>, cb: &dyn PlatformCallbacks) {
let screen = self.navigator.get_current_screen();
}
}

View file

@ -1,51 +0,0 @@
// Copyright 2023 The Grim Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::ops::Deref;
use eframe::Frame;
use egui::{Color32, ScrollArea, Ui, Widget};
use crate::gui::app::Screens;
use crate::gui::{PlatformCallbacks};
pub struct Wallets {
}
impl Default for Wallets {
fn default() -> Self {
Self {
}
}
}
impl super::Screen for Wallets {
fn name(&self) -> String {
t!("wallets")
}
fn show(&mut self, ui: &mut Ui, frame: &mut Frame, cb: &dyn PlatformCallbacks) {
// ui.visuals_mut().widgets = Color32::TRANSPARENT;
ScrollArea::vertical()
.auto_shrink([false, true])
.show(ui, |ui| {
for item in 1..=4 {
ui.heading(format!("This is longest future Wallet #{}", item));
egui::Button::new("TEXT").shortcut_text("Shortcut").ui(ui);
ui.button("OK");
ui.button("Test");
}
});
}
}

View file

@ -11,7 +11,4 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pub struct Main {
}

View file

@ -12,10 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::collections::BTreeSet;
struct Navigation {
// navigation_stack: BTreeSet<ScreenMode>,
pub mod buttons;
pub mod title_panel;
pub trait View {
fn ui(&mut self, ui: &mut egui::Ui);
}

View file

@ -0,0 +1,142 @@
// Copyright 2023 The Grim Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use egui::{Color32, RichText, Sense, Stroke, Widget};
use egui::style::Margin;
use egui_extras::{Size, StripBuilder};
use crate::gui::COLOR_YELLOW;
use crate::gui::views::View;
pub struct PanelAction {
icon: Box<str>,
on_click: Box<dyn Fn()>
}
#[derive(Default)]
pub struct PanelActions {
left: Option<PanelAction>,
right: Option<PanelAction>
}
#[derive(Default)]
pub struct TitlePanel {
title: Option<String>,
actions: PanelActions
}
impl TitlePanel {
pub fn title(mut self, title: String) -> Self {
self.title = Some(title);
self
}
pub fn left_action(mut self, action: PanelAction) -> Self {
self.actions.left = Some(action);
self
}
pub fn right_action(mut self, action: PanelAction) -> Self {
self.actions.right = Some(action);
self
}
}
impl View for TitlePanel {
fn ui(&mut self, ui: &mut egui::Ui) {
// Disable stroke around panels
let panel_stroke_default = ui.style().visuals.widgets.noninteractive.bg_stroke;
ui.style_mut().visuals.widgets.noninteractive.bg_stroke = Stroke::NONE;
// Disable stroke around buttons on hover
let button_hover_stroke_default = ui.style().visuals.widgets.active.bg_stroke;
ui.style_mut().visuals.widgets.active.bg_stroke = Stroke::NONE;
let Self { actions, title } = self;
egui::TopBottomPanel::top("title_panel")
.resizable(false)
.frame(egui::Frame {
fill: COLOR_YELLOW,
inner_margin: Margin::same(0.0),
outer_margin: Margin::same(0.0),
rounding: Default::default(),
..Default::default()
})
.show_inside(ui, |ui| {
StripBuilder::new(ui)
.size(Size::exact(58.0))
.vertical(|mut strip| {
strip.strip(|builder| {
builder
.size(Size::exact(58.0))
.size(Size::remainder())
.size(Size::exact(58.0))
.horizontal(|mut strip| {
strip.cell(|ui| {
if actions.left.is_some() {
let action = actions.left.as_ref().unwrap();
ui.centered_and_justified(|ui| {
let b = egui::widgets::Button::new(
RichText::new(&action.icon.to_string()).size(24.0)
).fill(Color32::TRANSPARENT)
.ui(ui)
.interact(Sense::click_and_drag());
if b.drag_released() || b.clicked() {
(action.on_click)();
};
});
}
});
strip.strip(|builder| {
builder
.size(Size::remainder())
.vertical(|mut strip| {
strip.cell(|ui| {
if title.is_some() {
ui.centered_and_justified(|ui| {
ui.label(RichText::new(
title.as_ref().unwrap().to_uppercase()
).size(20.0).color(Color32::BLACK));
});
}
});
});
});
strip.cell(|ui| {
if actions.right.is_some() {
let action = actions.right.as_ref().unwrap();
ui.centered_and_justified(|ui| {
let b = egui::widgets::Button::new(
RichText::new(action.icon.to_string()).size(24.0)
).fill(Color32::TRANSPARENT)
.ui(ui).interact(Sense::click_and_drag());
if b.drag_released() || b.clicked() {
(action.on_click)();
};
});
}
});
});
});
});
});
// Enable stroke around panels
ui.style_mut().visuals.widgets.noninteractive.bg_stroke = panel_stroke_default;
// Enable stroke around buttons on hover
ui.style_mut().visuals.widgets.active.bg_stroke = button_hover_stroke_default;
}
}

View file

@ -29,7 +29,7 @@ pub fn start(chain_type: &ChainTypes) {
);
let config = node_config.clone().unwrap();
let mut server_config = config.members.as_ref().unwrap().server.clone();
let server_config = config.members.as_ref().unwrap().server.clone();
// Initialize our global chain_type, feature flags (NRD kernel support currently), accept_fee_base, and future_time_limit.
// These are read via global and not read from config beyond this point.