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