pub struct TheCanvas {Show 13 fields
pub uuid: Uuid,
pub limiter: TheSizeLimiter,
pub offset: Vec2<i32>,
pub dim: TheDim,
pub root: bool,
pub top_is_expanding: bool,
pub bottom_is_expanding: bool,
pub buffer: TheRGBABuffer,
pub left: Option<Box<TheCanvas>>,
pub top: Option<Box<TheCanvas>>,
pub right: Option<Box<TheCanvas>>,
pub bottom: Option<Box<TheCanvas>>,
pub center: Option<Box<TheCanvas>>,
/* private fields */
}Fields§
§uuid: Uuid§limiter: TheSizeLimiter§offset: Vec2<i32>The relative offset to the parent canvas
dim: TheDim§root: bool§top_is_expanding: bool§bottom_is_expanding: bool§buffer: TheRGBABuffer§left: Option<Box<TheCanvas>>§top: Option<Box<TheCanvas>>§right: Option<Box<TheCanvas>>§bottom: Option<Box<TheCanvas>>§center: Option<Box<TheCanvas>>Implementations§
Source§impl TheCanvas
TheCanvas divides a screen dimension into 4 possible sub-spaces for its border while containing a set of widgets for its center.
impl TheCanvas
TheCanvas divides a screen dimension into 4 possible sub-spaces for its border while containing a set of widgets for its center.
pub fn new() -> TheCanvas
Sourcepub fn set_dim(&mut self, dim: TheDim, ctx: &mut TheContext)
pub fn set_dim(&mut self, dim: TheDim, ctx: &mut TheContext)
Set the dimension of the canvas
Sourcepub fn limiter_mut(&mut self) -> &mut TheSizeLimiter
pub fn limiter_mut(&mut self) -> &mut TheSizeLimiter
Returns a mutable reference to the limiter of the widget.
Sourcepub fn set_widget<T>(&mut self, widget: T)where
T: TheWidget + 'static,
pub fn set_widget<T>(&mut self, widget: T)where
T: TheWidget + 'static,
Sets the widget.
Sourcepub fn set_layout<T>(&mut self, layout: T)where
T: TheLayout + 'static,
pub fn set_layout<T>(&mut self, layout: T)where
T: TheLayout + 'static,
Sets the layout.
Sourcepub fn set_bottom(&mut self, canvas: TheCanvas)
pub fn set_bottom(&mut self, canvas: TheCanvas)
Sets the canvas to the bottom of this canvas.
Sourcepub fn set_center(&mut self, canvas: TheCanvas)
pub fn set_center(&mut self, canvas: TheCanvas)
Sets the canvas in the center of this canvas.
Sourcepub fn resize(&mut self, width: i32, height: i32, ctx: &mut TheContext) -> bool
pub fn resize(&mut self, width: i32, height: i32, ctx: &mut TheContext) -> bool
Resize the canvas if needed
Sourcepub fn buffer(&mut self) -> &TheRGBABuffer
pub fn buffer(&mut self) -> &TheRGBABuffer
Returns a reference to the underlying buffer
Sourcepub fn get_canvas(&mut self, uuid: Uuid) -> Option<&mut TheCanvas>
pub fn get_canvas(&mut self, uuid: Uuid) -> Option<&mut TheCanvas>
Returns the canvas of the given id
Sourcepub fn get_widget(
&mut self,
name: Option<&String>,
uuid: Option<&Uuid>,
) -> Option<&mut Box<dyn TheWidget>>
pub fn get_widget( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheWidget>>
Returns the widget of the given id
Sourcepub fn get_layout(
&mut self,
name: Option<&String>,
uuid: Option<&Uuid>,
) -> Option<&mut Box<dyn TheLayout>>
pub fn get_layout( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheLayout>>
Returns the layout of the given id
Sourcepub fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId>
pub fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId>
Returns the layout id at the given screen coordinate (if any)
Sourcepub fn get_widget_at_coord(
&mut self,
coord: Vec2<i32>,
) -> Option<&mut Box<dyn TheWidget>>
pub fn get_widget_at_coord( &mut self, coord: Vec2<i32>, ) -> Option<&mut Box<dyn TheWidget>>
Returns the widget at the given screen coordinate (if any)
Sourcepub fn layout(&mut self, width: i32, height: i32, ctx: &mut TheContext)
pub fn layout(&mut self, width: i32, height: i32, ctx: &mut TheContext)
Layout the canvas according to its dimensions.
Sourcepub fn draw(&mut self, style: &mut Box<dyn TheStyle>, ctx: &mut TheContext)
pub fn draw(&mut self, style: &mut Box<dyn TheStyle>, ctx: &mut TheContext)
Draw the canvas
pub fn draw_overlay( &mut self, style: &mut Box<dyn TheStyle>, ctx: &mut TheContext, )
Sourcepub fn needs_redraw(&mut self) -> bool
pub fn needs_redraw(&mut self) -> bool
Returns true if any widget or layout attached to this canvas (or its children) needs a redraw.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TheCanvas
impl !RefUnwindSafe for TheCanvas
impl Send for TheCanvas
impl !Sync for TheCanvas
impl Unpin for TheCanvas
impl UnsafeUnpin for TheCanvas
impl !UnwindSafe for TheCanvas
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.