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: usizeUnique identifier
series_id: Option<SeriesId>Chart series id used by ObjectTreePanel::apply_to_chart; drawing rows use id.
source_type: SourceTypeSource type (indicator, drawing, template)
tool_type: Option<DrawingToolType>For drawings: the tool type
name: StringDisplay name (e.g., “Trend Line”, “SMA(20)”)
label: Option<String>User-defined label (overrides name if set)
color: Color32Primary color for display
visible: boolIs visible on chart
locked: boolIs locked (drawings only - prevents modification)
selected: boolIs selected in the tree
expanded: boolIs expanded (shows properties)
z_index: i32Z-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
impl SourceItem
Sourcepub fn drawing(id: usize, tool_type: DrawingToolType, color: Color32) -> Self
pub fn drawing(id: usize, tool_type: DrawingToolType, color: Color32) -> Self
Create a new drawing source
§Arguments
id- Unique identifiertool_type- Type of drawing toolcolor- Primary color
Sourcepub fn indicator(id: usize, name: impl Into<String>, color: Color32) -> Self
pub fn indicator(id: usize, name: impl Into<String>, color: Color32) -> Self
Create a new indicator source
§Arguments
id- Unique identifiername- Indicator name (e.g., “SMA”)color- Line color
Sourcepub fn indicator_with_params(
id: usize,
name: impl Into<String>,
params: impl Into<String>,
color: Color32,
) -> Self
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 identifiername- Indicator name (e.g., “SMA”)params- Parameters string (e.g., “20, close”)color- Line color
Sourcepub fn data_source(id: usize, name: impl Into<String>) -> Self
pub fn data_source(id: usize, name: impl Into<String>) -> Self
Create a new data source (main chart symbol)
§Arguments
id- Unique identifiername- Data source name (e.g., “BTCUSDT · 1H”)
Sourcepub fn with_series_id(self, id: SeriesId) -> Self
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.
Sourcepub fn with_panes(self, chart: &Chart) -> Self
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.
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Get display name (label if set, otherwise name)
Sourcepub fn full_display_name(&self) -> String
pub fn full_display_name(&self) -> String
Get full display name including parameters
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set custom label
Sourcepub fn with_z_index(self, z: i32) -> Self
pub fn with_z_index(self, z: i32) -> Self
Set z-index
Sourcepub fn is_drawing(&self) -> bool
pub fn is_drawing(&self) -> bool
Check if this is a drawing
Sourcepub fn is_indicator(&self) -> bool
pub fn is_indicator(&self) -> bool
Check if this is an indicator
Trait Implementations§
Source§impl Clone for SourceItem
impl Clone for SourceItem
Source§fn clone(&self) -> SourceItem
fn clone(&self) -> SourceItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SourceItem
impl RefUnwindSafe for SourceItem
impl Send for SourceItem
impl Sync for SourceItem
impl Unpin for SourceItem
impl UnsafeUnpin for SourceItem
impl UnwindSafe for SourceItem
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