summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-10-06 17:32:19 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-10-06 17:32:19 +0300
commit0538d54f501ff27145721c215552b798c5463137 (patch)
treef4b9b7316be3d279c87814853509f44e111c3493
parente6d1b177d86eac5241c369cdcdbe9147983ace0e (diff)
introduce props_hoversel_resource_files_add() and update hoversel when add resource
-rw-r--r--src/bin/egui_gui/props_helper.c62
-rw-r--r--src/bin/egui_gui/props_helper.h3
-rw-r--r--src/bin/egui_gui/propview.c3
3 files changed, 47 insertions, 21 deletions
diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c
index 3d48a2d..c0a3a92 100644
--- a/src/bin/egui_gui/props_helper.c
+++ b/src/bin/egui_gui/props_helper.c
@@ -234,6 +234,45 @@ props_hoversel_seqs_add(Eo *box, Eo *hover_parent, const Gui_Context *ctx, const
234} 234}
235 235
236Eo * 236Eo *
237props_hoversel_resource_files_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char *default_val, const Gui_Context *ctx)
238{
239 if (!hoversel)
240 {
241 hoversel = eo_add(ELM_HOVERSEL_CLASS, box);
242 eo_do(hoversel, elm_obj_hoversel_hover_parent_set(hover_parent));
243 }
244 elm_hoversel_item_add(hoversel, PROP_HOVERSEL_NONE_VALUE, NULL, ELM_ICON_NONE, NULL, NULL);
245
246 if (!default_val)
247 {
248 default_val = PROP_HOVERSEL_NONE_VALUE;
249 }
250 elm_object_text_set(hoversel, default_val);
251
252 const Eina_List *res_lst, *itr;
253 Dep_Id *res_id;
254 res_lst = gui_context_resource_list_get(ctx, RESOURCE_IMAGE);
255 EINA_LIST_FOREACH(res_lst, itr, res_id)
256 {
257 const Gui_Resource *res = gui_context_resource_get(res_id);
258 elm_hoversel_item_add(hoversel, resource_name_get(res), NULL, ELM_ICON_NONE, NULL, NULL);
259 }
260
261 res_lst = gui_context_resource_list_get(ctx, RESOURCE_EDJE);
262 EINA_LIST_FOREACH(res_lst, itr, res_id)
263 {
264 const Gui_Resource *res = gui_context_resource_get(res_id);
265 if (res) elm_hoversel_item_add(hoversel, resource_name_get(res), NULL, ELM_ICON_NONE, NULL, NULL);
266 }
267
268 eo_do(hoversel, evas_obj_size_hint_weight_set(0.0, 0.0));
269 eo_do(hoversel, evas_obj_size_hint_align_set(0.5, 0.5));
270 if (box) eo_do(box, elm_obj_box_pack_end(hoversel));
271 eo_do(hoversel, evas_obj_visibility_set(EINA_TRUE));
272 return hoversel;
273}
274
275Eo *
237props_value_add(Eo *box, const Gui_Context *ctx, const Gui_Widget *wdg, const Gui_Value *value, const Op_Desc *op, unsigned int par_idx) 276props_value_add(Eo *box, const Gui_Context *ctx, const Gui_Widget *wdg, const Gui_Value *value, const Op_Desc *op, unsigned int par_idx)
238{ 277{
239 Eo *new_obj = NULL; 278 Eo *new_obj = NULL;
@@ -314,9 +353,6 @@ props_value_add(Eo *box, const Gui_Context *ctx, const Gui_Widget *wdg, const Gu
314 } 353 }
315 case GUI_TYPE_FILE: 354 case GUI_TYPE_FILE:
316 { 355 {
317 const Eina_List *itr, *res_lst;
318 Dep_Id *res_id;
319
320 const char *default_str = PROP_HOVERSEL_NONE_VALUE; 356 const char *default_str = PROP_HOVERSEL_NONE_VALUE;
321 if (value) 357 if (value)
322 { 358 {
@@ -324,27 +360,11 @@ props_value_add(Eo *box, const Gui_Context *ctx, const Gui_Widget *wdg, const Gu
324 if (dep_id) default_str = dep_name_get(dep_id); 360 if (dep_id) default_str = dep_name_get(dep_id);
325 if (!default_str) 361 if (!default_str)
326 { 362 {
327 ERR("Looks like resource image vas deleted. Handle this."); 363 ERR("Looks like resource image was deleted. Handle this.");
328 } 364 }
329 } 365 }
330 366
331 /* Create empty list. */ 367 new_obj = props_hoversel_resource_files_add(box, NULL, elm_widget_top_get(box), default_str, wdg_context_get(wdg));
332 new_obj = props_hoversel_enums_add(box, elm_widget_top_get(box), default_str, NULL);
333 elm_hoversel_item_add(new_obj, PROP_HOVERSEL_NONE_VALUE, NULL, ELM_ICON_NONE, NULL, NULL);
334
335 res_lst = gui_context_resource_list_get(wdg_context_get(wdg), RESOURCE_IMAGE);
336 EINA_LIST_FOREACH(res_lst, itr, res_id)
337 {
338 const Gui_Resource *res = gui_context_resource_get(res_id);
339 elm_hoversel_item_add(new_obj, resource_name_get(res), NULL, ELM_ICON_NONE, NULL, NULL);
340 }
341
342 res_lst = gui_context_resource_list_get(wdg_context_get(wdg), RESOURCE_EDJE);
343 EINA_LIST_FOREACH(res_lst, itr, res_id)
344 {
345 const Gui_Resource *res = gui_context_resource_get(res_id);
346 if (res) elm_hoversel_item_add(new_obj, resource_name_get(res), NULL, ELM_ICON_NONE, NULL, NULL);
347 }
348 break; 368 break;
349 } 369 }
350 case GUI_TYPE_OBJECT_ITEM: 370 case GUI_TYPE_OBJECT_ITEM:
diff --git a/src/bin/egui_gui/props_helper.h b/src/bin/egui_gui/props_helper.h
index a8123db..635938f 100644
--- a/src/bin/egui_gui/props_helper.h
+++ b/src/bin/egui_gui/props_helper.h
@@ -31,5 +31,8 @@ Eo *
31props_hoversel_seqs_add(Eo *box, Eo *hover_parent, const Gui_Context *ctx, const char *default_val, Eina_Bool add_empty_field); 31props_hoversel_seqs_add(Eo *box, Eo *hover_parent, const Gui_Context *ctx, const char *default_val, Eina_Bool add_empty_field);
32 32
33Eo * 33Eo *
34props_hoversel_resource_files_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char *default_val, const Gui_Context *ctx);
35
36Eo *
34props_value_add(Eo *box, const Gui_Context *ctx, const Gui_Widget *wdg, const Gui_Value *value, const Op_Desc *op, unsigned int par_idx); 37props_value_add(Eo *box, const Gui_Context *ctx, const Gui_Widget *wdg, const Gui_Value *value, const Op_Desc *op, unsigned int par_idx);
35#endif 38#endif
diff --git a/src/bin/egui_gui/propview.c b/src/bin/egui_gui/propview.c
index 84c79fa..86b54b8 100644
--- a/src/bin/egui_gui/propview.c
+++ b/src/bin/egui_gui/propview.c
@@ -503,6 +503,9 @@ _prop_field_update(const Gui_Widget_Property *prop, Eo *item_box, It_Data *it_da
503 } 503 }
504 case GUI_TYPE_FILE: 504 case GUI_TYPE_FILE:
505 { 505 {
506 eo_do(o, elm_obj_hoversel_clear());
507 props_hoversel_resource_files_add(NULL, o, NULL, NULL, wdg_context_get(it_data->wdg));
508
506 Dep_Id *dep_id = DEP_ID_GET(prop_value_nth_get(prop, i)); 509 Dep_Id *dep_id = DEP_ID_GET(prop_value_nth_get(prop, i));
507 const char *default_str = PROP_HOVERSEL_NONE_VALUE; 510 const char *default_str = PROP_HOVERSEL_NONE_VALUE;
508 if (dep_id) 511 if (dep_id)