chrome: hook up toolbar actions
We will implement execution of these actions in the upcoming commits! stay tuned Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -34,6 +34,8 @@ impl Default for Chrome {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// When you click the toolbar button, these actions
|
||||||
|
/// are returned
|
||||||
pub enum ToolbarAction {
|
pub enum ToolbarAction {
|
||||||
Notifications,
|
Notifications,
|
||||||
Dave,
|
Dave,
|
||||||
@@ -255,29 +257,46 @@ impl Chrome {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn toolbar(&mut self, ui: &mut egui::Ui) -> Option<ToolbarAction> {
|
fn toolbar(&mut self, ui: &mut egui::Ui) -> Option<ToolbarAction> {
|
||||||
let _tab_res = egui_tabs::Tabs::new(3)
|
use egui_tabs::{TabColor, Tabs};
|
||||||
|
|
||||||
|
let rs = Tabs::new(3)
|
||||||
.selected(self.tab_selected)
|
.selected(self.tab_selected)
|
||||||
//.hover_bg(TabColor::none())
|
.hover_bg(TabColor::none())
|
||||||
//.selected_fg(TabColor::none())
|
.selected_fg(TabColor::none())
|
||||||
//.selected_bg(TabColor::none())
|
.selected_bg(TabColor::none())
|
||||||
//.hover_bg(TabColor::none())
|
|
||||||
//.hover_bg(TabColor::custom(egui::Color32::RED))
|
|
||||||
.height(Self::toolbar_height())
|
.height(Self::toolbar_height())
|
||||||
.layout(Layout::centered_and_justified(egui::Direction::TopDown))
|
.layout(Layout::centered_and_justified(egui::Direction::TopDown))
|
||||||
.show(ui, |ui, state| {
|
.show(ui, |ui, state| {
|
||||||
let index = state.index();
|
let index = state.index();
|
||||||
|
|
||||||
|
let mut action: Option<ToolbarAction> = None;
|
||||||
|
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
home_button(ui);
|
if home_button(ui).clicked() {
|
||||||
|
action = Some(ToolbarAction::Home);
|
||||||
|
}
|
||||||
} else if index == 1 {
|
} else if index == 1 {
|
||||||
if let Some(dave) = self.get_dave() {
|
if let Some(dave) = self.get_dave() {
|
||||||
let rect = dave_toolbar_rect(ui);
|
let rect = dave_toolbar_rect(ui);
|
||||||
let _dave_resp = dave_button(dave.avatar_mut(), ui, rect);
|
if dave_button(dave.avatar_mut(), ui, rect).clicked() {
|
||||||
|
action = Some(ToolbarAction::Dave);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if index == 2 {
|
} else if index == 2 {
|
||||||
notifications_button(ui);
|
if notifications_button(ui).clicked() {
|
||||||
|
action = Some(ToolbarAction::Notifications);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
action
|
||||||
|
})
|
||||||
|
.inner();
|
||||||
|
|
||||||
|
for maybe_r in rs {
|
||||||
|
if maybe_r.inner.is_some() {
|
||||||
|
return maybe_r.inner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user