Skip to main content

egui_charts/ui/top_toolbar/
actions.rs

1//! Actions emitted by the top toolbar.
2
3use super::components::layout_menu::LayoutAction;
4
5/// Actions emitted by the top toolbar
6#[derive(Debug, Clone, PartialEq)]
7#[non_exhaustive]
8pub enum TopToolbarAction {
9    /// A registered host button or dropdown item was chosen.
10    Host(String),
11    /// No action taken
12    None,
13    /// Open the command palette for actions, settings, drawing tools and studies.
14    OpenQuickSearch,
15    /// Open symbol search dialog
16    OpenSymbolSearch,
17    /// Open compare/add symbol dialog
18    OpenCompare,
19    /// Chart interval chosen in the interval menu, a preset or a custom interval
20    IntervalSelected(crate::model::Timeframe),
21    /// Chart style chosen in the chart-type menu.
22    ChartStyleSelected(crate::model::ChartType),
23    /// Open indicators dialog
24    OpenIndicators,
25    /// Ask the host to add the study registered under this name, chosen among
26    /// [`TopToolbar::favorite_indicators`](super::TopToolbar::favorite_indicators).
27    AddIndicator(String),
28    /// Ask the host to save the current indicator set.
29    SaveIndicatorTemplate,
30    /// Ask the host to apply the saved indicator set with this id.
31    ApplyIndicatorTemplate(String),
32    /// Create a new price alert
33    CreateAlert,
34    /// Toggle replay mode on/off
35    ToggleReplay,
36    /// Undo last action
37    Undo,
38    /// Redo last undone action
39    Redo,
40    /// Capture a chart screenshot
41    TakeScreenshot,
42    /// Capture the chart with [`Chart::export_png`](crate::Chart::export_png) and deliver the
43    /// decoded image to the clipboard, for example with `egui::Context::copy_image`.
44    CopyImage,
45    /// Capture the chart and open the rendered image in a new browser tab or native viewer.
46    /// The host owns the image URL or local file and its lifetime.
47    OpenImage,
48    /// Publish the captured image through the host's service and copy its returned URL.
49    /// Offered only with [`TopToolbarState::can_publish_image`](super::TopToolbarState::can_publish_image).
50    CopyImageLink,
51    /// Ask the host to publish the chart: capture it with
52    /// [`Chart::export_image`](crate::widget::Chart::export_image) and share or post the image
53    /// through the host's own service.
54    Publish,
55    /// Open or close the order ticket, for example with
56    /// [`Trading::toggle_ticket`](crate::ui::trading::Trading::toggle_ticket).
57    ToggleTrading,
58    /// Open settings dialog
59    OpenSettings,
60    /// Save current chart layout
61    Save,
62    /// Toggle fullscreen mode
63    ToggleFullscreen,
64    /// Toggle light/dark theme
65    ThemeToggle,
66    /// Layout management actions
67    Layout(LayoutAction),
68}