pub struct DrawingToolbar {
pub registry: DrawingToolRegistry,
pub state: ToolbarState,
pub config: DrawingToolbarConfig,
/* private fields */
}Expand description
Drawing toolbar - main UI component
Fields§
§registry: DrawingToolRegistryBuilt-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: ToolbarStateToolbar state (selected tool, favorites, recent, etc.)
config: DrawingToolbarConfigConfiguration (width, spacing, colors, etc.)
Implementations§
Source§impl DrawingToolbar
impl DrawingToolbar
Sourcepub fn show_floating(
&mut self,
ui: &mut Ui,
position: Pos2,
) -> Option<DrawingToolType>
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
impl DrawingToolbar
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a DrawingToolbar with default settings.
Sourcepub fn with_config(self, config: DrawingToolbarConfig) -> Self
pub fn with_config(self, config: DrawingToolbarConfig) -> Self
Create with custom configuration
Sourcepub fn set_control_visible(&mut self, control: Control, visible: bool)
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.
Sourcepub fn sync_from_domain_state(&mut self, domain: &DrawingToolbarDomainState)
pub fn sync_from_domain_state(&mut self, domain: &DrawingToolbarDomainState)
Copy the host’s drawing and cursor choices before Self::show_with_action.
Sourcepub fn get_domain_state(&self) -> DrawingToolbarDomainState
pub fn get_domain_state(&self) -> DrawingToolbarDomainState
Read the toolbar’s drawing and cursor choices for synchronization with the host.
Sourcepub fn select_tool(&mut self, tool: DrawingToolType)
pub fn select_tool(&mut self, tool: DrawingToolType)
Select the tool if its registry entry is enabled.
Sourcepub fn add_to_recent(&mut self, tool: DrawingToolType)
pub fn add_to_recent(&mut self, tool: DrawingToolType)
Record a tool in the recent selection list.
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear the toolbar’s selected tool.
Sourcepub fn toggle_favorite(&mut self, tool: DrawingToolType)
pub fn toggle_favorite(&mut self, tool: DrawingToolType)
Toggle a tool’s membership in favorites.
Sourcepub fn is_favorite(&self, tool: &DrawingToolType) -> bool
pub fn is_favorite(&self, tool: &DrawingToolType) -> bool
Whether the tool is marked as a favorite.
Sourcepub fn toggle_magnet(&mut self)
pub fn toggle_magnet(&mut self)
Toggle the toolbar’s magnet setting.
Sourcepub fn toggle_stay_in_drawing(&mut self)
pub fn toggle_stay_in_drawing(&mut self)
Toggle whether the selected tool stays active after completing a drawing.
Sourcepub fn show(&mut self, ui: &mut Ui) -> Option<DrawingToolType>
pub fn show(&mut self, ui: &mut Ui) -> Option<DrawingToolType>
Render the toolbar as a side panel and return the selected tool if changed
Sourcepub fn show_with_action(&mut self, ui: &mut Ui) -> DrawingToolbarAction
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
impl Clone for DrawingToolbar
Source§fn clone(&self) -> DrawingToolbar
fn clone(&self) -> DrawingToolbar
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for DrawingToolbar
impl Default for DrawingToolbar
Source§fn default() -> DrawingToolbar
fn default() -> DrawingToolbar
Auto Trait Implementations§
impl !RefUnwindSafe for DrawingToolbar
impl !UnwindSafe for DrawingToolbar
impl Freeze for DrawingToolbar
impl Send for DrawingToolbar
impl Sync for DrawingToolbar
impl Unpin for DrawingToolbar
impl UnsafeUnpin for DrawingToolbar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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