Skip to main content

egui_charts/ui/drawing_toolbar/utilities/
favorites.rs

1//! Favourite tools strip button.
2//!
3//! Shows and hides the floating strip of starred drawing tools.
4
5use crate::icons::icons;
6use crate::ui::drawing_toolbar::components::draw_tool_button;
7use egui::Ui;
8
9/// Show/hide button for the favourite tools strip.
10pub struct FavoritesButton;
11
12impl FavoritesButton {
13    /// Render the button, selected while the strip is shown, and return whether it was clicked.
14    pub fn show(ui: &mut Ui, strip_shown: bool) -> bool {
15        let tooltip = if strip_shown {
16            "Hide favorite drawing tools"
17        } else {
18            "Show favorite drawing tools"
19        };
20        draw_tool_button(ui, &icons::STAR_EMPTY, tooltip, strip_shown).clicked()
21    }
22}