summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-02-16 11:34:50 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 12:54:39 +0200
commite32225568ddbee9301f07c4d062ed977abcb14ac (patch)
treef9d690f65c76c5f874703835a4020091ad372e42
parent6f00127d444213a2a3b2fc4788ef5cb3b9882be9 (diff)
settingswidget: pass group and file instead of a evas_object
-rw-r--r--src/bin/test_settingspane.c26
-rw-r--r--src/lib/elc_settingspane.c47
-rw-r--r--src/lib/elm_settingspane.eo6
3 files changed, 52 insertions, 27 deletions
diff --git a/src/bin/test_settingspane.c b/src/bin/test_settingspane.c
index 832b5c3e1..9edab693c 100644
--- a/src/bin/test_settingspane.c
+++ b/src/bin/test_settingspane.c
@@ -217,7 +217,7 @@ recreate_focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info E
217void 217void
218test_settingspane(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 218test_settingspane(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
219{ 219{
220 Evas_Object *win, *o, *box, *sw, *btnbox, *ic, *swallow; 220 Evas_Object *win, *o, *box, *sw, *btnbox, *swallow;
221 Elm_Settingspane_Item *it, *it2; 221 Elm_Settingspane_Item *it, *it2;
222 char buf[PATH_MAX]; 222 char buf[PATH_MAX];
223 223
@@ -246,37 +246,25 @@ test_settingspane(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
246 { 246 {
247 snprintf(buf, sizeof(buf), "%s/images/%s", 247 snprintf(buf, sizeof(buf), "%s/images/%s",
248 elm_app_data_dir_get(), simple_menu[i][2]); 248 elm_app_data_dir_get(), simple_menu[i][2]);
249 ic = elm_icon_add(win);
250 elm_image_file_set(ic, buf, NULL);
251 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
252 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
253 249
254 it = elm_settingspane_item_append(sw, ic, simple_menu[i][0], 250 it = elm_settingspane_item_append(sw, buf, simple_menu[i][0],
255 simple_menu[i][1], ic, NULL); 251 simple_menu[i][1], buf, NULL, NULL);
256 elm_settingspane_item_attach_panel(it, content_cb[i], reset_cb, apply_cb); 252 elm_settingspane_item_attach_panel(it, content_cb[i], reset_cb, apply_cb);
257 } 253 }
258 254
259 /* A complex item! */ 255 /* A complex item! */
260 ic = elm_icon_add(win);
261 snprintf(buf, sizeof(buf), "%s/images/%s", 256 snprintf(buf, sizeof(buf), "%s/images/%s",
262 elm_app_data_dir_get(), "icon_09.png"); 257 elm_app_data_dir_get(), "icon_09.png");
263 elm_image_file_set(ic, buf, NULL);
264 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
265 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
266 258
267 it = elm_settingspane_item_append(sw, ic, "Complex", 259 it = elm_settingspane_item_append(sw, NULL, "Complex",
268 "No we are not going to jump here into<br>complex numbers,<br>this is just a complex menu item,<br>this means it has childrens!", 260 "No we are not going to jump here into<br>complex numbers,<br>this is just a complex menu item,<br>this means it has childrens!",
269 ic, NULL); 261 buf, NULL, NULL);
270 elm_settingspane_item_keywords_set(it, eina_stringshare_add("Hardone,second")); 262 elm_settingspane_item_keywords_set(it, eina_stringshare_add("Hardone,second"));
271 ic = elm_icon_add(win);
272 snprintf(buf, sizeof(buf), "%s/images/%s", 263 snprintf(buf, sizeof(buf), "%s/images/%s",
273 elm_app_data_dir_get(), "bubble.png"); 264 elm_app_data_dir_get(), "bubble.png");
274 elm_image_file_set(ic, buf, NULL); 265 it2 = elm_settingspane_item_append(sw, NULL, "Child",
275 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
276 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
277 it2 = elm_settingspane_item_append(sw, ic, "Child",
278 "This is a children entry", 266 "This is a children entry",
279 ic, it); 267 buf, NULL, it);
280 elm_settingspane_item_keywords_set(it2, eina_stringshare_add("Heavyone,Third,")); 268 elm_settingspane_item_keywords_set(it2, eina_stringshare_add("Heavyone,Third,"));
281 elm_settingspane_item_attach_panel(it2, content_cb[3], reset_cb, apply_cb); 269 elm_settingspane_item_attach_panel(it2, content_cb[3], reset_cb, apply_cb);
282 270
diff --git a/src/lib/elc_settingspane.c b/src/lib/elc_settingspane.c
index 5debafcb7..2110270c4 100644
--- a/src/lib/elc_settingspane.c
+++ b/src/lib/elc_settingspane.c
@@ -1409,14 +1409,49 @@ _elm_settingspane_eo_base_constructor(Eo *obj, Elm_Settingspane_Data *pd)
1409 pd->itcc->func.content_get = _elm_settingspane_ii_content_cb; 1409 pd->itcc->func.content_get = _elm_settingspane_ii_content_cb;
1410} 1410}
1411 1411
1412static Evas_Object*
1413_elm_settingspane_icon_gen(Evas_Object *par, const char *file, const char *group)
1414{
1415 Evas_Object *ic;
1416
1417 ic = elm_icon_add(par);
1418
1419 if (group && file)
1420 {
1421 //we have a edje file
1422 elm_image_file_set(ic, file, group);
1423 }
1424 else if (!group && file)
1425 {
1426 //we have a normal file
1427 elm_image_file_set(ic, file, group);
1428 }
1429 else if (group && !file)
1430 {
1431 //we have a standart icon
1432 elm_icon_standard_set(ic, group);
1433 }
1434 else
1435 {
1436 evas_object_del(ic);
1437 return NULL;
1438 }
1439 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1440 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
1441 return ic;
1442}
1443
1412static Elm_Settingspane_Item * 1444static Elm_Settingspane_Item *
1413_elm_settingspane_item_append_full(Eo *obj, Elm_Settingspane_Data *pd, void *data, 1445_elm_settingspane_item_append_full(Eo *obj, Elm_Settingspane_Data *pd, void *data,
1414 const char *name, const char *description, 1446 const char *name, const char *description,
1415 Evas_Object *icon, Elm_Settingspane_Item *par, 1447 const char *file, const char *group,
1416 Elm_Settingspane_Item *rel) 1448 Elm_Settingspane_Item *par, Elm_Settingspane_Item *rel)
1417{ 1449{
1418 Elm_Settingspane_Item *new_child = NULL; 1450 Elm_Settingspane_Item *new_child = NULL;
1419 Elm_Settingspane_Item_Data *data_par; 1451 Elm_Settingspane_Item_Data *data_par;
1452 Evas_Object *icon;
1453
1454 icon = _elm_settingspane_icon_gen(obj, file, group);
1420 1455
1421 /* 1456 /*
1422 * Append to the zero level 1457 * Append to the zero level
@@ -1445,17 +1480,17 @@ _elm_settingspane_item_append_full(Eo *obj, Elm_Settingspane_Data *pd, void *dat
1445} 1480}
1446 1481
1447EOLIAN static Elm_Settingspane_Item * 1482EOLIAN static Elm_Settingspane_Item *
1448_elm_settingspane_item_append(Eo *obj, Elm_Settingspane_Data *pd, void *data, const char *name, const char *description, Evas_Object *icon, Elm_Settingspane_Item *par) 1483_elm_settingspane_item_append(Eo *obj, Elm_Settingspane_Data *pd, void *data, const char *name, const char *description, const char *file, const char *group, Elm_Settingspane_Item *par)
1449{ 1484{
1450 return _elm_settingspane_item_append_full(obj, pd, data, name, description, icon, par, NULL); 1485 return _elm_settingspane_item_append_full(obj, pd, data, name, description, file, group, par, NULL);
1451} 1486}
1452 1487
1453EOLIAN static Elm_Settingspane_Item * 1488EOLIAN static Elm_Settingspane_Item *
1454_elm_settingspane_item_append_relative(Eo *obj, Elm_Settingspane_Data *pd, void *data, const char *name, const char *description, Evas_Object *icon, Elm_Settingspane_Item *rel) 1489_elm_settingspane_item_append_relative(Eo *obj, Elm_Settingspane_Data *pd, void *data, const char *name, const char *description, const char *file, const char *group, Elm_Settingspane_Item *rel)
1455{ 1490{
1456 EINA_SAFETY_ON_NULL_RETURN_VAL(rel, NULL); 1491 EINA_SAFETY_ON_NULL_RETURN_VAL(rel, NULL);
1457 Elm_Settingspane_Item_Data *id = eo_data_scope_get(rel, ELM_SETTINGSPANE_ITEM_CLASS); 1492 Elm_Settingspane_Item_Data *id = eo_data_scope_get(rel, ELM_SETTINGSPANE_ITEM_CLASS);
1458 return _elm_settingspane_item_append_full(obj, pd, data, name, description, icon, id->par, rel); 1493 return _elm_settingspane_item_append_full(obj, pd, data, name, description, file, group, id->par, rel);
1459} 1494}
1460 1495
1461/* Item implement */ 1496/* Item implement */
diff --git a/src/lib/elm_settingspane.eo b/src/lib/elm_settingspane.eo
index 87184860e..1efb9d820 100644
--- a/src/lib/elm_settingspane.eo
+++ b/src/lib/elm_settingspane.eo
@@ -47,7 +47,8 @@ class Elm_Settingspane(Elm_Layout)
47 47
48 @in const(char) *name; /*@ name of the item */ 48 @in const(char) *name; /*@ name of the item */
49 @in const(char) *description; /*@ the description of the item */ 49 @in const(char) *description; /*@ the description of the item */
50 @in Evas_Object *icon; /*@ the icon to show in the menu */ 50 @in const(char) *file; /*@ The file of the icon to display, NULL if it is a standart fdo icon.*/
51 @in const(char) *group; /*@ The group of the icon to display, NULL if it is a png file, or the name of a standart fdo icon to use. */
51 @in Elm_Settingspane_Item *par; /*@ parent of this item, it will be shown when the parent item is selected. If NULL it will be appended to the 0 lvl */ 52 @in Elm_Settingspane_Item *par; /*@ parent of this item, it will be shown when the parent item is selected. If NULL it will be appended to the 0 lvl */
52 } 53 }
53 } 54 }
@@ -70,7 +71,8 @@ class Elm_Settingspane(Elm_Layout)
70 @in void *data; /*@ data to attach to the item which gets passed to the callback */ 71 @in void *data; /*@ data to attach to the item which gets passed to the callback */
71 @in const(char) *name; /*@ name of the item */ 72 @in const(char) *name; /*@ name of the item */
72 @in const(char) *description; /*@ the description of the item */ 73 @in const(char) *description; /*@ the description of the item */
73 @in Evas_Object *icon; /*@ the icon to show in the menu */ 74 @in const(char) *file; /*@ The file of the icon to display, NULL if it is a standart fdo icon.*/
75 @in const(char) *group; /*@ The group of the icon to display, NULL if it is a png file, or the name of a standart fdo icon to use. */
74 @in Elm_Settingspane_Item *rel; /*@ the item after which the current one will be appended, if NULL the call will fail!*/ 76 @in Elm_Settingspane_Item *rel; /*@ the item after which the current one will be appended, if NULL the call will fail!*/
75 } 77 }
76 } 78 }