pub struct ScoreElement { /* private fields */ }Expand description
A graphical element representing an entire score
Implementations§
Source§impl ScoreElement
impl ScoreElement
Sourcepub fn new(score: &Score, config: RenderConfig) -> Self
pub fn new(score: &Score, config: RenderConfig) -> Self
Create a new score element from a Score
Sourcepub fn draw_to_canvas(&self, canvas: &mut Canvas, config: &RenderConfig)
pub fn draw_to_canvas(&self, canvas: &mut Canvas, config: &RenderConfig)
Draw the score to a canvas
Trait Implementations§
Source§impl Element for ScoreElement
impl Element for ScoreElement
Source§fn limits(&self, _ctx: &BasicContext<'_>) -> ViewLimits
fn limits(&self, _ctx: &BasicContext<'_>) -> ViewLimits
Returns the size limits of this element.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns this element as mutable Any for downcasting.
Source§fn stretch(&self) -> ViewStretch
fn stretch(&self) -> ViewStretch
Returns the stretch factor of this element.
Source§fn hit_test(
&self,
ctx: &Context<'_>,
p: Point,
leaf: bool,
control: bool,
) -> Option<&(dyn Element + 'static)>
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
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<'_>)
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 refresh(&self, ctx: &Context<'_>, outward: i32)
fn refresh(&self, ctx: &Context<'_>, outward: i32)
Refreshes the element, triggering a redraw.
Source§fn wants_control(&self) -> bool
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
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
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)
fn drag(&mut self, ctx: &Context<'_>, btn: MouseButton)
Handles mouse drag events.
Source§fn handle_drag(&self, _ctx: &Context<'_>, _btn: MouseButton)
fn handle_drag(&self, _ctx: &Context<'_>, _btn: MouseButton)
Handles mouse drag events (immutable version for use with Arc).
Source§fn handle_key(&self, _ctx: &Context<'_>, _k: KeyInfo) -> bool
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
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
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
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
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
fn handle_scroll(&self, _ctx: &Context<'_>, _dir: Point, _p: Point) -> bool
Handles scroll events (immutable version for use with Arc).
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Returns true if the element is enabled.
Source§fn wants_focus(&self) -> bool
fn wants_focus(&self) -> bool
Returns true if this element wants to receive focus.
Source§fn begin_focus(&mut self, req: FocusRequest)
fn begin_focus(&mut self, req: FocusRequest)
Called when the element begins receiving focus.
Source§fn focus(&self) -> Option<&(dyn Element + 'static)>
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)>
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)
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,
)
fn track_drop( &mut self, ctx: &Context<'_>, info: &DropInfo, status: CursorTracking, )
Handles drag tracking events.
Source§fn class_name(&self) -> &'static str
fn class_name(&self) -> &'static str
Returns the class name of this element (for debugging).
Auto Trait Implementations§
impl Freeze for ScoreElement
impl RefUnwindSafe for ScoreElement
impl Send for ScoreElement
impl Sync for ScoreElement
impl Unpin for ScoreElement
impl UnsafeUnpin for ScoreElement
impl UnwindSafe for ScoreElement
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
Mutably borrows from an owned value. Read more