Skip to main content

ScoreElement

Struct ScoreElement 

Source
pub struct ScoreElement { /* private fields */ }
Expand description

A graphical element representing an entire score

Implementations§

Source§

impl ScoreElement

Source

pub fn new(score: &Score, config: RenderConfig) -> Self

Create a new score element from a Score

Source

pub fn width(&self) -> f32

Get the width

Source

pub fn height(&self) -> f32

Get the height

Source

pub fn draw_to_canvas(&self, canvas: &mut Canvas, config: &RenderConfig)

Draw the score to a canvas

Trait Implementations§

Source§

impl Element for ScoreElement

Source§

fn limits(&self, _ctx: &BasicContext<'_>) -> ViewLimits

Returns the size limits of this element.
Source§

fn draw(&self, _ctx: &Context<'_>)

Draws this element.
Source§

fn as_any(&self) -> &dyn Any

Returns this element as Any for downcasting.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Returns this element as mutable Any for downcasting.
Source§

fn stretch(&self) -> ViewStretch

Returns the stretch factor of this element.
Source§

fn span(&self) -> u32

Returns the span (for grid layouts).
Source§

fn hit_test( &self, ctx: &Context<'_>, p: Point, leaf: bool, control: bool, ) -> Option<&(dyn Element + 'static)>

Performs hit testing to find the element at the given point. Read more
Source§

fn contains(&self, ctx: &Context<'_>, p: Point) -> bool

Returns true if the element contains the given point (within current bounds).
Source§

fn draw_overlay(&self, _ctx: &Context<'_>)

Draws transient overlay content (e.g. an expanded dropdown/popup) that must appear above every sibling, regardless of tree order. Containers call this in a second pass after all children have drawn their normal content, so overlays are never occluded by later siblings. Wrapper elements should forward this to their subject; the default is a no-op.
Source§

fn layout(&mut self, ctx: &Context<'_>)

Performs layout calculations.
Source§

fn refresh(&self, ctx: &Context<'_>, outward: i32)

Refreshes the element, triggering a redraw.
Source§

fn wants_control(&self) -> bool

Returns true if this element wants to receive control events.
Source§

fn click(&mut self, ctx: &Context<'_>, btn: MouseButton) -> bool

Handles mouse click events. Read more
Source§

fn handle_click(&self, _ctx: &Context<'_>, _btn: MouseButton) -> bool

Handles mouse click events (immutable version for use with Arc). Read more
Source§

fn drag(&mut self, ctx: &Context<'_>, btn: MouseButton)

Handles mouse drag events.
Source§

fn handle_drag(&self, _ctx: &Context<'_>, _btn: MouseButton)

Handles mouse drag events (immutable version for use with Arc).
Source§

fn key(&mut self, ctx: &Context<'_>, k: KeyInfo) -> bool

Handles keyboard events. Read more
Source§

fn handle_key(&self, _ctx: &Context<'_>, _k: KeyInfo) -> bool

Handles keyboard events (immutable version for use with Arc).
Source§

fn text(&mut self, ctx: &Context<'_>, info: TextInfo) -> bool

Handles text input events. Read more
Source§

fn handle_text(&self, _ctx: &Context<'_>, _info: TextInfo) -> bool

Handles text input events (immutable version for use with Arc).
Source§

fn cursor( &mut self, ctx: &Context<'_>, p: Point, status: CursorTracking, ) -> bool

Handles cursor (mouse move) events. Read more
Source§

fn scroll(&mut self, ctx: &Context<'_>, dir: Point, p: Point) -> bool

Handles scroll events. Read more
Source§

fn handle_scroll(&self, _ctx: &Context<'_>, _dir: Point, _p: Point) -> bool

Handles scroll events (immutable version for use with Arc).
Source§

fn enable(&mut self, state: bool)

Enables or disables the element.
Source§

fn is_enabled(&self) -> bool

Returns true if the element is enabled.
Source§

fn wants_focus(&self) -> bool

Returns true if this element wants to receive focus.
Source§

fn begin_focus(&mut self, req: FocusRequest)

Called when the element begins receiving focus.
Source§

fn end_focus(&mut self) -> bool

Called when the element loses focus. Read more
Source§

fn focus(&self) -> Option<&(dyn Element + 'static)>

Returns the currently focused child element, if any.
Source§

fn focus_mut(&mut self) -> Option<&mut (dyn Element + 'static)>

Returns a mutable reference to the currently focused child element, if any.
Source§

fn clear_focus(&self)

Clears focus from this element and all children (immutable version). This is used when clicking elsewhere to unfocus text inputs, etc.
Source§

fn track_drop( &mut self, ctx: &Context<'_>, info: &DropInfo, status: CursorTracking, )

Handles drag tracking events.
Source§

fn drop(&mut self, ctx: &Context<'_>, info: &DropInfo) -> bool

Handles drop events. Read more
Source§

fn class_name(&self) -> &'static str

Returns the class name of this element (for debugging).

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
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, 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.