summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabhi <a.aryadipta@samsung.com>2013-12-02 16:10:53 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-02 16:11:51 +0900
commitf4f2e5d24271cc6504443479381fdb26a605ac70 (patch)
tree6a377cb4585bfe8c514c5c3443ccf8e67b762513
parent7187a3124fc6c169fcfec2c249a1fd483481fbba (diff)
[Popup] Adding elm_popup_align_set and elm_popup_align_get api
Summary: Added support for popup align set Test Plan: elm_popup_align_set, elm_popup_align_get, elementary_test -to popup Reviewers: seoz, singh.amitesh Differential Revision: https://phab.enlightenment.org/D321
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/bin/test_popup.c62
-rw-r--r--src/lib/elc_popup.c38
-rw-r--r--src/lib/elc_popup_eo.h28
-rw-r--r--src/lib/elc_popup_legacy.h28
6 files changed, 161 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 56975bb58..b965f2c64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1660,6 +1660,10 @@
1660 position. This actually reduces the mapbuf calculation time muchly in 1660 position. This actually reduces the mapbuf calculation time muchly in
1661 case of complex layout. 1661 case of complex layout.
1662 1662
16632013-09-30 Abhinandan Aryadipta (aryarockstar)
1664
1665 * Popup: Added elm_popup_align_set() and elm_popup_align_get() APIs.
1666
16632013-10-01 Ryuan Choi (ryuan) 16672013-10-01 Ryuan Choi (ryuan)
1664 1668
1665 * fileselector: Add the configuration fileselector_double_tap_navigation_enable. 1669 * fileselector: Add the configuration fileselector_double_tap_navigation_enable.
diff --git a/NEWS b/NEWS
index ad461b402..8f1bceedf 100644
--- a/NEWS
+++ b/NEWS
@@ -113,6 +113,7 @@ Additions:
113 * Add elm_menu_item_subitems_clear(). 113 * Add elm_menu_item_subitems_clear().
114 * Add the configuration fileselector_double_tap_navigation_enable. 114 * Add the configuration fileselector_double_tap_navigation_enable.
115 * Add "activated" smart callback for fileselector. 115 * Add "activated" smart callback for fileselector.
116 * Add elm_popup_align_set() and elm_popup_align_get().
116 * Add elm_object_item_signal_emit support in hoversel. This works only when the item is created. 117 * Add elm_object_item_signal_emit support in hoversel. This works only when the item is created.
117 * Add elm_fileselector_multi_select_set/get() and elm_fileselector_selected_paths_get to support multi-selection. 118 * Add elm_fileselector_multi_select_set/get() and elm_fileselector_selected_paths_get to support multi-selection.
118 * Add elm_fileselector_hidden_visible_set/get() to show or hide hidden files/directories. 119 * Add elm_fileselector_hidden_visible_set/get() to show or hide hidden files/directories.
diff --git a/src/bin/test_popup.c b/src/bin/test_popup.c
index 4c5de283f..c25486a9c 100644
--- a/src/bin/test_popup.c
+++ b/src/bin/test_popup.c
@@ -3,9 +3,25 @@
3#endif 3#endif
4#include <Elementary.h> 4#include <Elementary.h>
5 5
6#define POPUP_POINT_MAX 6
7
8typedef struct
9{
10 double x;
11 double y;
12}Evas_Rel_Coord_Point;
6 13
7static Evas_Object *g_popup = NULL; 14static Evas_Object *g_popup = NULL;
8static int times = 0; 15static int times = 0;
16static Evas_Rel_Coord_Point _popup_point[POPUP_POINT_MAX] =
17{
18 { 0.01, 0.01 },
19 { 0.2, 0.2 },
20 { 0.5, 0.5 },
21 { 0.99, 0.01 },
22 { 0.01, 0.99 },
23 { 0.99, 0.99 }
24};
9 25
10static void 26static void
11_response_cb(void *data EINA_UNUSED, Evas_Object *obj, 27_response_cb(void *data EINA_UNUSED, Evas_Object *obj,
@@ -22,6 +38,23 @@ _popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED,
22} 38}
23 39
24static void 40static void
41_popup_move_cb(void *data, Evas_Object *obj EINA_UNUSED,
42 void *event_info EINA_UNUSED)
43{
44 static int k = 0;
45 double h = -1, v = -1;
46
47 elm_popup_align_set(data, _popup_point[k].x, _popup_point[k].y);
48 elm_popup_align_get(data, &h, &v);
49
50 printf("elm_popup_align_get :: Aligned: %lf %lf\n", h, v);
51
52 k++;
53 if (k >= POPUP_POINT_MAX)
54 k = 0;
55}
56
57static void
25_g_popup_response_cb(void *data, Evas_Object *obj EINA_UNUSED, 58_g_popup_response_cb(void *data, Evas_Object *obj EINA_UNUSED,
26 void *event_info EINA_UNUSED) 59 void *event_info EINA_UNUSED)
27{ 60{
@@ -498,6 +531,33 @@ _popup_transparent_cb(void *data, Evas_Object *obj EINA_UNUSED,
498} 531}
499 532
500static void 533static void
534_popup_transparent_move_cb(void *data, Evas_Object *obj EINA_UNUSED,
535 void *event_info EINA_UNUSED)
536{
537 Evas_Object *popup;
538 Evas_Object *btn, *btn1;
539
540 popup = elm_popup_add(data);
541 elm_object_style_set(popup, "transparent");
542 elm_object_text_set(popup, "This Popup has transparent background");
543
544 // popup buttons
545 btn = elm_button_add(popup);
546 elm_object_text_set(btn, "Move");
547 elm_object_part_content_set(popup, "button1", btn);
548 evas_object_smart_callback_add(btn, "clicked", _popup_move_cb, popup);
549
550 btn1 = elm_button_add(popup);
551 elm_object_text_set(btn1, "Close");
552 elm_object_part_content_set(popup, "button2", btn1);
553 evas_object_smart_callback_add(btn1, "clicked", _popup_close_cb, popup);
554
555 // popup show should be called after adding all the contents and the buttons
556 // of popup to set the focus into popup's contents correctly.
557 evas_object_show(popup);
558}
559
560static void
501_list_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 561_list_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
502{ 562{
503 evas_object_del(data); 563 evas_object_del(data);
@@ -578,6 +638,8 @@ test_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
578 _popup_center_text_3button_add_remove_button_cb, win); 638 _popup_center_text_3button_add_remove_button_cb, win);
579 elm_list_item_append(list, "popup-transparent", NULL, NULL, 639 elm_list_item_append(list, "popup-transparent", NULL, NULL,
580 _popup_transparent_cb, win); 640 _popup_transparent_cb, win);
641 elm_list_item_append(list, "popup-transparent-move", NULL, NULL,
642 _popup_transparent_move_cb, win);
581 elm_list_item_append(list, "popup-center-title + list content + 1 button", 643 elm_list_item_append(list, "popup-center-title + list content + 1 button",
582 NULL, NULL, _popup_center_title_list_content_1button_cb, 644 NULL, NULL, _popup_center_title_list_content_1button_cb,
583 win); 645 win);
diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c
index 0feb55c60..46fc9bd58 100644
--- a/src/lib/elc_popup.c
+++ b/src/lib/elc_popup.c
@@ -1756,6 +1756,40 @@ _orient_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1756} 1756}
1757 1757
1758EAPI void 1758EAPI void
1759elm_popup_align_set(Evas_Object *obj, double horizontal, double vertical)
1760{
1761 ELM_POPUP_CHECK(obj);
1762 eo_do(obj, elm_obj_popup_align_set(horizontal, vertical));
1763}
1764
1765static void
1766_align_set(Eo *obj, void *_pd, va_list *list)
1767{
1768 double horizontal = va_arg(*list, double);
1769 double vertical = va_arg(*list, double);
1770 Elm_Popup_Smart_Data *sd = _pd;
1771
1772 elm_notify_align_set(sd->notify, horizontal, vertical);
1773}
1774
1775EAPI void
1776elm_popup_align_get(const Evas_Object *obj, double *horizontal, double *vertical)
1777{
1778 ELM_POPUP_CHECK(obj);
1779 eo_do((Eo *) obj, elm_obj_popup_align_get(horizontal, vertical));
1780}
1781
1782static void
1783_align_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1784{
1785 double *horizontal = va_arg(*list, double *);
1786 double *vertical = va_arg(*list, double *);
1787 Elm_Popup_Smart_Data *sd = _pd;
1788
1789 elm_notify_align_get(sd->notify, horizontal, vertical);
1790}
1791
1792EAPI void
1759elm_popup_timeout_set(Evas_Object *obj, 1793elm_popup_timeout_set(Evas_Object *obj,
1760 double timeout) 1794 double timeout)
1761{ 1795{
@@ -1922,6 +1956,8 @@ _class_constructor(Eo_Class *klass)
1922 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET), _allow_events_set), 1956 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET), _allow_events_set),
1923 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET), _allow_events_get), 1957 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET), _allow_events_get),
1924 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), _item_append), 1958 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), _item_append),
1959 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_SET), _align_set),
1960 EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_GET), _align_get),
1925 EO_OP_FUNC_SENTINEL 1961 EO_OP_FUNC_SENTINEL
1926 }; 1962 };
1927 eo_class_funcs_set(klass, func_desc); 1963 eo_class_funcs_set(klass, func_desc);
@@ -1938,6 +1974,8 @@ static const Eo_Op_Description op_desc[] = {
1938 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET, "Sets whether events should be passed to by a click outside."), 1974 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET, "Sets whether events should be passed to by a click outside."),
1939 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET, "Returns value indicating whether allow event is enabled or not."), 1975 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET, "Returns value indicating whether allow event is enabled or not."),
1940 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND, "Add a new item to a Popup object."), 1976 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND, "Add a new item to a Popup object."),
1977 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALIGN_SET, "Set the popup alignment relative to its parent."),
1978 EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALIGN_GET, "Return the popup alignment relative to its parent."),
1941 EO_OP_DESCRIPTION_SENTINEL 1979 EO_OP_DESCRIPTION_SENTINEL
1942}; 1980};
1943static const Eo_Class_Description class_desc = { 1981static const Eo_Class_Description class_desc = {
diff --git a/src/lib/elc_popup_eo.h b/src/lib/elc_popup_eo.h
index 6d0910937..835a3a18a 100644
--- a/src/lib/elc_popup_eo.h
+++ b/src/lib/elc_popup_eo.h
@@ -20,6 +20,8 @@ enum
20 ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET, 20 ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET,
21 ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET, 21 ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET,
22 ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND, 22 ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND,
23 ELM_OBJ_POPUP_SUB_ID_ALIGN_SET,
24 ELM_OBJ_POPUP_SUB_ID_ALIGN_GET,
23 ELM_OBJ_POPUP_SUB_ID_LAST 25 ELM_OBJ_POPUP_SUB_ID_LAST
24}; 26};
25 27
@@ -138,6 +140,32 @@ enum
138 * @see elm_popup_item_append 140 * @see elm_popup_item_append
139 */ 141 */
140#define elm_obj_popup_item_append(label, icon, func, data, ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), EO_TYPECHECK(const char *, label), EO_TYPECHECK(Evas_Object *, icon), EO_TYPECHECK(Evas_Smart_Cb, func), EO_TYPECHECK(const void *, data), EO_TYPECHECK(Elm_Object_Item **, ret) 142#define elm_obj_popup_item_append(label, icon, func, data, ret) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), EO_TYPECHECK(const char *, label), EO_TYPECHECK(Evas_Object *, icon), EO_TYPECHECK(Evas_Smart_Cb, func), EO_TYPECHECK(const void *, data), EO_TYPECHECK(Elm_Object_Item **, ret)
143
144/**
145 * @def elm_obj_popup_align_set
146 * @since 1.8
147 *
148 * @brief Set the alignment of the popup object relative to its parent
149 *
150 * @param[in] horizontal
151 * @param[in] vertical
152 *
153 * @see elm_popup_align_set
154 */
155#define elm_obj_popup_align_set(horizontal, vertical) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_SET), EO_TYPECHECK(double, horizontal), EO_TYPECHECK(double, vertical)
156
157/**
158 * @def elm_obj_popup_align_get
159 * @since 1.8
160 *
161 * @brief Return the alignment of the popup object relative to its parent
162 *
163 * @param[out] horizontal
164 * @param[out] vertical
165 *
166 * @see elm_popup_align_get
167 */
168#define elm_obj_popup_align_get(horizontal, vertical) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_GET), EO_TYPECHECK(double *, horizontal), EO_TYPECHECK(double *, vertical)
141/** 169/**
142 * @} 170 * @}
143 */ 171 */
diff --git a/src/lib/elc_popup_legacy.h b/src/lib/elc_popup_legacy.h
index 0f2d08f52..189bcb264 100644
--- a/src/lib/elc_popup_legacy.h
+++ b/src/lib/elc_popup_legacy.h
@@ -136,3 +136,31 @@ EAPI Eina_Bool elm_popup_allow_events_get(const Evas_Object *obj);
136 * and item(s) can be there in a popup content area. 136 * and item(s) can be there in a popup content area.
137 */ 137 */
138EAPI Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1); 138EAPI Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
139
140/**
141 * @brief Set the alignment of the popup object
142 *
143 * @param obj popup object
144 * @param horizontal The horizontal alignment of the popup
145 * @param vertical The vertical alignment of the popup
146 *
147 * Sets the alignment in which the popup will appear in its parent.
148 *
149 * @since 1.9
150 * @ingroup Popup
151 */
152EAPI void elm_popup_align_set(Evas_Object *obj, double horizontal, double vertical);
153
154/**
155 * @brief Get the alignment of the popup object
156 * @param obj The popup object
157 * @param horizontal The horizontal alignment of the popup
158 * @param vertical The vertical alignment of the popup
159 *
160 * @see elm_popup_align_set()
161 *
162 * @since 1.9
163 * @ingroup Popup
164 */
165EAPI void elm_popup_align_get(const Evas_Object *obj, double *horizontal, double *vertical);
166