summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_table_eo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas/evas_table_eo.h')
-rw-r--r--src/lib/evas/canvas/evas_table_eo.h338
1 files changed, 338 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_table_eo.h b/src/lib/evas/canvas/evas_table_eo.h
new file mode 100644
index 0000000..576e109
--- /dev/null
+++ b/src/lib/evas/canvas/evas_table_eo.h
@@ -0,0 +1,338 @@
1#ifndef _EVAS_TABLE_EO_H_
2#define _EVAS_TABLE_EO_H_
3
4#ifndef _EVAS_TABLE_EO_CLASS_TYPE
5#define _EVAS_TABLE_EO_CLASS_TYPE
6
7typedef Eo Evas_Table;
8
9#endif
10
11#ifndef _EVAS_TABLE_EO_TYPES
12#define _EVAS_TABLE_EO_TYPES
13
14/**
15 * @brief How to pack items into cells in a table.
16 *
17 * See @ref evas_obj_table_homogeneous_get for an explanation of the function
18 * of each one.
19 *
20 * @ingroup Evas_Object_Table
21 */
22typedef enum
23{
24 EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE = 0, /**< No mode specified */
25 EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE = 1, /**< Table mode */
26 EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM = 2 /**< Item mode */
27} Evas_Object_Table_Homogeneous_Mode;
28
29
30#endif
31/** Evas table class
32 *
33 * @ingroup Evas_Table
34 */
35#define EVAS_TABLE_CLASS evas_table_class_get()
36
37EWAPI const Efl_Class *evas_table_class_get(void);
38
39/**
40 * @brief Set how this table should layout children.
41 *
42 * Todo: consider aspect hint and respect it.
43 *
44 * @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE If table does not use homogeneous
45 * mode then columns and rows will be calculated based on hints of individual
46 * cells. This operation mode is more flexible, but more complex and heavy to
47 * calculate as well. Weight properties are handled as a boolean expand.
48 * Negative alignment will be considered as 0.5. This is the default.
49 *
50 * Todo: @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE should balance weight.
51 *
52 * @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE When homogeneous is relative to
53 * table the own table size is divided equally among children, filling the
54 * whole table area. That is, if table has @c WIDTH and @c COLUMNS, each cell
55 * will get _WIDTH / COLUMNS_ pixels. If children have minimum size that is
56 * larger than this amount (including padding), then it will overflow and be
57 * aligned respecting the alignment hint, possible overlapping sibling cells.
58 * Weight hint is used as a boolean, if greater than zero it will make the
59 * child expand in that axis, taking as much space as possible (bounded to
60 * maximum size hint). Negative alignment will be considered as 0.5.
61 *
62 * @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM When homogeneous is relative to item
63 * it means the greatest minimum cell size will be used. That is, if no element
64 * is set to expand, the table will have its contents to a minimum size, the
65 * bounding box of all these children will be aligned relatively to the table
66 * object using evas_object_table_align_get(). If the table area is too small
67 * to hold this minimum bounding box, then the objects will keep their size and
68 * the bounding box will overflow the box area, still respecting the alignment.
69 * Weight hint is used as a boolean, if greater than zero it will make that
70 * cell expand in that axis, toggling the *expand mode*, which makes the table
71 * behave much like @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE, except that the
72 * bounding box will overflow and items will not overlap siblings. If no
73 * minimum size is provided at all then the table will fallback to expand mode
74 * as well.
75 *
76 * @param[in] obj The object.
77 * @param[in] homogeneous Table homogeneous mode
78 *
79 * @ingroup Evas_Table
80 */
81EOAPI void evas_obj_table_homogeneous_set(Eo *obj, Evas_Object_Table_Homogeneous_Mode homogeneous);
82
83/**
84 * @brief Set how this table should layout children.
85 *
86 * Todo: consider aspect hint and respect it.
87 *
88 * @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE If table does not use homogeneous
89 * mode then columns and rows will be calculated based on hints of individual
90 * cells. This operation mode is more flexible, but more complex and heavy to
91 * calculate as well. Weight properties are handled as a boolean expand.
92 * Negative alignment will be considered as 0.5. This is the default.
93 *
94 * Todo: @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE should balance weight.
95 *
96 * @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE When homogeneous is relative to
97 * table the own table size is divided equally among children, filling the
98 * whole table area. That is, if table has @c WIDTH and @c COLUMNS, each cell
99 * will get _WIDTH / COLUMNS_ pixels. If children have minimum size that is
100 * larger than this amount (including padding), then it will overflow and be
101 * aligned respecting the alignment hint, possible overlapping sibling cells.
102 * Weight hint is used as a boolean, if greater than zero it will make the
103 * child expand in that axis, taking as much space as possible (bounded to
104 * maximum size hint). Negative alignment will be considered as 0.5.
105 *
106 * @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM When homogeneous is relative to item
107 * it means the greatest minimum cell size will be used. That is, if no element
108 * is set to expand, the table will have its contents to a minimum size, the
109 * bounding box of all these children will be aligned relatively to the table
110 * object using evas_object_table_align_get(). If the table area is too small
111 * to hold this minimum bounding box, then the objects will keep their size and
112 * the bounding box will overflow the box area, still respecting the alignment.
113 * Weight hint is used as a boolean, if greater than zero it will make that
114 * cell expand in that axis, toggling the *expand mode*, which makes the table
115 * behave much like @ref EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE, except that the
116 * bounding box will overflow and items will not overlap siblings. If no
117 * minimum size is provided at all then the table will fallback to expand mode
118 * as well.
119 *
120 * @param[in] obj The object.
121 *
122 * @return Table homogeneous mode
123 *
124 * @ingroup Evas_Table
125 */
126EOAPI Evas_Object_Table_Homogeneous_Mode evas_obj_table_homogeneous_get(const Eo *obj);
127
128/**
129 * @brief Control the alignment of the whole bounding box of contents.
130 *
131 * @param[in] obj The object.
132 * @param[in] horizontal Horizontal alignment
133 * @param[in] vertical Vertical alignment
134 *
135 * @ingroup Evas_Table
136 */
137EOAPI void evas_obj_table_align_set(Eo *obj, double horizontal, double vertical);
138
139/**
140 * @brief Control the alignment of the whole bounding box of contents.
141 *
142 * @param[in] obj The object.
143 * @param[out] horizontal Horizontal alignment
144 * @param[out] vertical Vertical alignment
145 *
146 * @ingroup Evas_Table
147 */
148EOAPI void evas_obj_table_align_get(const Eo *obj, double *horizontal, double *vertical);
149
150/**
151 * @brief Control the padding between cells.
152 *
153 * @param[in] obj The object.
154 * @param[in] horizontal Horizontal padding
155 * @param[in] vertical Vertical padding
156 *
157 * @ingroup Evas_Table
158 */
159EOAPI void evas_obj_table_padding_set(Eo *obj, int horizontal, int vertical);
160
161/**
162 * @brief Control the padding between cells.
163 *
164 * @param[in] obj The object.
165 * @param[out] horizontal Horizontal padding
166 * @param[out] vertical Vertical padding
167 *
168 * @ingroup Evas_Table
169 */
170EOAPI void evas_obj_table_padding_get(const Eo *obj, int *horizontal, int *vertical);
171
172/**
173 * @brief Get the number of columns and rows this table takes.
174 *
175 * @note columns and rows are virtual entities, one can specify a table with a
176 * single object that takes 4 columns and 5 rows. The only difference for a
177 * single cell table is that paddings will be accounted proportionally.
178 *
179 * @param[in] obj The object.
180 * @param[out] cols Columns in table
181 * @param[out] rows Rows in table
182 *
183 * @ingroup Evas_Table
184 */
185EOAPI void evas_obj_table_col_row_size_get(const Eo *obj, int *cols, int *rows);
186
187/**
188 * @brief Get the list of children for the table.
189 *
190 * @note This is a duplicate of the list kept by the table internally. It's up
191 * to the user to destroy it when it no longer needs it. It's possible to
192 * remove objects from the table when walking this list, but these removals
193 * won't be reflected on it.
194 *
195 * @param[in] obj The object.
196 *
197 * @return Children list
198 *
199 * @ingroup Evas_Table
200 */
201EOAPI Eina_List *evas_obj_table_children_get(const Eo *obj) EINA_WARN_UNUSED_RESULT;
202
203/**
204 * @brief Get the child of the table at the given coordinates
205 *
206 * @note This does not take into account col/row spanning
207 *
208 * @param[in] obj The object.
209 * @param[in] col Child column
210 * @param[in] row Child row
211 *
212 * @return Child object
213 *
214 * @ingroup Evas_Table
215 */
216EOAPI Efl_Canvas_Object *evas_obj_table_child_get(const Eo *obj, unsigned short col, unsigned short row);
217
218/**
219 * @brief Faster way to remove all child objects from a table object.
220 *
221 * @param[in] obj The object.
222 * @param[in] clear If @c true, it will delete just removed children.
223 *
224 * @ingroup Evas_Table
225 */
226EOAPI void evas_obj_table_clear(Eo *obj, Eina_Bool clear);
227
228/**
229 * @brief Get an accessor to get random access to the list of children for the
230 * table.
231 *
232 * @note Do not remove or delete objects while walking the list.
233 *
234 * @param[in] obj The object.
235 *
236 * @return Accessor to children list
237 *
238 * @ingroup Evas_Table
239 */
240EOAPI Eina_Accessor *evas_obj_table_accessor_new(const Eo *obj) EINA_WARN_UNUSED_RESULT;
241
242/**
243 * @brief Get an iterator to walk the list of children for the table.
244 *
245 * @note Do not remove or delete objects while walking the list.
246 *
247 * @param[in] obj The object.
248 *
249 * @return Iterator to children
250 *
251 * @ingroup Evas_Table
252 */
253EOAPI Eina_Iterator *evas_obj_table_iterator_new(const Eo *obj) EINA_WARN_UNUSED_RESULT;
254
255/**
256 * @brief Create a table that is child of a given element @c parent.
257 *
258 * @param[in] obj The object.
259 *
260 * @return Children table
261 *
262 * @ingroup Evas_Table
263 */
264EOAPI Efl_Canvas_Object *evas_obj_table_add_to(Eo *obj) EINA_WARN_UNUSED_RESULT;
265
266/**
267 * @brief Get packing location of a child of table
268 *
269 * @param[in] obj The object.
270 * @param[in] child The child object to add.
271 * @param[out] col Pointer to store relative-horizontal position to place
272 * child.
273 * @param[out] row Pointer to store relative-vertical position to place child.
274 * @param[out] colspan Pointer to store how many relative-horizontal positions
275 * to use for this child.
276 * @param[out] rowspan Pointer to store how many relative-vertical positions to
277 * use for this child.
278 *
279 * @return @c true on success, @c false on failure.
280 *
281 * @since 1.1
282 *
283 * @ingroup Evas_Table
284 */
285EOAPI Eina_Bool evas_obj_table_pack_get(const Eo *obj, Efl_Canvas_Object *child, unsigned short *col, unsigned short *row, unsigned short *colspan, unsigned short *rowspan);
286
287/**
288 * @brief Add a new child to a table object or set its current packing.
289 *
290 * Note that columns and rows only guarantee 16bit unsigned values at best.
291 * That means that col + colspan AND row + rowspan must fit inside 16bit
292 * unsigned values cleanly. You will be warned once values exceed 15bit
293 * storage, and attempting to use values not able to fit in 16bits will result
294 * in failure.
295 *
296 * @param[in] obj The object.
297 * @param[in] child The child object to add.
298 * @param[in] col Relative-horizontal position to place child.
299 * @param[in] row Relative-vertical position to place child.
300 * @param[in] colspan How many relative-horizontal positions to use for this
301 * child.
302 * @param[in] rowspan How many relative-vertical positions to use for this
303 * child.
304 *
305 * @return @c true on success, @c false on failure.
306 *
307 * @ingroup Evas_Table
308 */
309EOAPI Eina_Bool evas_obj_table_pack(Eo *obj, Efl_Canvas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) EINA_ARG_NONNULL(2);
310
311/**
312 * @brief Remove child from table.
313 *
314 * @note removing a child will immediately call a walk over children in order
315 * to recalculate numbers of columns and rows. If you plan to remove all
316 * children, use @ref evas_obj_table_clear instead.
317 *
318 * @param[in] obj The object.
319 * @param[in] child Child to be removed
320 *
321 * @return @c true on success, @c false on failure.
322 *
323 * @ingroup Evas_Table
324 */
325EOAPI Eina_Bool evas_obj_table_unpack(Eo *obj, Efl_Canvas_Object *child) EINA_ARG_NONNULL(2);
326
327/**
328 * @brief Returns the number of items in the table
329 *
330 * @param[in] obj The object.
331 *
332 * @return Number of items in table
333 *
334 * @ingroup Evas_Table
335 */
336EOAPI int evas_obj_table_count(Eo *obj);
337
338#endif