Struct ControlBar
pub struct ControlBar { /* private fields */ }Expand description
The floating bar of controls over media (a camera’s capture controls, a
player’s transport): one floating Panel shaped to a row of Regular icon
buttons, control_inset inside it so the buttons’ corners run
concentric with the panel’s, s1 between them. It owns the panel, the
gaps, the hover and press faces and the hit rects; the host says which
controls stand in it and where, and acts on the index it reports.
Implementations§
§impl ControlBar
impl ControlBar
pub fn new() -> ControlBar
pub fn bottom_centre(area: Rect, count: usize, theme: &Theme) -> Rect
pub fn bottom_centre(area: Rect, count: usize, theme: &Theme) -> Rect
Where a bar of count controls stands in area: centred, one
content gutter above its bottom edge.
pub fn paint(
&mut self,
scene: &mut Scene,
transform: Affine,
text: &mut TextRenderer,
theme: &Theme,
rect: Rect,
controls: &[BarControl<'_>],
)
pub fn paint( &mut self, scene: &mut Scene, transform: Affine, text: &mut TextRenderer, theme: &Theme, rect: Rect, controls: &[BarControl<'_>], )
Paint the bar with controls at rect (from Self::size or
Self::bottom_centre), and keep their hit rects.
pub fn control_rect(&self, index: usize) -> Option<Rect>
pub fn control_rect(&self, index: usize) -> Option<Rect>
Control index’s rect at the last paint.
pub fn contains(&self, point: Point) -> bool
pub fn contains(&self, point: Point) -> bool
Whether point is on the bar (a press there is the bar’s).
pub fn handle(
&mut self,
event: &WindowEvent,
scale_factor: f64,
) -> Option<usize>
pub fn handle( &mut self, event: &WindowEvent, scale_factor: f64, ) -> Option<usize>
Route event; returns the control a click activated. A press on
the bar but between controls is still the bar’s: check
Self::contains to swallow it.
Trait Implementations§
§impl Clone for ControlBar
impl Clone for ControlBar
§fn clone(&self) -> ControlBar
fn clone(&self) -> ControlBar
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ControlBar
impl Debug for ControlBar
§impl Default for ControlBar
impl Default for ControlBar
§fn default() -> ControlBar
fn default() -> ControlBar
Auto Trait Implementations§
impl Freeze for ControlBar
impl RefUnwindSafe for ControlBar
impl Send for ControlBar
impl Sync for ControlBar
impl Unpin for ControlBar
impl UnsafeUnpin for ControlBar
impl UnwindSafe for ControlBar
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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