1 #ifndef DALI_ADAPTOR_ATSPI_TABLE_H
2 #define DALI_ADAPTOR_ATSPI_TABLE_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali/devel-api/atspi-interfaces/accessible.h>
27 namespace Dali::Accessibility
32 * @brief Interface representing a table.
34 * The selection methods extend the Selection interface,
35 * so both should be implemented by table and grid controls.
37 * @see Dali::Accessibility::Selection
38 * @see Dali::Accessibility::TableCell
40 class DALI_ADAPTOR_API Table : public virtual Accessible
44 * @brief Cell information type.
46 * @see Table:GetRowColumnSpan()
48 struct RowColumnSpanType
50 int row; ///< Row index
51 int column; ///< Column index
52 int rowSpan; ///< Row span
53 int columnSpan; ///< Column span
54 bool isSelected; ///< Whether the cell is selected
55 bool success; ///< Whether other fields are meaningful
59 * @brief Gets the number of rows.
61 * @return Number of rows
63 virtual int GetRowCount() const = 0;
66 * @brief Gets the number of columns.
68 * @return Number of columns
70 virtual int GetColumnCount() const = 0;
73 * @brief Gets the number of selected rows.
75 * @return Number of selected rows
77 * @see Table::GetSelectedRows()
79 virtual int GetSelectedRowCount() const = 0;
82 * @brief Gets the number of selected columns.
84 * @return Number of selected columns
86 * @see Table::GetSelectedColumns()
88 virtual int GetSelectedColumnCount() const = 0;
91 * @brief Gets the table's caption.
93 * @return The caption or null
95 virtual Accessible* GetCaption() const = 0;
98 * @brief Gets the table's summary.
100 * @return The summary or null
102 virtual Accessible* GetSummary() const = 0;
105 * @brief Gets the cell at the specified position
107 * @param[in] row Row number
108 * @param[in] column Column number
110 * @return The cell or null
112 virtual TableCell* GetCell(int row, int column) const = 0;
115 * @brief Gets the one-dimensional index of a cell
117 * The returned index should be such that:
118 * @code GetChildAtIndex(GetChildIndex(row, column)) == GetCell(row, column) @endcode
120 * @param[in] row Row number
121 * @param[in] column Column number
123 * @return The one-dimensional index
125 * @see Dali::Accessibility::Accessible::GetChildAtIndex()
126 * @see Table::GetCell()
128 virtual std::size_t GetChildIndex(int row, int column) const = 0;
131 * @brief Gets the row number of a cell
133 * @param[in] childIndex One-dimensional index of the cell
135 * @return The row number of the cell
137 * @see Table::GetChildIndex()
139 virtual int GetRowByChildIndex(std::size_t childIndex) const = 0;
142 * @brief Gets the column number of a cell
144 * @param[in] childIndex One-dimensional index of the cell
146 * @return The column number of the cell
148 * @see Table::GetChildIndex()
150 virtual int GetColumnByChildIndex(std::size_t childIndex) const = 0;
153 * @brief Gets the description of a row.
155 * @param[in] row Row number
157 * @return The description of the row
159 virtual std::string GetRowDescription(int row) const = 0;
162 * @brief Gets the description of a column.
164 * @param[in] column Column number
166 * @return The description of the column
168 virtual std::string GetColumnDescription(int column) const = 0;
171 * @brief Gets the row span of a cell
173 * The return value should be such that:
174 * @code GetRowSpan(row, column) == GetCell(row, column)->GetCellRowSpan() @endcode
176 * @param[in] row Row number
177 * @param[in] column Column number
179 * @return The row span of the cell
181 * @see Table::GetCell()
182 * @see Dali::Accessibility::TableCell::GetCellRowSpan()
184 virtual int GetRowSpan(int row, int column) const = 0;
187 * @brief Gets the column span of a cell
189 * The return value should be such that:
190 * @code GetColumnSpan(row, column) == GetCell(row, column)->GetCellColumnSpan() @endcode
192 * @param[in] row Row number
193 * @param[in] column Column number
195 * @return The column span of the cell
197 * @see Table::GetCell()
198 * @see Dali::Accessibility::TableCell::GetCellColumnSpan()
200 virtual int GetColumnSpan(int row, int column) const = 0;
203 * @brief Gets the header of a row.
205 * @param[in] row Row number
207 * @return The row header or null
209 virtual Accessible* GetRowHeader(int row) const = 0;
212 * @brief Gets the header of a column.
214 * @param[in] column Column number
216 * @return The column header or null
218 virtual Accessible* GetColumnHeader(int column) const = 0;
221 * @brief Gets all selected rows' numbers.
223 * @return Selected rows' numbers
225 * @see Table::GetSelectedRowCount()
227 virtual std::vector<int> GetSelectedRows() const = 0;
230 * @brief Gets all selected columns' numbers.
232 * @return Selected columns' numbers
234 * @see Table::GetSelectedColumnCount()
236 virtual std::vector<int> GetSelectedColumns() const = 0;
239 * @brief Checks if a row is selected.
241 * @param[in] row Row number
243 * @return True if the row is selected, false otherwise
245 virtual bool IsRowSelected(int row) const = 0;
248 * @brief Checks if a column is selected.
250 * @param[in] column Column number
252 * @return True if the column is selected, false otherwise
254 virtual bool IsColumnSelected(int column) const = 0;
257 * @brief Checks if a cell is selected.
259 * @param[in] row Row number of the cell
260 * @param[in] column Column number of the cell
262 * @return True if the cell is selected, false otherwise
264 virtual bool IsCellSelected(int row, int column) const = 0;
267 * @brief Selects a row.
269 * @param[in] row Row number
271 * @return True on success, false otherwise
273 virtual bool AddRowSelection(int row) = 0;
276 * @brief Selects a column.
278 * @param[in] column Column number
280 * @return True on success, false otherwise
282 virtual bool AddColumnSelection(int column) = 0;
285 * @brief Unselects a row.
287 * @param[in] row Row number
289 * @return True on success, false otherwise
291 virtual bool RemoveRowSelection(int row) = 0;
294 * @brief Unselects a column.
296 * @param[in] column Column number
298 * @return True on success, false otherwise
300 virtual bool RemoveColumnSelection(int column) = 0;
303 * @brief Returns position and span information about a cell.
305 * @param[in] childIndex One-dimensional index of the cell
307 * @return The 'status' field of the returned structure is true on success, false otherwise
309 * @see Table::RowColumnSpanType
311 virtual RowColumnSpanType GetRowColumnSpan(std::size_t childIndex) const = 0;
314 * @brief Downcasts an Accessible to a Table.
316 * @param obj The Accessible
317 * @return A Table or null
319 * @see Dali::Accessibility::Accessible::DownCast()
321 static inline Table* DownCast(Accessible* obj);
327 struct AtspiInterfaceTypeHelper<AtspiInterface::TABLE>
331 } // namespace Internal
333 inline Table* Table::DownCast(Accessible* obj)
335 return Accessible::DownCast<AtspiInterface::TABLE>(obj);
338 } // namespace Dali::Accessibility
340 #endif // DALI_ADAPTOR_ATSPI_TABLE_H