pub struct DataGrid { /* private fields */ }Expand description
A grid-based component to dynamically present many different values (of possibly different datatypes) Design:
Row | Column1 | Column2 | Column3 |
─────┼─────────┼─────────┼─────────|
1 | <NULL> | true | textabc |
2 | <NULL> | false | <EMPTY> |
3 | 1234 | true | abc |Implementations§
Source§impl DataGrid
impl DataGrid
pub fn new() -> Self
pub fn default_callback(_: &mut Self)
pub fn default_key_handler(&mut self, event: &mut WindowEvent)
pub fn set_key_handler(&mut self, f: DataGridKeyHandler)
pub fn set_callback<F: Fn(&mut Self) + 'static>(&mut self, callback: F)
pub fn set_radix(&mut self, radix: Radix)
Sourcepub fn set_selection_color(&mut self, color: Option<Color>)
pub fn set_selection_color(&mut self, color: Option<Color>)
Examples found in repository?
examples/datagrid.rs (line 113)
107 fn default() -> Self {
108 let datagrid = WindowFactory::create::<DataGrid>();
109 {
110 let mut brw = datagrid.borrow_mut();
111 brw.set_data_source(Box::new(ExampleDataSource::default()));
112 //brw.set_radix(Radix::Hexadecimal);
113 brw.set_selection_color(Some(Color::Cyan));
114 }
115
116 Self {
117 uid: WindowUID::new(),
118 datagrid,
119 running: true,
120 }
121 }pub fn move_selection_up(&mut self)
pub fn move_selection_down(&mut self)
pub fn move_selection_left(&mut self)
pub fn move_selection_right(&mut self)
pub fn move_page_up(&mut self)
pub fn move_page_down(&mut self)
Sourcepub fn reevaluate_columns(&mut self)
pub fn reevaluate_columns(&mut self)
Should be called when columns or column sizes have been changed
Sourcepub fn set_data_source(&mut self, data: Box<dyn DataSource>)
pub fn set_data_source(&mut self, data: Box<dyn DataSource>)
Sets the internal data source
Examples found in repository?
examples/datagrid.rs (line 111)
107 fn default() -> Self {
108 let datagrid = WindowFactory::create::<DataGrid>();
109 {
110 let mut brw = datagrid.borrow_mut();
111 brw.set_data_source(Box::new(ExampleDataSource::default()));
112 //brw.set_radix(Radix::Hexadecimal);
113 brw.set_selection_color(Some(Color::Cyan));
114 }
115
116 Self {
117 uid: WindowUID::new(),
118 datagrid,
119 running: true,
120 }
121 }Trait Implementations§
Source§impl HasWindowUID for DataGrid
impl HasWindowUID for DataGrid
Source§impl Widget for DataGrid
impl Widget for DataGrid
fn set_alignment( &mut self, horizontal: HorizontalAlignment, vertical: VerticalAlignment, )
fn set_visibility(&mut self, visibility: bool)
fn set_width(&mut self, width: Size)
fn set_height(&mut self, height: Size)
fn set_margin(&mut self, margin: Thickness)
fn set_border(&mut self, border: BorderStyle)
Source§fn set_enabled_state(&mut self, is_enabled: bool)
fn set_enabled_state(&mut self, is_enabled: bool)
Changing the IsEnabled state usually changes the highlight color
fn set_width_constraint(&mut self, width: SizeConstraint)
fn set_height_constraint(&mut self, height: SizeConstraint)
Source§impl WidgetColors for DataGrid
impl WidgetColors for DataGrid
fn set_disabled_color(&mut self, color: Option<Color>)
fn set_base_fg_color(&mut self, color: Option<Color>)
fn set_base_bg_color(&mut self, color: Option<Color>)
Source§impl Window for DataGrid
impl Window for DataGrid
Source§fn handle_event(&mut self, event: &mut WindowEvent)
fn handle_event(&mut self, event: &mut WindowEvent)
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Source§fn children(&mut self, builder: SubWindowBuilder) -> SubWindows
fn children(&mut self, builder: SubWindowBuilder) -> SubWindows
Returns all children windows (and layouting Rects)
Note: When changing the children make sure to also adjust the focus
Source§impl WindowLayout for DataGrid
impl WindowLayout for DataGrid
Source§fn desired_size_pre_hook(&mut self, available_size: TPoint)
fn desired_size_pre_hook(&mut self, available_size: TPoint)
This is similar to desired_size but will not return anything and can mutably change self
This is executed before WindowLayout::desired_size
Only implement if actually necessary
Source§fn desired_size(&self, available_size: TPoint) -> TPoint
fn desired_size(&self, available_size: TPoint) -> TPoint
Parents call this to get the desired size of the child
This must not exceed
available_size on any axis
When the result’s product is equal to 0, this window wont be drawnSource§fn alignment(&self) -> (HorizontalAlignment, VerticalAlignment)
fn alignment(&self) -> (HorizontalAlignment, VerticalAlignment)
fn margin(&self) -> Thickness
fn border(&self) -> BorderStyle
fn is_visible(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for DataGrid
impl !Send for DataGrid
impl !Sync for DataGrid
impl !UnwindSafe for DataGrid
impl Freeze for DataGrid
impl Unpin for DataGrid
impl UnsafeUnpin for DataGrid
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
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> WindowHelper for Twhere
T: Window,
impl<T> WindowHelper for Twhere
T: Window,
Source§fn provoke_changed_property(&self, property: WindowProperty)
fn provoke_changed_property(&self, property: WindowProperty)
Helper method for WindowEventQueue::provoke_changed_property