summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2012-01-02 10:40:17 +0000
committerChunEon Park <hermet@hermet.pe.kr>2012-01-02 10:40:17 +0000
commitfc67742bf2a45e8ea1752130678bd2b3d4385fca (patch)
treef548d3c023fd858c1e25df25d0ddb1a0df24c2e3 /src
parent39552d4a848ffac1b826efbb5c978a63e22e05f3 (diff)
elementary/multibuttonentry - deprecated APIs. Now, let's use elm_common APIs.
elm_multibuttonentry_label_set() elm_multibuttonentry_label_get() elm_multibuttonentry_item_label_set() elm_multibuttonentry_item_label_get() SVN revision: 66739
Diffstat (limited to 'src')
-rw-r--r--src/bin/test_multibuttonentry.c2
-rw-r--r--src/edje_externals/elm_multibuttonentry.c57
-rw-r--r--src/lib/elc_multibuttonentry.c79
-rw-r--r--src/lib/elc_multibuttonentry.h47
-rw-r--r--src/lib/elm_deprecated.h43
5 files changed, 139 insertions, 89 deletions
diff --git a/src/bin/test_multibuttonentry.c b/src/bin/test_multibuttonentry.c
index a203d45ac..be8469190 100644
--- a/src/bin/test_multibuttonentry.c
+++ b/src/bin/test_multibuttonentry.c
@@ -143,7 +143,7 @@ _add_multibuttonentry(Evas_Object *parent)
143 evas_object_show(scr); 143 evas_object_show(scr);
144 144
145 mbe = elm_multibuttonentry_add(parent); 145 mbe = elm_multibuttonentry_add(parent);
146 elm_multibuttonentry_label_set(mbe, "To: "); 146 elm_object_text_set(mbe, "To: ");
147 elm_multibuttonentry_guide_text_set(mbe, "Tap to add recipient"); 147 elm_multibuttonentry_guide_text_set(mbe, "Tap to add recipient");
148 evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 148 evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
149 evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL); 149 evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL);
diff --git a/src/edje_externals/elm_multibuttonentry.c b/src/edje_externals/elm_multibuttonentry.c
index 975076546..723d34d1e 100644
--- a/src/edje_externals/elm_multibuttonentry.c
+++ b/src/edje_externals/elm_multibuttonentry.c
@@ -16,7 +16,7 @@ external_multibuttonentry_state_set(void *data __UNUSED__, Evas_Object *obj, con
16 else return; 16 else return;
17 17
18 if (p->label) 18 if (p->label)
19 elm_multibuttonentry_label_set(obj, p->label); 19 elm_object_text_set(obj, p->label);
20 if (p->guide_text) 20 if (p->guide_text)
21 elm_multibuttonentry_guide_text_set(obj, p->guide_text); 21 elm_multibuttonentry_guide_text_set(obj, p->guide_text);
22} 22}
@@ -26,19 +26,19 @@ external_multibuttonentry_param_set(void *data __UNUSED__, Evas_Object *obj, con
26{ 26{
27 if (!strcmp(param->name, "label")) 27 if (!strcmp(param->name, "label"))
28 { 28 {
29 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 29 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
30 { 30 {
31 elm_multibuttonentry_label_set(obj, param->s); 31 elm_object_text_set(obj, param->s);
32 return EINA_TRUE; 32 return EINA_TRUE;
33 } 33 }
34 } 34 }
35 else if (!strcmp(param->name, "guide text")) 35 else if (!strcmp(param->name, "guide text"))
36 { 36 {
37 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 37 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
38 { 38 {
39 elm_multibuttonentry_guide_text_set(obj, param->s); 39 elm_multibuttonentry_guide_text_set(obj, param->s);
40 return EINA_TRUE; 40 return EINA_TRUE;
41 } 41 }
42 } 42 }
43 43
44 ERR("unknown parameter '%s' of type '%s'", 44 ERR("unknown parameter '%s' of type '%s'",
@@ -52,19 +52,19 @@ external_multibuttonentry_param_get(void *data __UNUSED__, const Evas_Object *ob
52{ 52{
53 if (!strcmp(param->name, "label")) 53 if (!strcmp(param->name, "label"))
54 { 54 {
55 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 55 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
56 { 56 {
57 param->s = elm_multibuttonentry_label_get(obj); 57 param->s = elm_object_text_get(obj);
58 return EINA_TRUE; 58 return EINA_TRUE;
59 } 59 }
60 } 60 }
61 else if (!strcmp(param->name, "guide text")) 61 else if (!strcmp(param->name, "guide text"))
62 { 62 {
63 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 63 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
64 { 64 {
65 param->s = elm_multibuttonentry_guide_text_get(obj); 65 param->s = elm_multibuttonentry_guide_text_get(obj);
66 return EINA_TRUE; 66 return EINA_TRUE;
67 } 67 }
68 } 68 }
69 69
70 ERR("unknown parameter '%s' of type '%s'", 70 ERR("unknown parameter '%s' of type '%s'",
@@ -86,20 +86,19 @@ external_multibuttonentry_params_parse(void *data __UNUSED__, Evas_Object *obj _
86 86
87 EINA_LIST_FOREACH(params, l, param) 87 EINA_LIST_FOREACH(params, l, param)
88 { 88 {
89 if (!strcmp(param->name, "label")) 89 if (!strcmp(param->name, "label"))
90 mem->label = eina_stringshare_add(param->s); 90 mem->label = eina_stringshare_add(param->s);
91 else if (!strcmp(param->name, "guide text")) 91 else if (!strcmp(param->name, "guide text"))
92 mem->guide_text = eina_stringshare_add(param->s); 92 mem->guide_text = eina_stringshare_add(param->s);
93 } 93 }
94 94
95 return mem; 95 return mem;
96} 96}
97 97
98static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, 98static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
99 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
100{ 99{
101 ERR("so content"); 100 ERR("so content");
102 return NULL; 101 return NULL;
103} 102}
104 103
105static void 104static void
diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c
index 39c9608f9..3aed8d13b 100644
--- a/src/lib/elc_multibuttonentry.c
+++ b/src/lib/elc_multibuttonentry.c
@@ -112,6 +112,11 @@ static void _set_vis_guidetext(Evas_Object *obj);
112static void _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv); 112static void _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv);
113static Evas_Coord _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index); 113static Evas_Coord _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index);
114static void _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data); 114static void _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data);
115static void _item_text_set_hook(Elm_Object_Item *it,
116 const char *part,
117 const char *label);
118static const char * _item_text_get_hook(const Elm_Object_Item *it,
119 const char *part);
115 120
116static void 121static void
117_del_hook(Evas_Object *obj) 122_del_hook(Evas_Object *obj)
@@ -794,6 +799,8 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co
794 item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item); 799 item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item);
795 if (item) 800 if (item)
796 { 801 {
802 elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
803 elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
797 elm_widget_item_data_set(item, data); 804 elm_widget_item_data_set(item, data);
798 Evas_Coord rw, vw; 805 Evas_Coord rw, vw;
799 _resize_button(btn, &rw, &vw); 806 _resize_button(btn, &rw, &vw);
@@ -1305,6 +1312,50 @@ _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__
1305 } 1312 }
1306} 1313}
1307 1314
1315static void
1316_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label)
1317{
1318 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1319
1320 Elm_Multibuttonentry_Item *item;
1321 if (part && strcmp(part, "default")) return;
1322 if (!label) return;
1323 item = (Elm_Multibuttonentry_Item *) it;
1324 edje_object_part_text_set(item->button, "elm.btn.text", label);
1325 _resize_button(item->button, &item->rw, &item->vw);
1326}
1327
1328static const char *
1329_item_text_get_hook(const Elm_Object_Item *it, const char *part)
1330{
1331 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1332 Elm_Multibuttonentry_Item *item;
1333 if (part && strcmp(part, "default")) return NULL;
1334 item = (Elm_Multibuttonentry_Item *) it;
1335 return edje_object_part_text_get(item->button, "elm.btn.text");
1336}
1337
1338static void
1339_text_set_hook(Evas_Object *obj, const char *part, const char *label)
1340{
1341 ELM_CHECK_WIDTYPE(obj, widtype);
1342 if (part && strcmp(part, "default")) return;
1343 if (label) _set_label(obj, label);
1344 else _set_label(obj, "");
1345}
1346
1347static const char *
1348_text_get_hook(const Evas_Object *obj, const char *part)
1349{
1350 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1351 Widget_Data *wd;
1352 if (part && strcmp(part, "default")) return NULL;
1353 wd = elm_widget_data_get(obj);
1354 if (!wd) return NULL;
1355 if (wd->label) return edje_object_part_text_get(wd->label, "mbe.label");
1356 return NULL;
1357}
1358
1308EAPI Evas_Object * 1359EAPI Evas_Object *
1309elm_multibuttonentry_add(Evas_Object *parent) 1360elm_multibuttonentry_add(Evas_Object *parent)
1310{ 1361{
@@ -1324,6 +1375,8 @@ elm_multibuttonentry_add(Evas_Object *parent)
1324 elm_widget_event_hook_set(obj, _event_hook); 1375 elm_widget_event_hook_set(obj, _event_hook);
1325 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); 1376 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1326 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); 1377 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1378 elm_widget_text_set_hook_set(obj, _text_set_hook);
1379 elm_widget_text_get_hook_set(obj, _text_get_hook);
1327 1380
1328 wd->base = edje_object_add(e); 1381 wd->base = edje_object_add(e);
1329 _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default"); 1382 _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default");
@@ -1358,25 +1411,13 @@ elm_multibuttonentry_entry_get(const Evas_Object *obj)
1358EAPI const char * 1411EAPI const char *
1359elm_multibuttonentry_label_get(const Evas_Object *obj) 1412elm_multibuttonentry_label_get(const Evas_Object *obj)
1360{ 1413{
1361 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 1414 return _text_get_hook(obj, NULL);
1362 Widget_Data *wd = elm_widget_data_get(obj);
1363
1364 if (!wd) return NULL;
1365 if (wd->label) return edje_object_part_text_get(wd->label, "mbe.label");
1366 return NULL;
1367} 1415}
1368 1416
1369EAPI void 1417EAPI void
1370elm_multibuttonentry_label_set(Evas_Object *obj, const char *label) 1418elm_multibuttonentry_label_set(Evas_Object *obj, const char *label)
1371{ 1419{
1372 ELM_CHECK_WIDTYPE(obj, widtype); 1420 _text_set_hook(obj, NULL, label);
1373 Widget_Data *wd = elm_widget_data_get(obj);
1374
1375 if (!wd) return;
1376 if (label)
1377 _set_label(obj, label);
1378 else
1379 _set_label(obj, "");
1380} 1421}
1381 1422
1382EAPI const char * 1423EAPI const char *
@@ -1552,19 +1593,13 @@ elm_multibuttonentry_item_del(Elm_Object_Item *it)
1552EAPI const char * 1593EAPI const char *
1553elm_multibuttonentry_item_label_get(const Elm_Object_Item *it) 1594elm_multibuttonentry_item_label_get(const Elm_Object_Item *it)
1554{ 1595{
1555 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); 1596 return _item_text_get_hook(it, NULL);
1556 Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *) it;
1557 return edje_object_part_text_get(item->button, "elm.btn.text");
1558} 1597}
1559 1598
1560EAPI void 1599EAPI void
1561elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str) 1600elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str)
1562{ 1601{
1563 ELM_OBJ_ITEM_CHECK_OR_RETURN(it); 1602 _item_text_set_hook(it, NULL, str);
1564 Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *) it;
1565 if (!str) return;
1566 edje_object_part_text_set(item->button, "elm.btn.text", str);
1567 _resize_button(item->button, &item->rw, &item->vw);
1568} 1603}
1569 1604
1570EAPI Elm_Object_Item * 1605EAPI Elm_Object_Item *
diff --git a/src/lib/elc_multibuttonentry.h b/src/lib/elc_multibuttonentry.h
index 7c607a72d..5541d4734 100644
--- a/src/lib/elc_multibuttonentry.h
+++ b/src/lib/elc_multibuttonentry.h
@@ -17,7 +17,15 @@
17 * - @c "unfocused" - when multibuttonentry is unfocused. 17 * - @c "unfocused" - when multibuttonentry is unfocused.
18 * - @c "expanded" - when multibuttonentry is expanded. 18 * - @c "expanded" - when multibuttonentry is expanded.
19 * - @c "shrank" - when multibuttonentry is shrank. 19 * - @c "shrank" - when multibuttonentry is shrank.
20 * - @c "shrank,state,changed" - when shrink mode state of multibuttonentry is changed. 20 * - @c "shrank,state,changed" - when shrink mode state of multibuttonentry is
21 * changed.
22 *
23 * Default text parts of the multibuttonentry widget that you can use for are:
24 * @li "default" - A label of the multibuttonentry
25 *
26 * Default text parts of the multibuttonentry items that you can use for are:
27 * @li "default" - A label of the multibuttonentry item
28 *
21 */ 29 */
22 30
23/** 31/**
@@ -36,23 +44,6 @@ typedef Eina_Bool (*Elm_Multibuttonentry_Item_Filter_callback)
36 */ 44 */
37EAPI Evas_Object *elm_multibuttonentry_add(Evas_Object *parent); 45EAPI Evas_Object *elm_multibuttonentry_add(Evas_Object *parent);
38 46
39/**
40 * Get the label
41 *
42 * @param obj The multibuttonentry object
43 * @return The label, or NULL if none
44 *
45 */
46EAPI const char *elm_multibuttonentry_label_get(const Evas_Object *obj);
47
48/**
49 * Set the label
50 *
51 * @param obj The multibuttonentry object
52 * @param label The text label string
53 *
54 */
55EAPI void elm_multibuttonentry_label_set(Evas_Object *obj, const char *label);
56 47
57/** 48/**
58 * Get the entry of the multibuttonentry object 49 * Get the entry of the multibuttonentry object
@@ -185,7 +176,7 @@ EAPI Elm_Object_Item *elm_multibuttonentry_selected_item_get(const Evas_Object *
185/** 176/**
186 * Set the selected state of an item 177 * Set the selected state of an item
187 * 178 *
188 * @param item The it 179 * @param it The item
189 * @param selected if it's EINA_TRUE, select the item otherwise, unselect the item 180 * @param selected if it's EINA_TRUE, select the item otherwise, unselect the item
190 * 181 *
191 */ 182 */
@@ -216,24 +207,6 @@ EAPI void elm_multibuttonentry_item_del(Elm_Object_Item *i
216EAPI void elm_multibuttonentry_clear(Evas_Object *obj); 207EAPI void elm_multibuttonentry_clear(Evas_Object *obj);
217 208
218/** 209/**
219 * Get the label of a given item
220 *
221 * @param it The item
222 * @return The label of a given item, or NULL if none
223 *
224 */
225EAPI const char *elm_multibuttonentry_item_label_get(const Elm_Object_Item *it);
226
227/**
228 * Set the label of a given item
229 *
230 * @param it The item
231 * @param str The text label string
232 *
233 */
234EAPI void elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str);
235
236/**
237 * Get the previous item in the multibuttonentry 210 * Get the previous item in the multibuttonentry
238 * 211 *
239 * @param it The item 212 * @param it The item
diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h
index cbb558ab9..b8ff947e3 100644
--- a/src/lib/elm_deprecated.h
+++ b/src/lib/elm_deprecated.h
@@ -2544,3 +2544,46 @@ EINA_DEPRECATED EAPI void elm_segment_control_item_label_set(Elm_Ob
2544 * @ingroup SegmentControl 2544 * @ingroup SegmentControl
2545 */ 2545 */
2546EINA_DEPRECATED EAPI void elm_segment_control_item_icon_set(Elm_Object_Item *it, Evas_Object *icon); 2546EINA_DEPRECATED EAPI void elm_segment_control_item_icon_set(Elm_Object_Item *it, Evas_Object *icon);
2547
2548/**
2549 * Get the label
2550 *
2551 * @param obj The multibuttonentry object
2552 * @return The label, or NULL if none
2553 *
2554 * @deprecated Use elm_object_text_get() instead
2555 *
2556 */
2557EINA_DEPRECATED EAPI const char *elm_multibuttonentry_label_get(const Evas_Object *obj);
2558
2559/**
2560 * Set the label
2561 *
2562 * @param obj The multibuttonentry object
2563 * @param label The text label string
2564 *
2565 * @deprecated Use elm_object_text_set() instead
2566 *
2567 */
2568EINA_DEPRECATED EAPI void elm_multibuttonentry_label_set(Evas_Object *obj, const char *label);
2569
2570/**
2571 * Get the label of a given item
2572 *
2573 * @param it The item
2574 * @return The label of a given item, or NULL if none
2575 *
2576 * @deprecated Use elm_object_item_text_get() instead
2577 *
2578 */
2579EINA_DEPRECATED EAPI const char *elm_multibuttonentry_item_label_get(const Elm_Object_Item *it);
2580
2581/**
2582 * Set the label of a given item
2583 *
2584 * @param it The item
2585 * @param str The text label string
2586 *
2587 * @deprecated Use elm_object_item_text_set() instead
2588 */
2589EINA_DEPRECATED EAPI void elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str);