Skip to main content

ToolbarState

Struct ToolbarState 

Source
pub struct ToolbarState {
Show 31 fields pub sel_tool: Option<DrawingToolType>, pub expanded: bool, pub expanded_category: Option<String>, pub favorites: Vec<DrawingToolType>, pub floating_visible: bool, pub floating_pos: Option<Pos2>, pub recent: VecDeque<DrawingToolType>, pub magnet_mode: bool, pub magnet_type: MagnetType, pub snap_to_indicators: bool, pub magnet_hint_dismissed: bool, pub stay_in_drawing_mode: bool, pub drawing_color: [u8; 4], pub show_color_picker: bool, pub category_last_tool: HashMap<String, DrawingToolType>, pub search_open: bool, pub search_query: String, pub glyph_picker: GlyphPicker, pub values_tooltip_on_long_press: bool, pub eraser_mode_enabled: bool, pub lock_all: bool, pub hide_drawings: bool, pub hide_indicators: bool, pub hide_positions: bool, pub hide_orders: bool, pub has_zoom_history: bool, pub zoom_mode_active: bool, pub current_cursor_type: CursorType, pub templates: Vec<DrawingTemplate>, pub show_template_name_input: bool, pub template_name_input: String,
}
Expand description

Drawing toolbar state

Fields§

§sel_tool: Option<DrawingToolType>

Currently selected tool

§expanded: bool

Whether the toolbar is expanded (shows names)

§expanded_category: Option<String>

Currently expanded category (for nested menus)

§favorites: Vec<DrawingToolType>

Favorite tools, in the order they were starred

§floating_visible: bool

Whether the floating strip of favorite tools is shown while there are favorites

§floating_pos: Option<Pos2>

Top-left corner of the floating strip, which the user can drag; None until it has been shown, when it starts beside the toolbar

§recent: VecDeque<DrawingToolType>

Recently used tools (max 5)

§magnet_mode: bool

Whether drawing anchors snap to nearby chart values and drawing points

§magnet_type: MagnetType

Type of magnet snapping when magnet mode is enabled

§snap_to_indicators: bool

Whether magnet targets include visible study plots; independent of its strength.

§magnet_hint_dismissed: bool

Whether the user dismissed the card that explains the magnet. Until then the card shows beside the magnet button each time the user switches snapping on from the toolbar. Keep it with the user’s settings, as UserSettings::magnet_hint_dismissed; set it to leave the card out.

§stay_in_drawing_mode: bool

Stay in drawing mode after placing tool

§drawing_color: [u8; 4]

Currently selected drawing color

§show_color_picker: bool

Whether to show the color picker popup

§category_last_tool: HashMap<String, DrawingToolType>

Last selected tool per category (remembers which tool was last used in each category)

§search_open: bool

Whether the tool search bar is open

§search_query: String

Current search query

§glyph_picker: GlyphPicker

Glyph picker search, size and session recents.

§values_tooltip_on_long_press: bool

Whether to show values tooltip on long press

§eraser_mode_enabled: bool

Whether eraser mode is currently active

§lock_all: bool

Whether all drawings are locked; the lock button shows it.

§hide_drawings: bool

Whether the Hide menu has hidden drawings; the menu shows a check on each hidden group.

§hide_indicators: bool

Whether the Hide menu has hidden indicators.

§hide_positions: bool

Whether the Hide menu has hidden positions.

§hide_orders: bool

Whether the Hide menu has hidden orders.

§has_zoom_history: bool

Whether zoom history exists (for showing/hiding Zoom Out button)

§zoom_mode_active: bool

Whether zoom-in mode is currently active (for button highlighting)

§current_cursor_type: CursorType

Current cursor type (Cross, Dot, Arrow) - Arrow is default

§templates: Vec<DrawingTemplate>

Cached drawing templates loaded from the API

§show_template_name_input: bool

Whether the template name input dialog is showing

§template_name_input: String

Current template name being entered

Implementations§

Source§

impl ToolbarState

Source

pub fn new() -> Self

Create new toolbar state with defaults

Source

pub fn select_tool(&mut self, tool: DrawingToolType)

Select a drawing tool and add to recent

Source

pub fn add_to_recent(&mut self, tool: DrawingToolType)

Add a tool to recent list

Source

pub fn clear_selection(&mut self)

Clear tool selection (cursor mode)

Source

pub fn toggle_favorite(&mut self, tool: DrawingToolType)

Toggle favorite status of a tool

Source

pub fn is_favorite(&self, tool: &DrawingToolType) -> bool

Check if tool is favorited

Source

pub fn toggle_magnet(&mut self)

Toggle magnet mode

Source

pub fn toggle_stay_in_drawing(&mut self)

Toggle stay-in-drawing mode

Source

pub fn sync_from( &mut self, active_tool: Option<DrawingToolType>, magnet_mode: bool, stay_in_drawing_mode: bool, eraser_mode: bool, drawing_color: [u8; 4], )

Sync toolbar state from external drawing state.

Trait Implementations§

Source§

impl Clone for ToolbarState

Source§

fn clone(&self) -> ToolbarState

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 Default for ToolbarState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.