table: Make set_selected_row, set_selected_col public (#455)

Co-authored-by: Jason Lee <huacnlee@gmail.com>
This commit is contained in:
Ylin 2024-12-03 12:00:15 +08:00 committed by GitHub
parent 97c01c75e8
commit dd1b767b8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -361,7 +361,8 @@ where
cx.notify();
}
fn set_selected_row(&mut self, row_ix: usize, cx: &mut ViewContext<Self>) {
/// Sets the selected row to the given index.
pub fn set_selected_row(&mut self, row_ix: usize, cx: &mut ViewContext<Self>) {
self.selection_state = SelectionState::Row;
self.right_clicked_row = None;
self.selected_row = Some(row_ix);
@ -373,7 +374,8 @@ where
cx.notify();
}
fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext<Self>) {
/// Sets the selected col to the given index.
pub fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext<Self>) {
self.selection_state = SelectionState::Column;
self.selected_col = Some(col_ix);
if let Some(_col_ix) = self.selected_col {