Trait titik::Widget [−][src]
All widgets must implement the Widget trait
Required methods
fn style(&self) -> Style
[src]
return the style of this widget
fn layout(&self) -> Option<&Layout>
[src]
return the layout of thiswidget
fn set_layout(&mut self, layout: Layout)
[src]
fn draw(&self, but: &mut Buffer) -> Vec<Cmd>
[src]
this is called in the render loop in the renderer where the widget writes into the buffer. The result will then be written into the stdout terminal.
fn as_any(&self) -> &dyn Any
[src]
get an Any reference
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
get an Any mutable reference for casting purposed
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
set the size of the widget
fn set_id(&mut self, id: &str)
[src]
set the id of this widget
fn get_id(&self) -> &Option<String>
[src]
get the id of this widget
Provided methods
fn get_offset(&self) -> (f32, f32)
[src]
return the offset of the parent, this before any of it’s children to be drawn
fn add_child(&mut self, _child: Box<dyn Widget<MSG>>) -> bool
[src]
add a child to this widget returns true if it can accept a child, false otherwise
fn children(&self) -> Option<&[Box<dyn Widget<MSG>>]>
[src]
get a referemce tp the children of this widget
fn children_mut(&mut self) -> Option<&mut [Box<dyn Widget<MSG>>]>
[src]
get a mutable reference to the children of this widget
fn child_mut(&mut self, _index: usize) -> Option<&mut Box<dyn Widget<MSG>>>
[src]
return a mutable reference to a child at index location
fn style_node(&self, stretch: &mut Stretch) -> Option<Node>
[src]
build a node with styles from this widget and its children
The Layout tree is then calculated see layout::compute_layout
fn set_focused(&mut self, _focused: bool)
[src]
set the widget as focused
fn as_mut(&mut self) -> Option<&mut Self> where
Self: Sized + 'static,
[src]
Self: Sized + 'static,
get a mutable reference of this widget
fn process_event(&mut self, _event: Event) -> Vec<MSG>
[src]
this process the event and all callbacks attached to the widgets will be dispatched.
fn take_child(&mut self, _index: usize) -> Option<Box<dyn Widget<MSG>>>
[src]
take the children at this index location
Implementors
impl<MSG> Widget<MSG> for Button<MSG> where
MSG: 'static,
[src]
MSG: 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn set_focused(&mut self, focused: bool)
[src]
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn process_event(&mut self, event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for FlexBox<MSG> where
MSG: Debug + 'static,
[src]
MSG: Debug + 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
fn add_child(&mut self, child: Box<dyn Widget<MSG>>) -> bool
[src]
fn children(&self) -> Option<&[Box<dyn Widget<MSG>>]>
[src]
fn children_mut(&mut self) -> Option<&mut [Box<dyn Widget<MSG>>]>
[src]
fn take_child(&mut self, index: usize) -> Option<Box<dyn Widget<MSG>>>
[src]
fn child_mut<'a>(
&'a mut self,
index: usize
) -> Option<&'a mut Box<dyn Widget<MSG>>>
[src]
&'a mut self,
index: usize
) -> Option<&'a mut Box<dyn Widget<MSG>>>
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for GroupBox<MSG> where
MSG: Debug + 'static,
[src]
MSG: Debug + 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
fn add_child(&mut self, child: Box<dyn Widget<MSG>>) -> bool
[src]
fn children(&self) -> Option<&[Box<dyn Widget<MSG>>]>
[src]
fn children_mut(&mut self) -> Option<&mut [Box<dyn Widget<MSG>>]>
[src]
fn take_child(&mut self, index: usize) -> Option<Box<dyn Widget<MSG>>>
[src]
fn child_mut<'a>(
&'a mut self,
index: usize
) -> Option<&'a mut Box<dyn Widget<MSG>>>
[src]
&'a mut self,
index: usize
) -> Option<&'a mut Box<dyn Widget<MSG>>>
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for Image<MSG> where
MSG: 'static,
[src]
MSG: 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for Link
[src]
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn process_event(&mut self, _event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for ListBox<MSG> where
MSG: Debug + 'static,
[src]
MSG: Debug + 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for Slider<MSG> where
MSG: Debug + 'static,
[src]
MSG: Debug + 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, _height: Option<f32>)
[src]
fn process_event(&mut self, event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for TabBox<MSG> where
MSG: Debug + 'static,
[src]
MSG: Debug + 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn get_offset(&self) -> (f32, f32)
[src]
the tab box has an offset of 2 from the top before drawing the child components
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
fn add_child(&mut self, child: Box<dyn Widget<MSG>>) -> bool
[src]
add a child widget to the current active tab
fn children(&self) -> Option<&[Box<dyn Widget<MSG>>]>
[src]
fn children_mut(&mut self) -> Option<&mut [Box<dyn Widget<MSG>>]>
[src]
fn take_child(&mut self, index: usize) -> Option<Box<dyn Widget<MSG>>>
[src]
fn child_mut<'a>(
&'a mut self,
index: usize
) -> Option<&'a mut Box<dyn Widget<MSG>>>
[src]
&'a mut self,
index: usize
) -> Option<&'a mut Box<dyn Widget<MSG>>>
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
fn process_event(&mut self, event: Event) -> Vec<MSG>
[src]
impl<MSG> Widget<MSG> for TextArea<MSG> where
MSG: Debug + 'static,
[src]
MSG: Debug + 'static,
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn set_focused(&mut self, focused: bool)
[src]
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn process_event(&mut self, event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for TextInput
[src]
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn set_focused(&mut self, focused: bool)
[src]
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn process_event(&mut self, event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG> Widget<MSG> for TextLabel
[src]
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, width: Option<f32>, height: Option<f32>)
[src]
fn process_event(&mut self, _event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG: 'static> Widget<MSG> for Checkbox<MSG>
[src]
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout
fn as_any(&self) -> &dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn set_size(&mut self, _width: Option<f32>, _height: Option<f32>)
[src]
fn process_event(&mut self, event: Event) -> Vec<MSG>
[src]
fn set_id(&mut self, id: &str)
[src]
fn get_id(&self) -> &Option<String>
[src]
impl<MSG: 'static> Widget<MSG> for Radio<MSG>
[src]
fn layout(&self) -> Option<&Layout>
[src]
fn set_layout(&mut self, layout: Layout)
[src]
fn style(&self) -> Style
[src]
fn draw(&self, buf: &mut Buffer) -> Vec<Cmd>
[src]
draw this button to the buffer, with the given computed layout