1 #include <Elementary.h>
4 #define SIG_CHILD_ADDED "child,added"
5 #define SIG_CHILD_REMOVED "child,removed"
11 * A box object arranges objects in a single row within a box. Sub objects can
12 * be added at the start, end or before or after any existing object in the
13 * box already. It can have its orientation changed too. How a child object is
14 * sized and otherwise arranged within the box depends on evas hints.
15 * evas_object_size_hint_align_set() will set either the alignment within its
16 * region if the region allocated is bigger than the object size. If you want
17 * the sub object sized up to fill the allocated region, use -1.0 for the
18 * apporpriate horizontal or vertical axes. evas_object_size_hint_weight_set()
19 * will set the packing weight. The weights of all items being packed are added
20 * up and if items are to be sized up to fit, those with the higher weights get
21 * proportionally more space.
23 * NOTE: Objects should not be added to box objects using _add() calls.
25 typedef struct _Widget_Data Widget_Data;
26 typedef struct _Transition_Animation_Data Transition_Animation_Data;
31 Eina_Bool horizontal:1;
32 Eina_Bool homogeneous:1;
36 struct _Elm_Box_Transition
40 Eina_Bool animation_ended:1;
41 Eina_Bool recalculate:1;
42 Ecore_Animator *animator;
46 Evas_Object_Box_Layout layout;
48 void(*free_data)(void *data);
51 void(*transition_end_cb)(void *data);
52 void *transition_end_data;
53 void (*transition_end_free_data)(void *data);
58 struct _Transition_Animation_Data
63 Evas_Coord x, y, w, h;
67 static const char *widtype = NULL;
68 static void _del_hook(Evas_Object *obj);
69 static void _sizing_eval(Evas_Object *obj);
70 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
71 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
74 _del_pre_hook(Evas_Object *obj)
76 Widget_Data *wd = elm_widget_data_get(obj);
78 evas_object_event_callback_del_full
79 (wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
80 evas_object_box_remove_all(wd->box, 0);
84 _del_hook(Evas_Object *obj)
86 Widget_Data *wd = elm_widget_data_get(obj);
92 _elm_box_list_data_get(const Eina_List *list)
94 Evas_Object_Box_Option *opt = eina_list_data_get(list);
99 _elm_box_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
101 Widget_Data *wd = elm_widget_data_get(obj);
102 const Eina_List *items;
103 void *(*list_data_get) (const Eina_List *list);
105 if ((!wd) || (!wd->box))
109 /* TODO: Change this to use other chain */
110 if ((items = elm_widget_focus_custom_chain_get(obj)))
111 list_data_get = eina_list_data_get;
114 Evas_Object_Box_Data *bd = evas_object_smart_data_get(wd->box);
115 items = bd->children;
116 list_data_get = _elm_box_list_data_get;
118 if (!items) return EINA_FALSE;
121 return elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
125 _theme_hook(Evas_Object *obj)
127 Widget_Data *wd = elm_widget_data_get(obj);
129 _elm_widget_mirrored_reload(obj);
130 evas_object_smart_calculate(wd->box);
134 _sizing_eval(Evas_Object *obj)
136 Widget_Data *wd = elm_widget_data_get(obj);
137 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
140 evas_object_size_hint_min_get(wd->box, &minw, &minh);
141 evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
142 evas_object_size_hint_min_set(obj, minw, minh);
143 evas_object_size_hint_max_set(obj, maxw, maxh);
144 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
145 if (w < minw) w = minw;
146 if (h < minh) h = minh;
147 if ((maxw >= 0) && (w > maxw)) w = maxw;
148 if ((maxh >= 0) && (h > maxh)) h = maxh;
149 evas_object_resize(obj, w, h);
153 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
159 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
165 _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
167 Evas_Object *obj = (Evas_Object *) data;
168 Widget_Data *wd = elm_widget_data_get(obj);
170 _els_box_layout_ex(o, priv, wd->horizontal, wd->homogeneous, wd->extended,
171 elm_widget_mirrored_get(obj));
175 _transition_animation(void *data)
177 evas_object_smart_changed(data);
178 return ECORE_CALLBACK_RENEW;
182 _transition_layout_child_added(void *data, Evas_Object *obj __UNUSED__, void *event_info)
184 Transition_Animation_Data *tad;
185 Evas_Object_Box_Option *opt = event_info;
186 Elm_Box_Transition *layout_data = data;
188 tad = calloc(1, sizeof(Transition_Animation_Data));
191 layout_data->objs = eina_list_append(layout_data->objs, tad);
192 layout_data->recalculate = EINA_TRUE;
196 _transition_layout_child_removed(void *data, Evas_Object *obj __UNUSED__, void *event_info)
199 Transition_Animation_Data *tad;
200 Elm_Box_Transition *layout_data = data;
202 EINA_LIST_FOREACH(layout_data->objs, l, tad)
204 if (tad->obj == event_info)
206 free(eina_list_data_get(l));
207 layout_data->objs = eina_list_remove_list(layout_data->objs, l);
208 layout_data->recalculate = EINA_TRUE;
215 _transition_layout_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
217 Elm_Box_Transition *layout_data = data;
218 layout_data->recalculate = EINA_TRUE;
222 _transition_layout_calculate_coords(Evas_Object *obj, Evas_Object_Box_Data *priv,
223 Elm_Box_Transition *layout_data)
226 Transition_Animation_Data *tad;
227 Evas_Coord x, y, w, h;
228 const double curtime = ecore_loop_time_get();
230 layout_data->duration =
231 layout_data->duration - (curtime - layout_data->initial_time);
232 layout_data->initial_time = curtime;
234 evas_object_geometry_get(obj, &x, &y, &w, &h);
235 EINA_LIST_FOREACH(layout_data->objs, l, tad)
237 evas_object_geometry_get(tad->obj, &tad->start.x, &tad->start.y,
238 &tad->start.w, &tad->start.h);
239 tad->start.x = tad->start.x - x;
240 tad->start.y = tad->start.y - y;
242 layout_data->end.layout(obj, priv, layout_data->end.data);
243 EINA_LIST_FOREACH(layout_data->objs, l, tad)
245 evas_object_geometry_get(tad->obj, &tad->end.x, &tad->end.y,
246 &tad->end.w, &tad->end.h);
247 tad->end.x = tad->end.x - x;
248 tad->end.y = tad->end.y - y;
253 _transition_layout_load_children_list(Evas_Object_Box_Data *priv,
254 Elm_Box_Transition *layout_data)
257 Evas_Object_Box_Option *opt;
258 Transition_Animation_Data *tad;
260 EINA_LIST_FREE(layout_data->objs, tad)
263 EINA_LIST_FOREACH(priv->children, l, opt)
265 tad = calloc(1, sizeof(Transition_Animation_Data));
268 EINA_LIST_FREE(layout_data->objs, tad)
270 layout_data->objs = NULL;
274 layout_data->objs = eina_list_append(layout_data->objs, tad);
280 _transition_layout_animation_start(Evas_Object *obj, Evas_Object_Box_Data *priv,
281 Elm_Box_Transition *layout_data, Eina_Bool(*transition_animation_cb)(void *data))
283 layout_data->start.layout(obj, priv, layout_data->start.data);
284 layout_data->box = obj;
285 layout_data->initial_time = ecore_loop_time_get();
287 if (!_transition_layout_load_children_list(priv, layout_data))
289 _transition_layout_calculate_coords(obj, priv, layout_data);
291 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
292 _transition_layout_obj_resize_cb, layout_data);
293 evas_object_smart_callback_add(obj, SIG_CHILD_ADDED,
294 _transition_layout_child_added, layout_data);
295 evas_object_smart_callback_add(obj, SIG_CHILD_REMOVED,
296 _transition_layout_child_removed, layout_data);
297 if (!layout_data->animator)
298 layout_data->animator = ecore_animator_add(transition_animation_cb, obj);
299 layout_data->animation_ended = EINA_FALSE;
304 _transition_layout_animation_stop(Elm_Box_Transition *layout_data)
306 layout_data->animation_ended = EINA_TRUE;
307 if (layout_data->animator)
309 ecore_animator_del(layout_data->animator);
310 layout_data->animator = NULL;
313 if (layout_data->transition_end_cb)
314 layout_data->transition_end_cb(layout_data->transition_end_data);
318 _transition_layout_animation_exec(Evas_Object *obj, Evas_Object_Box_Data *priv __UNUSED__,
319 Elm_Box_Transition *layout_data, const double curtime)
322 Transition_Animation_Data *tad;
323 Evas_Coord x, y, w, h;
324 Evas_Coord cur_x, cur_y, cur_w, cur_h;
325 double progress = 0.0;
327 progress = (curtime - layout_data->initial_time) / layout_data->duration;
328 evas_object_geometry_get(obj, &x, &y, &w, &h);
330 EINA_LIST_FOREACH(layout_data->objs, l, tad)
332 cur_x = x + tad->start.x + ((tad->end.x - tad->start.x) * progress);
333 cur_y = y + tad->start.y + ((tad->end.y - tad->start.y) * progress);
334 cur_w = tad->start.w + ((tad->end.w - tad->start.w) * progress);
335 cur_h = tad->start.h + ((tad->end.h - tad->start.h) * progress);
336 evas_object_move(tad->obj, cur_x, cur_y);
337 evas_object_resize(tad->obj, cur_w, cur_h);
342 * Add a new box to the parent
344 * @param parent The parent object
345 * @return The new object or NULL if it cannot be created
350 elm_box_add(Evas_Object *parent)
356 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
358 ELM_SET_WIDTYPE(widtype, "box");
359 elm_widget_type_set(obj, "box");
360 elm_widget_sub_object_add(parent, obj);
361 elm_widget_data_set(obj, wd);
362 elm_widget_del_hook_set(obj, _del_hook);
363 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
364 elm_widget_focus_next_hook_set(obj, _elm_box_focus_next_hook);
365 elm_widget_can_focus_set(obj, EINA_FALSE);
366 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
367 elm_widget_theme_hook_set(obj, _theme_hook);
369 wd->box = evas_object_box_add(e);
370 /*evas_object_box_layout_set(wd->box, evas_object_box_layout_vertical,
372 evas_object_box_layout_set(wd->box, _layout, obj, NULL);
374 evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
375 _changed_size_hints, obj);
376 elm_widget_resize_object_set(obj, wd->box);
378 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
384 * Set the horizontal orientation
386 * By default box object arrange their contents vertically from top to bottom.
387 * By calling this and providing @p horizontal as true, the box will become
388 * horizontal arranging contents left to right.
390 * @param obj The box object
391 * @param horizontal The horizontal flag (1 = horizontal, 0 = vertical)
396 elm_box_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
398 ELM_CHECK_WIDTYPE(obj, widtype);
399 Widget_Data *wd = elm_widget_data_get(obj);
401 wd->horizontal = !!horizontal;
402 evas_object_smart_calculate(wd->box);
403 /*if (wd->horizontal)
406 evas_object_box_layout_set(wd->box,
407 evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
409 evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
415 evas_object_box_layout_set(wd->box,
416 evas_object_box_layout_homogeneous_vertical, NULL, NULL);
418 evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
424 * Get the horizontal orientation
426 * @param obj The box object
427 * @return If is horizontal
432 elm_box_horizontal_get(const Evas_Object *obj)
434 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
435 Widget_Data *wd = elm_widget_data_get(obj);
436 if (!wd) return EINA_FALSE;
437 return wd->horizontal;
441 * Set homogenous layout
443 * If enabled, homogenous layout makes all items the same size. This size is
444 * of course governed by the size of the largest item in the box.
446 * @param obj The box object
447 * @param homogenous The homogenous flag (1 = on, 2 = off)
452 elm_box_homogenous_set(Evas_Object *obj, Eina_Bool homogenous)
454 ELM_CHECK_WIDTYPE(obj, widtype);
455 Widget_Data *wd = elm_widget_data_get(obj);
457 wd->homogeneous = !!homogenous;
458 evas_object_smart_calculate(wd->box);
459 /*if (wd->horizontal)
462 evas_object_box_layout_set(wd->box,
463 evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
465 evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
471 evas_object_box_layout_set(wd->box,
472 evas_object_box_layout_homogeneous_vertical, NULL, NULL);
474 evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
480 * Get homogenous layout
482 * @param obj The box object
483 * @return If is homogenous
488 elm_box_homogenous_get(const Evas_Object *obj)
490 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
491 Widget_Data *wd = elm_widget_data_get(obj);
492 if (!wd) return EINA_FALSE;
493 return wd->homogeneous;
497 * This adds a box at the start of the box (top or left based on orientation)
499 * This will add the @p subobj to the box object indicated at the beginning
500 * of the box (the left or top end).
502 * @param obj The box object
503 * @param subobj The object to add to the box
508 elm_box_pack_start(Evas_Object *obj, Evas_Object *subobj)
510 ELM_CHECK_WIDTYPE(obj, widtype);
511 Widget_Data *wd = elm_widget_data_get(obj);
513 elm_widget_sub_object_add(obj, subobj);
514 evas_object_box_prepend(wd->box, subobj);
518 * This adds a box at the end of the box (bottom or right based on orientation)
520 * This will add the @p subobj to the box object indicated at the end
521 * of the box (the right or bottom end).
523 * @param obj The box object
524 * @param subobj The object to add to the box
529 elm_box_pack_end(Evas_Object *obj, Evas_Object *subobj)
531 ELM_CHECK_WIDTYPE(obj, widtype);
532 Widget_Data *wd = elm_widget_data_get(obj);
534 elm_widget_sub_object_add(obj, subobj);
535 evas_object_box_append(wd->box, subobj);
539 * This adds adds an object to the box before the indicated object
541 * This will add the @p subobj to the box indicated before the object
542 * indicated with @p before. If @p before is not already in the box, results
543 * are undefined. Before means either to the left of the indicated object or
544 * above it depending on orientation.
546 * @param obj The box object
547 * @param subobj The object to add to the box
548 * @param before The object before which to add it
553 elm_box_pack_before(Evas_Object *obj, Evas_Object *subobj, Evas_Object *before)
555 ELM_CHECK_WIDTYPE(obj, widtype);
556 Widget_Data *wd = elm_widget_data_get(obj);
558 elm_widget_sub_object_add(obj, subobj);
559 evas_object_box_insert_before(wd->box, subobj, before);
563 * This adds adds an object to the box after the indicated object
565 * This will add the @p subobj to the box indicated after the object
566 * indicated with @p after. If @p after is not already in the box, results
567 * are undefined. After means either to the right of the indicated object or
568 * below it depending on orientation.
570 * @param obj The box object
571 * @param subobj The object to add to the box
572 * @param after The object after which to add it
577 elm_box_pack_after(Evas_Object *obj, Evas_Object *subobj, Evas_Object *after)
579 ELM_CHECK_WIDTYPE(obj, widtype);
580 Widget_Data *wd = elm_widget_data_get(obj);
582 elm_widget_sub_object_add(obj, subobj);
583 evas_object_box_insert_after(wd->box, subobj, after);
587 * This clears the box items
589 * This delete all members of the box object, but not the box itself.
591 * @param obj The box object
596 elm_box_clear(Evas_Object *obj)
598 ELM_CHECK_WIDTYPE(obj, widtype);
599 Widget_Data *wd = elm_widget_data_get(obj);
601 evas_object_box_remove_all(wd->box, EINA_TRUE);
605 * This unpack a box item
607 * This unpack the selected member from the box object, but does not delete
608 * the box itself or the packed items.
610 * @param obj The box object
615 elm_box_unpack(Evas_Object *obj, Evas_Object *subobj)
617 ELM_CHECK_WIDTYPE(obj, widtype);
618 Widget_Data *wd = elm_widget_data_get(obj);
620 evas_object_box_remove(wd->box, subobj);
624 * This unpack the box items
626 * This unpack all members from the box object, but does not delete
627 * the box itself or the packed items.
629 * @param obj The box object
634 elm_box_unpack_all(Evas_Object *obj)
636 ELM_CHECK_WIDTYPE(obj, widtype);
637 Widget_Data *wd = elm_widget_data_get(obj);
639 evas_object_box_remove_all(wd->box, EINA_FALSE);
643 * Set the callback layout function (@p cb) to the @p obj elm_box class.
645 * This function will use evas_object_box_layout_set() to set @p cb as the
646 * layout callback function for this box object.
647 * All layout funtions from evas_object_box can be used as @p cb. Some examples
648 * are evas_object_box_layout_horizontal, evas_object_box_layout_vertical and
649 * evas_object_box_layout_stack. elm_box_layout_transition can also be used.
650 * If @p cb is NULL, the default layout function from elm_box will be used.
652 * @note Changing the layout function will make horizontal/homogeneous fields
653 * from Widget_Data have NO further usage as they are controlled by default
654 * layout function. So calling elm_box_horizontal_set() or
655 * elm_box_homogenous_set() won't affect layout behavior.
657 * @param obj The box object
658 * @param cb The callback function used for layout
659 * @param data Data that will be passed to layout function
660 * @param free_data Function called to free @p data
665 elm_box_layout_set(Evas_Object *obj, Evas_Object_Box_Layout cb, const void *data, void (*free_data)(void *data))
667 ELM_CHECK_WIDTYPE(obj, widtype);
668 Widget_Data *wd = elm_widget_data_get(obj);
672 evas_object_box_layout_set(wd->box, cb, data, free_data);
674 evas_object_box_layout_set(wd->box, _layout, obj, NULL);
678 * Layout function which display a transition animation from start layout to end layout.
680 * This function should no be called directly. It may be used by elm_box_layout_set() or
681 * evas_object_box_layout_set() as a layout function.
682 * The @p data passed to this function must be a Elm_Box_Transition*, that can be created
683 * using elm_box_transition_new() and freed with elm_box_transition_free().
687 * Evas_Object *box = elm_box_add(parent);
688 * Elm_Box_Transition *t = elm_box_transition_new(...add params here...);
689 * elm_box_layout_set(box, elm_box_layout_transition, t, elm_box_transition_free);
692 * @see elm_box_transition_new
693 * @see elm_box_transition_free
694 * @see elm_box_layout_set
697 * @warning Do not call this function directly because the @p obj is not the Widget Box
698 * from elm_box_add(), it is the internal Evas_Object of the Widget Box.
701 elm_box_layout_transition(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data)
703 Elm_Box_Transition *box_data = data;
704 const double curtime = ecore_loop_time_get();
706 if (box_data->animation_ended)
708 box_data->end.layout(obj, priv, box_data->end.data);
712 if (!box_data->animator)
714 if (!_transition_layout_animation_start(obj, priv, box_data,
715 _transition_animation))
720 if (box_data->recalculate)
722 _transition_layout_calculate_coords(obj, priv, box_data);
723 box_data->recalculate = EINA_FALSE;
727 if ((curtime >= box_data->duration + box_data->initial_time))
728 _transition_layout_animation_stop(box_data);
730 _transition_layout_animation_exec(obj, priv, box_data, curtime);
734 * Create a new Elm_Box_Transition setted with informed parameters.
736 * The returned instance may be used as data parameter to elm_box_layout_transition()
737 * and should be freed with elm_box_transition_free().
739 * @param start_layout The layout function that will be used to start the animation
740 * @param start_layout_data The data to be passed the @p start_layout function
741 * @param start_layout_free_data Function to free @p start_layout_data
742 * @param end_layout The layout function that will be used to end the animation
743 * @param end_layout_free_data The data to be passed the @p end_layout function
744 * @param end_layout_free_data Function to free @p end_layout_data
745 * @param transition_end_cb Callback function called when animation ends
746 * @param transition_end_data Data to be passed to @p transition_end_cb
747 * @return An instance of Elm_Box_Transition setted with informed parameters
749 * @see elm_box_transition_new
750 * @see elm_box_layout_transition
754 EAPI Elm_Box_Transition *
755 elm_box_transition_new(const double duration,
756 Evas_Object_Box_Layout start_layout, void *start_layout_data,
757 void(*start_layout_free_data)(void *data),
758 Evas_Object_Box_Layout end_layout, void *end_layout_data,
759 void(*end_layout_free_data)(void *data),
760 void(*transition_end_cb)(void *data),
761 void *transition_end_data)
763 Elm_Box_Transition *box_data;
765 EINA_SAFETY_ON_NULL_RETURN_VAL(start_layout, NULL);
766 EINA_SAFETY_ON_NULL_RETURN_VAL(end_layout, NULL);
768 box_data = calloc(1, sizeof(Elm_Box_Transition));
772 box_data->start.layout = start_layout;
773 box_data->start.data = start_layout_data;
774 box_data->start.free_data = start_layout_free_data;
775 box_data->end.layout = end_layout;
776 box_data->end.data = end_layout_data;
777 box_data->end.free_data = end_layout_free_data;
778 box_data->duration = duration;
779 box_data->transition_end_cb = transition_end_cb;
780 box_data->transition_end_data = transition_end_data;
785 * Free a Elm_Box_Transition instance created with elm_box_transition_new().
787 * @param data The Elm_Box_Transition instance to be freed.
789 * @see elm_box_transition_new
790 * @see elm_box_layout_transition
795 elm_box_transition_free(void *data)
797 EINA_SAFETY_ON_NULL_RETURN(data);
799 Transition_Animation_Data *tad;
800 Elm_Box_Transition *box_data = data;
801 if ((box_data->start.free_data) && (box_data->start.data))
802 box_data->start.free_data(box_data->start.data);
803 if ((box_data->end.free_data) && (box_data->end.data))
804 box_data->end.free_data(box_data->end.data);
805 EINA_LIST_FREE(box_data->objs, tad)
807 evas_object_event_callback_del(box_data->box, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb);
808 evas_object_smart_callback_del(box_data->box, SIG_CHILD_ADDED, _transition_layout_child_added);
809 evas_object_smart_callback_del(box_data->box, SIG_CHILD_REMOVED, _transition_layout_child_removed);
810 if (box_data->animator)
812 ecore_animator_del(box_data->animator);
813 box_data->animator = NULL;
819 * Retrieve the list of children packed into an elm_box
821 * @param obj The Elm_Box
825 EAPI const Eina_List *
826 elm_box_children_get(const Evas_Object *obj)
828 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
829 Widget_Data *wd = elm_widget_data_get(obj);
830 if (!wd) return NULL;
831 return evas_object_box_children_get(wd->box);
835 * Set the space (padding) between the box's elements.
837 * @param obj The Elm_Box
838 * @param horizontal The horizontal space between elements
839 * @param vertical The vertical space between elements
844 elm_box_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertical)
846 ELM_CHECK_WIDTYPE(obj, widtype);
847 Widget_Data *wd = elm_widget_data_get(obj);
849 evas_object_box_padding_set(wd->box, horizontal, vertical);
853 * Get the space (padding) between the box's elements.
855 * @param obj The Elm_Box
856 * @param horizontal The horizontal space between elements
857 * @param vertical The vertical space between elements
862 elm_box_padding_get(const Evas_Object *obj, Evas_Coord *horizontal, Evas_Coord *vertical)
864 ELM_CHECK_WIDTYPE(obj, widtype);
865 Widget_Data *wd = elm_widget_data_get(obj);
867 evas_object_box_padding_get(wd->box, horizontal, vertical);
871 * Set the alignment of the whole bouding box of contents.
873 * @param obj The Elm_Box
874 * @param horizontal The horizontal alignment of elements
875 * @param vertical The vertical alignment of elements
880 elm_box_align_set(Evas_Object *obj, double horizontal, double vertical)
882 ELM_CHECK_WIDTYPE(obj, widtype);
883 Widget_Data *wd = elm_widget_data_get(obj);
885 evas_object_box_align_set(wd->box, horizontal, vertical);
889 * Get the alignment of the whole bouding box of contents.
891 * @param obj The Elm_Box
892 * @param horizontal The horizontal alignment of elements
893 * @param vertical The vertical alignment of elements
898 elm_box_align_get(const Evas_Object *obj, double *horizontal, double *vertical)
900 ELM_CHECK_WIDTYPE(obj, widtype);
901 Widget_Data *wd = elm_widget_data_get(obj);
903 evas_object_box_align_get(wd->box, horizontal, vertical);
909 * If enabled, box aligns all items within the box size(width). When the total min size of the items is greater than the box size, box aligns items to the next line like line wrapping in multiline text.
911 * @param obj The box object
912 * @param extended The extended mode flag (1 = on, 0 = off)
917 elm_box_extended_mode_set(Evas_Object *obj, Eina_Bool extended)
919 ELM_CHECK_WIDTYPE(obj, widtype);
920 Widget_Data *wd = elm_widget_data_get(obj);
922 wd->extended = !!extended;
924 wd->horizontal = 1; /* Do NOT support vertical extended mode */
925 evas_object_smart_calculate(wd->box);
929 * Get the extended mode
931 * @param obj The box object
932 * @return If is extended mode
937 elm_box_extended_mode_get(const Evas_Object *obj)
939 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
940 Widget_Data *wd = elm_widget_data_get(obj);
941 if (!wd) return EINA_FALSE;