Skip to main content

SourceItem

Struct SourceItem 

Source
pub struct SourceItem {
Show 16 fields pub id: usize, pub series_id: Option<SeriesId>, pub source_type: SourceType, pub tool_type: Option<DrawingToolType>, pub name: String, pub label: Option<String>, pub color: Color32, pub visible: bool, pub locked: bool, pub selected: bool, pub expanded: bool, pub z_index: i32, pub properties: Option<DrawingProperties>, pub parameters: Option<String>, pub panes: Vec<(PaneId, String)>, pub folder: Vec<String>,
}
Expand description

A source item in the object tree (indicator or drawing)

Represents a single row in the Object Tree with all its properties and state for UI rendering.

Fields§

§id: usize

Unique identifier

§series_id: Option<SeriesId>

Chart series id used by ObjectTreePanel::apply_to_chart; drawing rows use id.

§source_type: SourceType

Source type (indicator, drawing, template)

§tool_type: Option<DrawingToolType>

For drawings: the tool type

§name: String

Display name (e.g., “Trend Line”, “SMA(20)”)

§label: Option<String>

User-defined label (overrides name if set)

§color: Color32

Primary color for display

§visible: bool

Is visible on chart

§locked: bool

Is locked (drawings only - prevents modification)

§selected: bool

Is selected in the tree

§expanded: bool

Is expanded (shows properties)

§z_index: i32

Z-index for rendering order

§properties: Option<DrawingProperties>

Drawing properties (for drawings only)

§parameters: Option<String>

Indicator parameters string (for indicators, e.g., “20, close”)

§panes: Vec<(PaneId, String)>

Panes a drawing row’s Move to menu offers, by stable id and title; empty leaves it out.

§folder: Vec<String>

Drawing folder path, copied from crate::drawings::Drawing::folder. Non-drawing rows ignore this field.

Implementations§

Source§

impl SourceItem

Source

pub fn drawing(id: usize, tool_type: DrawingToolType, color: Color32) -> Self

Create a new drawing source

§Arguments
  • id - Unique identifier
  • tool_type - Type of drawing tool
  • color - Primary color
Source

pub fn indicator(id: usize, name: impl Into<String>, color: Color32) -> Self

Create a new indicator source

§Arguments
  • id - Unique identifier
  • name - Indicator name (e.g., “SMA”)
  • color - Line color
Source

pub fn indicator_with_params( id: usize, name: impl Into<String>, params: impl Into<String>, color: Color32, ) -> Self

Create a new indicator with parameters

§Arguments
  • id - Unique identifier
  • name - Indicator name (e.g., “SMA”)
  • params - Parameters string (e.g., “20, close”)
  • color - Line color
Source

pub fn template(id: usize, name: impl Into<String>) -> Self

Create a new template source

Source

pub fn data_source(id: usize, name: impl Into<String>) -> Self

Create a new data source (main chart symbol)

§Arguments
  • id - Unique identifier
  • name - Data source name (e.g., “BTCUSDT · 1H”)
Source

pub fn with_series_id(self, id: SeriesId) -> Self

Bind a data-source or indicator row to its chart series without overloading the tree’s ids.

Source

pub fn with_panes(self, chart: &Chart) -> Self

Offer the panes of chart other than the one drawing this row’s drawing as its Move to choices, applied with ObjectTreePanel::apply_to_chart.

Source

pub fn display_name(&self) -> &str

Get display name (label if set, otherwise name)

Source

pub fn full_display_name(&self) -> String

Get full display name including parameters

Source

pub fn with_label(self, label: impl Into<String>) -> Self

Set custom label

Source

pub fn with_z_index(self, z: i32) -> Self

Set z-index

Source

pub fn is_drawing(&self) -> bool

Check if this is a drawing

Source

pub fn is_indicator(&self) -> bool

Check if this is an indicator

Trait Implementations§

Source§

impl Clone for SourceItem

Source§

fn clone(&self) -> SourceItem

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 SourceItem

Source§

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

Formats the value using the given formatter. 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.