[Tizen][AT-SPI] Add Table and TableCell interfaces
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / atspi-interfaces / table-cell.h
1 #ifndef DALI_ADAPTOR_ATSPI_TABLE_CELL_H
2 #define DALI_ADAPTOR_ATSPI_TABLE_CELL_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 // EXTERNAL INCLUDES
21 #include <utility>
22
23 // INTERNAL INCLUDES
24 #include <dali/devel-api/atspi-interfaces/accessible.h>
25
26 namespace Dali::Accessibility
27 {
28 class Table;
29
30 /**
31  * @brief Interface representing a table cell.
32  *
33  * @see Dali::Accessibility::Table
34  */
35 class DALI_ADAPTOR_API TableCell : public virtual Accessible
36 {
37 public:
38   /**
39    * @brief Cell information type.
40    *
41    * @see TableCell:GetCellRowColumnSpan()
42    */
43   struct RowColumnSpanType
44   {
45     int row;        ///< Row index
46     int column;     ///< Column index
47     int rowSpan;    ///< Row span
48     int columnSpan; ///< Column span
49   };
50
51   /**
52    * @brief Returns the table this cell belongs to.
53    *
54    * @return The table
55    */
56   virtual Table* GetTable() const = 0;
57
58   /**
59    * @brief Returns the position of this cell in the table.
60    *
61    * @return A pair of integers (row index, column index)
62    */
63   virtual std::pair<int, int> GetCellPosition() const = 0;
64
65   /**
66    * @brief Returns the number of rows occupied by this cell.
67    *
68    * @return Number of rows
69    */
70   virtual int GetCellRowSpan() const = 0;
71
72   /**
73    * @brief Returns the number of columns occupied by this cell.
74    *
75    * @return Number of columns
76    */
77   virtual int GetCellColumnSpan() const = 0;
78
79   /**
80    * @brief Returns the position, row span, and column span of this cell.
81    *
82    * @return Cell information
83    *
84    * @see TableCell::RowColumnSpanType
85    * @see TableCell::GetCellPosition()
86    * @see TableCell::GetCellRowSpan()
87    * @see TableCell::GetCellColumnSpan()
88    */
89   virtual RowColumnSpanType GetCellRowColumnSpan() const = 0;
90
91   /**
92    * @brief Downcasts an Accessible to a TableCell.
93    *
94    * @param obj The Accessible
95    * @return A Table or null
96    *
97    * @see Dali::Accessibility::Accessible::DownCast()
98    */
99   static inline TableCell* DownCast(Accessible* obj);
100 };
101
102 namespace Internal
103 {
104 template<>
105 struct AtspiInterfaceTypeHelper<AtspiInterface::TABLE_CELL>
106 {
107   using Type = TableCell;
108 };
109 } // namespace Internal
110
111 inline TableCell* TableCell::DownCast(Accessible* obj)
112 {
113   return Accessible::DownCast<AtspiInterface::TABLE_CELL>(obj);
114 }
115
116 } // namespace Dali::Accessibility
117
118 #endif // DALI_ADAPTOR_ATSPI_TABLE_CELL_H