Skip to main content

DrawingToolbar

Struct DrawingToolbar 

Source
pub struct DrawingToolbar {
    pub registry: DrawingToolRegistry,
    pub state: ToolbarState,
    pub config: DrawingToolbarConfig,
    /* private fields */
}
Expand description

Drawing toolbar - main UI component

Fields§

§registry: DrawingToolRegistry

Built-in availability for the bar, flyouts and shortcuts. Clone the chart manager’s registry here after changing it; hosts use its custom catalogue for their own picker.

§state: ToolbarState

Toolbar state (selected tool, favorites, recent, etc.)

§config: DrawingToolbarConfig

Configuration (width, spacing, colors, etc.)

Implementations§

Source§

impl DrawingToolbar

Source

pub fn show_floating( &mut self, ui: &mut Ui, position: Pos2, ) -> Option<DrawingToolType>

Render the floating strip of favourite drawing tools.

Self::show and Self::show_with_action already draw it beside the toolbar and return a tool picked on it; call this only to place the strip elsewhere, before them, as a second call in the same pass draws nothing.

The strip lists ToolbarState::favorites, so starring or unstarring a tool changes it at once, and it is hidden while there are none. position places it until it has been moved; afterwards ToolbarState::floating_pos holds its position. Its grip drags it, kept on screen, and its close button clears ToolbarState::floating_visible, as the favourites button of the toolbar does.

Source§

impl DrawingToolbar

Source

pub fn new() -> Self

Create a DrawingToolbar with default settings.

Source

pub fn with_config(self, config: DrawingToolbarConfig) -> Self

Create with custom configuration

Source

pub fn set_control_visible(&mut self, control: Control, visible: bool)

Shows or hides control: Trading (the hide positions and orders rows) and Templates (the standalone template name dialog). The toolbar ignores the other controls.

Source

pub fn sync_from_domain_state(&mut self, domain: &DrawingToolbarDomainState)

Copy the host’s drawing and cursor choices before Self::show_with_action.

Source

pub fn get_domain_state(&self) -> DrawingToolbarDomainState

Read the toolbar’s drawing and cursor choices for synchronization with the host.

Source

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

Select the tool if its registry entry is enabled.

Source

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

Record a tool in the recent selection list.

Source

pub fn clear_selection(&mut self)

Clear the toolbar’s selected tool.

Source

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

Toggle a tool’s membership in favorites.

Source

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

Whether the tool is marked as a favorite.

Source

pub fn toggle_magnet(&mut self)

Toggle the toolbar’s magnet setting.

Source

pub fn toggle_stay_in_drawing(&mut self)

Toggle whether the selected tool stays active after completing a drawing.

Source

pub fn show(&mut self, ui: &mut Ui) -> Option<DrawingToolType>

Render the toolbar as a side panel and return the selected tool if changed

Source

pub fn show_with_action(&mut self, ui: &mut Ui) -> DrawingToolbarAction

Render the toolbar and return the full action

Trait Implementations§

Source§

impl Clone for DrawingToolbar

Source§

fn clone(&self) -> DrawingToolbar

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 DrawingToolbar

Source§

fn default() -> DrawingToolbar

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.