1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::Table;
use glib::object::IsA;
use glib::translate::*;
pub trait TableExtManual: 'static {
/// Gets the selected columns of the table by initializing **selected with
/// the selected column numbers. This array should be freed by the caller.
/// ## `selected`
/// a `gint`** that is to contain the selected columns numbers
///
/// # Returns
///
/// a gint representing the number of selected columns,
/// or `0` if value does not implement this interface.
#[doc(alias = "atk_table_get_selected_columns")]
#[doc(alias = "get_selected_columns")]
fn selected_columns(&self) -> Vec<i32>;
/// Gets the selected rows of the table by initializing **selected with
/// the selected row numbers. This array should be freed by the caller.
/// ## `selected`
/// a `gint`** that is to contain the selected row numbers
///
/// # Returns
///
/// a gint representing the number of selected rows,
/// or zero if value does not implement this interface.
#[doc(alias = "atk_table_get_selected_rows")]
#[doc(alias = "get_selected_rows")]
fn selected_rows(&self) -> Vec<i32>;
}
impl<O: IsA<Table>> TableExtManual for O {
fn selected_columns(&self) -> Vec<i32> {
unsafe {
let mut selected = ::std::ptr::null_mut();
let nb =
ffi::atk_table_get_selected_columns(self.as_ref().to_glib_none().0, &mut selected);
if nb <= 0 {
Vec::new()
} else {
Vec::from_raw_parts(selected, nb as usize, nb as usize)
}
}
}
fn selected_rows(&self) -> Vec<i32> {
unsafe {
let mut selected = ::std::ptr::null_mut();
let nb =
ffi::atk_table_get_selected_rows(self.as_ref().to_glib_none().0, &mut selected);
if nb <= 0 {
Vec::new()
} else {
Vec::from_raw_parts(selected, nb as usize, nb as usize)
}
}
}
}