From a519a01a0170d6199fecb74574e61e7bd66cfe20 Mon Sep 17 00:00:00 2001 From: Yakov Goldberg Date: Mon, 26 May 2014 19:09:15 +0300 Subject: Fix management of resize object in windows - if some object is already used as resize, don't allow to choose it; - disable possibility of changing resize object (only deletion). --- src/bin/egui_gui/props_helper.c | 16 ++++++++++++++++ src/bin/egui_gui/propview.c | 6 ++++++ src/lib/database.h | 1 + 3 files changed, 23 insertions(+) diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c index eae505f..572a807 100644 --- a/src/bin/egui_gui/props_helper.c +++ b/src/bin/egui_gui/props_helper.c @@ -146,6 +146,22 @@ props_hoversel_objects_add(Eo *box, Eo *hover_parent, const char *default_val, c /*check, if wdg is content of w on any level. */ (wdg_is_content_of(w, wdg)))) continue; + + /* if widget already has this resize object, don't add it to hoversel*/ + Eina_List *itr2; + Gui_Widget_Property *prop; + Eina_Bool dont_add_this_widget = EINA_FALSE; + EINA_LIST_FOREACH(wdg_prop_list_get(wdg), itr2, prop) + { + if (!strcmp(prop_name_get(prop), RESIZE_OBJECT_ADD)) + { + Gui_Value *val = prop_value_nth_get(prop, 0); + if (DEP_ID_GET(val) == wdg_dep_id_get(w)) + dont_add_this_widget = EINA_TRUE; + } + } + if (dont_add_this_widget) continue; + elm_hoversel_item_add(hoversel, wdg_name_get(w), NULL, ELM_ICON_NONE, NULL, NULL); } } diff --git a/src/bin/egui_gui/propview.c b/src/bin/egui_gui/propview.c index 9b53d6c..401c160 100644 --- a/src/bin/egui_gui/propview.c +++ b/src/bin/egui_gui/propview.c @@ -133,6 +133,12 @@ _property_item_content_get(It_Data *it_data, Eo *box) eo_do(obj, eo_key_data_set(_STR_EDITOR, pfd, free)); evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _pfd_del, NULL); + /* forbid changing of value in "resize_object_add"*/ + if (prop && value && (!strcmp(prop_name_get(prop), RESIZE_OBJECT_ADD))) + { + eo_do(obj, elm_obj_widget_disabled_set(EINA_TRUE)); + } + if (eo_isa(obj, ELM_OBJ_HOVERSEL_CLASS)) { evas_object_smart_callback_add(obj, "selected", _view_cbs->property_update_cb_func, NULL); diff --git a/src/lib/database.h b/src/lib/database.h index 7c79ee5..330550b 100644 --- a/src/lib/database.h +++ b/src/lib/database.h @@ -98,6 +98,7 @@ typedef struct _Container_Desc Container_Desc; #define SIZE_HINT_WEIGHT_SET "size_hint_weight" #define SIZE_HINT_ALIGN_SET "size_hint_align" #define POSITION_SET "position" +#define RESIZE_OBJECT_ADD "resize_object_add" #define ELM_OBJ_WIN_CONSTRUCTOR "elm_obj_win_constructor" Eina_Bool -- cgit v1.2.1