Skip to main content

TimeframeToolbar

Struct TimeframeToolbar 

Source
pub struct TimeframeToolbar {
    pub state: TimeframeToolbarState,
    pub config: TimeframeToolbarConfig,
    /* private fields */
}
Expand description

Bottom panel component

Fields§

§state: TimeframeToolbarState

State

§config: TimeframeToolbarConfig

Configuration

Implementations§

Source§

impl TimeframeToolbar

Source

pub fn new() -> Self

Create new bottom panel

Source

pub fn with_config(config: TimeframeToolbarConfig) -> Self

Create with custom config

Source

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

Shows or hides control: TimeZone, Session and DividendAdjustment. The toolbar ignores the other controls.

Source

pub fn set_time_zones(&mut self, zones: Vec<TimezoneId>)

Offers zones in the time zone menu after UTC, exchange time and local time, in place of default_time_zones.

Source

pub fn show_timezone_menu( &mut self, ctx: &Context, current: &TimezoneMode, ) -> Option<TimezoneMode>

Shows the time zone menu beside the clock while timezone_menu_open is set, as a host does on TimeframeToolbarAction::OpenTimezoneMenu. Call it after show on each frame. The menu offers UTC, exchange time, local time and the zones of set_time_zones, as the chart settings do, and marks current, the chart’s chosen TimezoneMode. It returns the mode the user picks for the host to apply, and closes on a choice, Escape or a click elsewhere.

Source

pub fn show_session_menu(&mut self, ctx: &Context, chart: &mut Chart) -> bool

Shows the session menu beside the control while session_menu_open is set, as a host does on TimeframeToolbarAction::OpenSessionMenu. Call after show each frame. Offers regular and extended hours, plus overnight hours when the instrument has overnight windows or they are already chosen, as in the time axis menu. Instruments without session windows or date-specific hours keep the menu closed.

A choice applies to chart as one undo step, reloads history on the next chart frame when the hours change, updates the control and closes the menu. Escape and a click elsewhere also close it. Returns whether the chart’s hours changed.

Source

pub fn update_time(&mut self)

Update the current time display

Source

pub fn show(&mut self, ui: &mut Ui) -> TimeframeToolbarAction

Show bottom panel and return action

Source

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

Show bottom panel (without action)

Source

pub fn state(&self) -> &TimeframeToolbarState

Get the current state

Source

pub fn state_mut(&mut self) -> &mut TimeframeToolbarState

Get mutable state

Source

pub fn set_date_range(&mut self, range: DateRange)

Set the selected date range

Source

pub fn set_timezone(&mut self, timezone: String)

Set the timezone

Source

pub fn set_session(&mut self, session: SessionType)

Set the session type, such as SessionType::from_chart of the chart the toolbar serves

Source

pub fn toggle_dividends(&mut self)

Toggle dividend adjustment

Source

pub fn sync_from_app_state(&mut self, app_state: &dyn ChartAppState)

Sync from application state.

Trait Implementations§

Source§

impl Debug for TimeframeToolbar

Source§

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

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

impl Default for TimeframeToolbar

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> 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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.