From c0d05b3525485aefe4f392874f6a322e5d694b02 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Mon, 20 Feb 2012 12:04:29 +0000 Subject: [PATCH] elementary/flipselector - + disable/enable func SVN revision: 68155 --- .../data/themes/widgets/flipselector.edc | 47 +++++++++++++++++++ legacy/elementary/src/lib/Elementary.h.in | 2 +- legacy/elementary/src/lib/elm_flipselector.c | 14 +++++- legacy/elementary/src/lib/elm_flipselector.h | 4 ++ 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/data/themes/widgets/flipselector.edc b/legacy/elementary/data/themes/widgets/flipselector.edc index a7c8d946fd..99d9cf1a6d 100644 --- a/legacy/elementary/data/themes/widgets/flipselector.edc +++ b/legacy/elementary/data/themes/widgets/flipselector.edc @@ -379,6 +379,7 @@ group { name: "elm/flipselector/base/default"; part { name: "arrow_top"; mouse_events: 0; + clip_to: "disclip"; scale: 1; description { state: "default" 0.0; min: 15 15; @@ -395,6 +396,7 @@ group { name: "elm/flipselector/base/default"; } part { name: "arrow_bottom"; mouse_events: 0; + clip_to: "disclip"; scale: 1; description { state: "default" 0.0; min: 15 15; @@ -414,6 +416,7 @@ group { name: "elm/flipselector/base/default"; type: RECT; mouse_events: 0; name: "top_clipper"; + clip_to: "disclip"; description { state: "default" 0.0; rel1.to: "t"; @@ -426,6 +429,7 @@ group { name: "elm/flipselector/base/default"; type: RECT; mouse_events: 0; name: "bottom_clipper"; + clip_to: "disclip"; description { state: "default" 0.0; rel1.to: "b"; @@ -433,6 +437,35 @@ group { name: "elm/flipselector/base/default"; visible: 1; } } + + part { + type: RECT; + name: "disclip"; + description { + state: "default" 0.0; + color: 255 255 255 255; + } + description { + state: "enabled" 0.0; + color: 100 100 100 100; + } + } + + part { + type: RECT; + name: "event_blocker"; + description { + state: "default" 0.0; + color: 0 0 0 0; + visible: 0; + } + description { + state: "enabled" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + } programs { @@ -487,5 +520,19 @@ group { name: "elm/flipselector/base/default"; source: "b"; action: SIGNAL_EMIT "elm,action,down,stop" ""; } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "enabled" 0.0; + target: "disclip"; + target: "event_blocker"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "disclip"; + target: "event_blocker"; + } } } diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 5a33259e17..b4ab7cbccc 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -197,7 +197,7 @@ EAPI extern Elm_Version *elm_version; #include //Done #include //Done #include //Done. There are many TODOs in flip.c -#include +#include //Done. #include #include #include diff --git a/legacy/elementary/src/lib/elm_flipselector.c b/legacy/elementary/src/lib/elm_flipselector.c index db4659e34f..292b7d686d 100644 --- a/legacy/elementary/src/lib/elm_flipselector.c +++ b/legacy/elementary/src/lib/elm_flipselector.c @@ -7,7 +7,6 @@ /* TODO: if one ever wants to extend it to receiving generic widgets as items, be my guest. in this case, remember to implement the items tooltip infra. */ -/* TODO: implement disabled mode -- disable_hook() and stuff. */ /* TODO: fix default theme image borders for looong strings as item labels. */ /* TODO: set text elipsis on labels if one enforces mininum size on @@ -176,6 +175,18 @@ _del_hook(Evas_Object *obj) free(wd); } +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->base, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->base, "elm,state,enabled", "elm"); +} + static void _theme_hook(Evas_Object *obj) { @@ -630,6 +641,7 @@ elm_flipselector_add(Evas_Object *parent) wd->self = obj; elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); elm_widget_can_focus_set(obj, EINA_TRUE); elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); diff --git a/legacy/elementary/src/lib/elm_flipselector.h b/legacy/elementary/src/lib/elm_flipselector.h index bd2a40ed36..15cb2c778b 100644 --- a/legacy/elementary/src/lib/elm_flipselector.h +++ b/legacy/elementary/src/lib/elm_flipselector.h @@ -28,6 +28,10 @@ * Default text parts of the flipselector items that you can use for are: * @li "default" - label of the flipselector item * + * Supported elm_object common APIs. + * @li elm_object_disabled_set + * @li elm_object_disabled_get + * * Supported elm_object_item common APIs. * @li elm_object_item_text_set * @li elm_object_item_part_text_set