Skip to content

Commit

Permalink
Replace images with icons
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxxcode committed Jan 13, 2024
1 parent 45f29e0 commit c7f845d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
3 changes: 0 additions & 3 deletions examples/sandbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ edition = "2021"
[dependencies]
eframe = { version = "0.25.0", default-features = false, features = ["glow"] }
egui-file-explorer = { version = "0.1.0", path = "../../"}

# Enable image loading
egui_extras = { version = "0.25.0", default-features = false, features = ["all_loaders"]}
4 changes: 1 addition & 3 deletions examples/sandbox/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ struct MyApp {
}

impl MyApp {
pub fn new(cc: &eframe::CreationContext) -> Self {
egui_extras::install_image_loaders(&cc.egui_ctx);

pub fn new(_cc: &eframe::CreationContext) -> Self {
Self {
file_explorer: FileExplorer::new()
}
Expand Down
13 changes: 6 additions & 7 deletions src/file_explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,18 @@ impl FileExplorer {

ui.label("User:");

let folder_icon = egui::include_image!("../data/folder_icon.png");

// NOTE: These are currently only hardcoded test values!
// TODO: Align button text to the left!
ui.add_sized(egui::Vec2::new(ui.available_width(), 0.0),
egui::Button::image_and_text(folder_icon.clone(), "Desktop"));
egui::Button::new("🗀 Desktop"));
ui.add_sized(egui::Vec2::new(ui.available_width(), 0.0),
egui::Button::image_and_text(folder_icon.clone(), "Documents"));
egui::Button::new("🗀 Documents"));
ui.add_sized(egui::Vec2::new(ui.available_width(), 0.0),
egui::Button::image_and_text(folder_icon.clone(), "Downloads"));
egui::Button::new("🗀 Downloads"));
ui.add_sized(egui::Vec2::new(ui.available_width(), 0.0),
egui::Button::image_and_text(folder_icon.clone(), "Music"));
egui::Button::new("🗀 Music"));
ui.add_sized(egui::Vec2::new(ui.available_width(), 0.0),
egui::Button::image_and_text(folder_icon.clone(), "Pictures"));
egui::Button::new("🗀 Pictures"));
}

fn update_bottom_panel(&mut self, ui: &mut egui::Ui) {
Expand Down

0 comments on commit c7f845d

Please sign in to comment.