Skip to content

Commit

Permalink
added old ass bootstrap icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Redhawk18 committed Sep 6, 2023
1 parent b62a96e commit 8620066
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
dark-light = "1.0.0"
iced = { version = "0.10.0", features = ["palette"]}
iced_aw = { version = "0.6", default-features = false, features = ["menu", "tab_bar"] }
iced_aw = { version = "0.6", default-features = false, features = ["icons", "menu", "tab_bar"] }
log = "0.4.18"
palette = "*"
pretty_env_logger = "0.5"
Expand Down
9 changes: 5 additions & 4 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ impl Application for Blaze {
theme: Theme::default(),
panes: Panes::default(),
},
font::load(iced_aw::graphics::icons::ICON_FONT_BYTES).map(Message::FontLoaded),
Command::batch(vec![
font::load(iced_aw::graphics::icons::ICON_FONT_BYTES).map(Message::FontLoaded),
]),
)
}

Expand Down Expand Up @@ -179,8 +181,7 @@ impl Application for Blaze {
}

Message::TabSelected(id) => {
self.get_mut_panestate()
.active_tab = id;
self.get_mut_panestate().active_tab = id;
}

Message::TabClosed(id) => {
Expand Down Expand Up @@ -209,7 +210,7 @@ impl Application for Blaze {
Message::PaneResized(ResizeEvent { split, ratio }) => {
self.panes.data.resize(&split, ratio);
}
Message::PaneClicked(pane) => {self.panes.active = pane}
Message::PaneClicked(pane) => self.panes.active = pane,
Message::PaneSplit(axis, pane) => {
if let Some((pane, _)) = self.panes.data.split(axis, &pane, PaneState::default()) {
self.panes.active = pane;
Expand Down
14 changes: 8 additions & 6 deletions src/gui/widgets/pane_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ use iced::{
widget::{
button,
pane_grid::{Axis, Content, Pane, PaneGrid, TitleBar},
row,
row, text,
},
Alignment, Length,
};
use iced_aw::graphics::icons::{Icon, icon_to_char};
use slotmap::{DefaultKey, SlotMap};

pub fn pane_grid<'a>(
Expand All @@ -21,7 +22,8 @@ pub fn pane_grid<'a>(
PaneGrid::new(&panes.data, |pane, state, _is_maximized| {
let active = panes.active == pane;

Content::new(tab_bar(state.active_tab, &state.get_data(map))) // currently this is fine if we want all gui elements to be tabs
// currently this is fine **if** we want all gui elements to be tabs
Content::new(tab_bar(state.active_tab, &state.get_data(map)))
.style(Container::PaneGridContent(active))
.title_bar(title_bar(active, pane))
})
Expand All @@ -37,13 +39,13 @@ fn title_bar(active: bool, pane: Pane) -> TitleBar<'static, Message, Renderer> {
row!().width(Length::Fill),
row!("What to put here?").width(Length::Fill),
row!(
button("|").on_press(Message::PaneSplit(Axis::Vertical, pane)),
button("--").on_press(Message::PaneSplit(Axis::Horizontal, pane)),
button("x").on_press(Message::PaneClosed(pane)),
button(text(icon_to_char(Icon::ChevronDoubleRight).to_string()).font(iced_aw::ICON_FONT)).on_press(Message::PaneSplit(Axis::Vertical, pane)),
button(text(icon_to_char(Icon::ChevronDoubleDown).to_string()).font(iced_aw::ICON_FONT)).on_press(Message::PaneSplit(Axis::Horizontal, pane)),
button(text(icon_to_char(Icon::X).to_string()).font(iced_aw::ICON_FONT)).on_press(Message::PaneClosed(pane)),
)
)
.align_items(Alignment::Center),
)
.style(Container::PaneGridTitleBar(active))
.padding(25) //adding padding makes a grabable section?
.padding(10) //adding padding makes a grabable section?
}

0 comments on commit 8620066

Please sign in to comment.