Skip to main content

DrawingToolbarAction

Enum DrawingToolbarAction 

Source
#[non_exhaustive]
pub enum DrawingToolbarAction {
Show 29 variants None, SelectTool(DrawingToolType), SetCursorType(CursorType), ToggleMagnet, ToggleStayInDrawingMode, ClearAllDrawings, ColorChanged([u8; 4]), ToggleEraserMode, HideAllDrawings, HideAllIndicators, HideAllPoss, HideAllOrders, RemoveAllDrawings, RemoveAllIndicators, RemoveAllStudies, HideAll, RemoveDrawingsAndIndicators, SetMagnetType(MagnetType), SetSnapToIndicators(bool), ZoomIn, ZoomOut, ToggleValuesTooltip, LockAllDrawings, SaveTemplate { name: String, }, LoadTemplate { template_id: String, }, OpenTemplateMenu, ManageTemplates, InsertGlyph { icon_name: &'static str, size: f32, }, InsertEmoji { icon_name: &'static str, },
}
Expand description

Actions returned from toolbar interactions

§Examples

use egui_charts::ui::drawing_toolbar::DrawingToolbarAction;
use egui_charts::drawings::DrawingToolType;

let action = DrawingToolbarAction::SelectTool(DrawingToolType::TrendLine);
match action {
    DrawingToolbarAction::SelectTool(tool) => {
        println!("Selected tool: {:?}", tool);
    }
    _ => {}
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

No action taken

§

SelectTool(DrawingToolType)

A drawing tool was selected

§

SetCursorType(CursorType)

Set cursor type (Cross, Dot, Arrow, Magic)

§

ToggleMagnet

Magnet mode toggled, from a click on the magnet or its Off row

§

ToggleStayInDrawingMode

Stay-in-drawing mode toggled

§

ClearAllDrawings

Clear all drawings requested

§

ColorChanged([u8; 4])

Drawing color changed (RGBA)

§

ToggleEraserMode

Eraser mode toggled

§

HideAllDrawings

Hide all drawings

§

HideAllIndicators

Hide all indicators

§

HideAllPoss

Hide all positions

§

HideAllOrders

Hide all orders

§

RemoveAllDrawings

Remove all drawings

§

RemoveAllIndicators

Remove all indicators

§

RemoveAllStudies

Remove all studies (indicators + overlays)

§

HideAll

Hide drawings, indicators, positions and orders at once. A host applies it as it applies HideAllDrawings, HideAllIndicators, HideAllPoss and HideAllOrders with everything hidden, in one undo step.

§

RemoveDrawingsAndIndicators

Remove all drawings and all indicators at once. A host applies it as it applies RemoveAllDrawings and RemoveAllIndicators, in one undo step.

§

SetMagnetType(MagnetType)

Change magnet type (Weak/Strong)

§

SetSnapToIndicators(bool)

Include or exclude visible study plots from drawing magnet targets. Hosts set DrawingManagerOptions::snap_to_indicators to this value.

§

ZoomIn

Zoom in (save current state to history)

§

ZoomOut

Zoom out (restore previous state from history)

§

ToggleValuesTooltip

Toggle values tooltip on long press

§

LockAllDrawings

Lock all drawings

§

SaveTemplate

Save current drawing properties as a template

Fields

§name: String

Template name provided by the user

§

LoadTemplate

Load a previously saved drawing template

Fields

§template_id: String

Template ID to load

§

OpenTemplateMenu

Open the template name input.

§

ManageTemplates

Open the host’s drawing template catalog for loading and deletion.

§

InsertGlyph

Place a bundled icon, emoji or sticker at its independent pixel size.

Fields

§icon_name: &'static str

Bundled glyph id or Unicode emoji.

§size: f32

Size in logical pixels, saved as Drawing::font_size.

§

InsertEmoji

Legacy host intent for an emoji at the configured default size.

Fields

§icon_name: &'static str

The icon or emoji to place

Trait Implementations§

Source§

impl Clone for DrawingToolbarAction

Source§

fn clone(&self) -> DrawingToolbarAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DrawingToolbarAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DrawingToolbarAction

Source§

fn eq(&self, other: &DrawingToolbarAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DrawingToolbarAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.