Skip to main content

atk/auto/
table_cell.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{Object, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// The ATK interface implemented for a cell inside a two-dimentional [`Table`][crate::Table]
10    ///
11    /// Being [`Table`][crate::Table] a component which present elements ordered via rows
12    /// and columns, an [`TableCell`][crate::TableCell] is the interface which each of those
13    /// elements, so "cells" should implement.
14    ///
15    /// See [iface[`Table`][crate::Table]]
16    ///
17    /// # Implements
18    ///
19    /// [`TableCellExt`][trait@crate::prelude::TableCellExt], [`AtkObjectExt`][trait@crate::prelude::AtkObjectExt], [`trait@glib::ObjectExt`]
20    #[doc(alias = "AtkTableCell")]
21    pub struct TableCell(Interface<ffi::AtkTableCell, ffi::AtkTableCellIface>) @requires Object;
22
23    match fn {
24        type_ => || ffi::atk_table_cell_get_type(),
25    }
26}
27
28impl TableCell {
29    pub const NONE: Option<&'static TableCell> = None;
30}
31
32/// Trait containing all [`struct@TableCell`] methods.
33///
34/// # Implementors
35///
36/// [`NoOpObject`][struct@crate::NoOpObject], [`TableCell`][struct@crate::TableCell]
37pub trait TableCellExt: IsA<TableCell> + 'static {
38    /// Returns the column headers as an array of cell accessibles.
39    ///
40    /// # Returns
41    ///
42    /// a GPtrArray of AtkObjects
43    /// representing the column header cells.
44    #[doc(alias = "atk_table_cell_get_column_header_cells")]
45    #[doc(alias = "get_column_header_cells")]
46    fn column_header_cells(&self) -> Vec<Object> {
47        unsafe {
48            FromGlibPtrContainer::from_glib_full(ffi::atk_table_cell_get_column_header_cells(
49                self.as_ref().to_glib_none().0,
50            ))
51        }
52    }
53
54    /// Returns the number of columns occupied by this cell accessible.
55    ///
56    /// # Returns
57    ///
58    /// a gint representing the number of columns occupied by this cell,
59    /// or 0 if the cell does not implement this method.
60    #[doc(alias = "atk_table_cell_get_column_span")]
61    #[doc(alias = "get_column_span")]
62    fn column_span(&self) -> i32 {
63        unsafe { ffi::atk_table_cell_get_column_span(self.as_ref().to_glib_none().0) }
64    }
65
66    /// Retrieves the tabular position of this cell.
67    ///
68    /// # Returns
69    ///
70    /// TRUE if successful; FALSE otherwise.
71    ///
72    /// ## `row`
73    /// the row of the given cell.
74    ///
75    /// ## `column`
76    /// the column of the given cell.
77    #[doc(alias = "atk_table_cell_get_position")]
78    #[doc(alias = "get_position")]
79    fn position(&self) -> Option<(i32, i32)> {
80        unsafe {
81            let mut row = std::mem::MaybeUninit::uninit();
82            let mut column = std::mem::MaybeUninit::uninit();
83            let ret = from_glib(ffi::atk_table_cell_get_position(
84                self.as_ref().to_glib_none().0,
85                row.as_mut_ptr(),
86                column.as_mut_ptr(),
87            ));
88            if ret {
89                Some((row.assume_init(), column.assume_init()))
90            } else {
91                None
92            }
93        }
94    }
95
96    /// Gets the row and column indexes and span of this cell accessible.
97    ///
98    /// Note: If the object does not implement this function, then, by default, atk
99    /// will implement this function by calling get_row_span and get_column_span
100    /// on the object.
101    ///
102    /// # Returns
103    ///
104    /// TRUE if successful; FALSE otherwise.
105    ///
106    /// ## `row`
107    /// the row index of the given cell.
108    ///
109    /// ## `column`
110    /// the column index of the given cell.
111    ///
112    /// ## `row_span`
113    /// the number of rows occupied by this cell.
114    ///
115    /// ## `column_span`
116    /// the number of columns occupied by this cell.
117    #[doc(alias = "atk_table_cell_get_row_column_span")]
118    #[doc(alias = "get_row_column_span")]
119    fn row_column_span(&self) -> Option<(i32, i32, i32, i32)> {
120        unsafe {
121            let mut row = std::mem::MaybeUninit::uninit();
122            let mut column = std::mem::MaybeUninit::uninit();
123            let mut row_span = std::mem::MaybeUninit::uninit();
124            let mut column_span = std::mem::MaybeUninit::uninit();
125            let ret = from_glib(ffi::atk_table_cell_get_row_column_span(
126                self.as_ref().to_glib_none().0,
127                row.as_mut_ptr(),
128                column.as_mut_ptr(),
129                row_span.as_mut_ptr(),
130                column_span.as_mut_ptr(),
131            ));
132            if ret {
133                Some((
134                    row.assume_init(),
135                    column.assume_init(),
136                    row_span.assume_init(),
137                    column_span.assume_init(),
138                ))
139            } else {
140                None
141            }
142        }
143    }
144
145    /// Returns the row headers as an array of cell accessibles.
146    ///
147    /// # Returns
148    ///
149    /// a GPtrArray of AtkObjects
150    /// representing the row header cells.
151    #[doc(alias = "atk_table_cell_get_row_header_cells")]
152    #[doc(alias = "get_row_header_cells")]
153    fn row_header_cells(&self) -> Vec<Object> {
154        unsafe {
155            FromGlibPtrContainer::from_glib_full(ffi::atk_table_cell_get_row_header_cells(
156                self.as_ref().to_glib_none().0,
157            ))
158        }
159    }
160
161    /// Returns the number of rows occupied by this cell accessible.
162    ///
163    /// # Returns
164    ///
165    /// a gint representing the number of rows occupied by this cell,
166    /// or 0 if the cell does not implement this method.
167    #[doc(alias = "atk_table_cell_get_row_span")]
168    #[doc(alias = "get_row_span")]
169    fn row_span(&self) -> i32 {
170        unsafe { ffi::atk_table_cell_get_row_span(self.as_ref().to_glib_none().0) }
171    }
172
173    /// Returns a reference to the accessible of the containing table.
174    ///
175    /// # Returns
176    ///
177    /// the atk object for the containing table.
178    #[doc(alias = "atk_table_cell_get_table")]
179    #[doc(alias = "get_table")]
180    fn table(&self) -> Option<Object> {
181        unsafe {
182            from_glib_full(ffi::atk_table_cell_get_table(
183                self.as_ref().to_glib_none().0,
184            ))
185        }
186    }
187}
188
189impl<O: IsA<TableCell>> TableCellExt for O {}