summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnand <anand.km@samsung.com>2014-07-22 15:56:16 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-07-22 15:57:32 +0900
commit91282a22cba66ee5e7799018d3abe8957fb1b1fa (patch)
tree2ade57a87977da8a1de172900704aaadca0a93f8
parent0d014c0dd42d65a5e72eb31b2a53f8fe270d38ed (diff)
genlist: Focus highlight when loop is enable
Summary: This patch is dependent on D1193 and D1136. It will be pushed after D1193 and D1136 patch. Reviewers: singh.amitesh Differential Revision: https://phab.enlightenment.org/D1168 Conflicts: src/lib/elm_genlist.c
-rw-r--r--data/themes/edc/elm/focus.edc105
-rw-r--r--src/lib/elm_genlist.c69
2 files changed, 145 insertions, 29 deletions
diff --git a/data/themes/edc/elm/focus.edc b/data/themes/edc/elm/focus.edc
index 19d78cde7..37a08b2a7 100644
--- a/data/themes/edc/elm/focus.edc
+++ b/data/themes/edc/elm/focus.edc
@@ -5,7 +5,7 @@ group { name: "elm/focus_highlight/top/default";
5 script { 5 script {
6 public s_x, s_y, s_w, s_h; /* source */ 6 public s_x, s_y, s_w, s_h; /* source */
7 public difx, dify, difw, difh; 7 public difx, dify, difw, difh;
8 8
9 public animator1(val, Float:pos) { 9 public animator1(val, Float:pos) {
10 new x, y, w, h, dx, dy, dw, dh, Float:p; 10 new x, y, w, h, dx, dy, dw, dh, Float:p;
11 p = 1.0 - ((1.0 - pos) * (1.0 - pos) * (1.0 - pos)); 11 p = 1.0 - ((1.0 - pos) * (1.0 - pos) * (1.0 - pos));
@@ -19,16 +19,16 @@ group { name: "elm/focus_highlight/top/default";
19 h = get_int(s_h) + dh; 19 h = get_int(s_h) + dh;
20 update_offset(x, y, w, h); 20 update_offset(x, y, w, h);
21 } 21 }
22 22
23 public update_offset(x, y, w, h) { 23 public update_offset(x, y, w, h) {
24 set_state_val(PART:"base", STATE_REL1_OFFSET, x, y); 24 set_state_val(PART:"base", STATE_REL1_OFFSET, x, y);
25 set_state_val(PART:"base", STATE_REL2_OFFSET, x + w, y + h); 25 set_state_val(PART:"base", STATE_REL2_OFFSET, x + w, y + h);
26 } 26 }
27 27
28 public message(Msg_Type:type, id, ...) { 28 public message(Msg_Type:type, id, ...) {
29 if ((type == MSG_INT_SET) && (id == 1)) { 29 if ((type == MSG_INT_SET) && (id == 1)) {
30 new x1, y1, w1, h1, x2, y2, w2, h2; 30 new x1, y1, w1, h1, x2, y2, w2, h2;
31 31
32 x1 = getarg(2); 32 x1 = getarg(2);
33 y1 = getarg(3); 33 y1 = getarg(3);
34 w1 = getarg(4); 34 w1 = getarg(4);
@@ -37,7 +37,7 @@ group { name: "elm/focus_highlight/top/default";
37 y2 = getarg(7); 37 y2 = getarg(7);
38 w2 = getarg(8); 38 w2 = getarg(8);
39 h2 = getarg(9); 39 h2 = getarg(9);
40 40
41 set_int(s_x, x1); 41 set_int(s_x, x1);
42 set_int(s_y, y1); 42 set_int(s_y, y1);
43 set_int(s_w, w1); 43 set_int(s_w, w1);
@@ -46,31 +46,56 @@ group { name: "elm/focus_highlight/top/default";
46 set_int(dify, y2 - y1); 46 set_int(dify, y2 - y1);
47 set_int(difw, w2 - w1); 47 set_int(difw, w2 - w1);
48 set_int(difh, h2 - h1); 48 set_int(difh, h2 - h1);
49 49
50 custom_state(PART:"base", "default", 0.0); 50 custom_state(PART:"base", "default", 0.0);
51 set_state_val(PART:"base", STATE_REL1, 0.0, 0.0); 51 set_state_val(PART:"base", STATE_REL1, 0.0, 0.0);
52 set_state_val(PART:"base", STATE_REL2, 0.0, 0.0); 52 set_state_val(PART:"base", STATE_REL2, 0.0, 0.0);
53 update_offset(x1, y1, w1, h1); 53 update_offset(x1, y1, w1, h1);
54 set_state(PART:"base", "custom", 0.0); 54 set_state(PART:"base", "custom", 0.0);
55 55
56 anim(0.2, "animator1", 1); 56 anim(0.2, "animator1", 1);
57 } 57 }
58 } 58 }
59 } 59 }
60 parts { 60 parts {
61 part { name: "base"; type: SPACER; 61 part { name: "base"; type: RECT;
62 clip_to: "clip";
62 description { state: "default" 0.0; 63 description { state: "default" 0.0;
64 visible: 0;
65 }
66 description { state: "move_down" 0.0;
67 inherit: "default" 0.0;
68 rel1.relative: 0 1;
69 rel2.relative: 1 2;
70 }
71 description { state: "move_up" 0.0;
72 inherit: "default" 0.0;
73 rel1.relative: 0 -1;
74 rel2.relative: 1 0;
63 } 75 }
64 } 76 }
65 part { name: "clip"; type: RECT; 77 part { name: "clip"; type: RECT;
66 description { state: "default" 0.0; 78 scale: 1;
67 rel1.to: "glow"; 79 description {
68 rel2.to: "glow"; 80 state: "default" 0.0;
69 color: 255 255 255 0; 81 color: 255 255 255 255;
82 rel1.relative: -1 -1;
83 rel2.relative: 2 2;
84 }
85 description { state: "move_down" 0.0;
86 inherit: "default" 0.0;
87 color: 0 0 0 0;
88 }
89 description { state: "move_up" 0.0;
90 inherit: "default" 0.0;
91 color: 0 0 0 0 ;
70 } 92 }
71 description { state: "visible" 0.0; 93 description { state: "visible" 0.0;
72 inherit: "default" 0.0; 94 inherit: "default" 0.0;
73 color: 255 255 255 255; 95 }
96 description { state: "invisible" 0.0;
97 inherit: "default" 0.0;
98 color: 255 255 255 0;
74 } 99 }
75 } 100 }
76 part { name: "glow"; mouse_events: 0; 101 part { name: "glow"; mouse_events: 0;
@@ -121,7 +146,7 @@ group { name: "elm/focus_highlight/top/default";
121 } 146 }
122 program { 147 program {
123 signal: "elm,action,focus,hide"; source: "elm"; 148 signal: "elm,action,focus,hide"; source: "elm";
124 action: STATE_SET "default" 0.0; 149 action: STATE_SET "invisible" 0.0;
125 transition: DECELERATE 0.4; 150 transition: DECELERATE 0.4;
126 target: "clip"; 151 target: "clip";
127 after: "stop2"; 152 after: "stop2";
@@ -153,5 +178,57 @@ group { name: "elm/focus_highlight/top/default";
153 action: STATE_SET "default" 0.0; 178 action: STATE_SET "default" 0.0;
154 target: "base"; 179 target: "base";
155 } 180 }
181 program { name: "move_down";
182 signal: "elm,action,focus,move,down";
183 source: "elm";
184 transition: LIN 0.3;
185 action: STATE_SET "move_down" 0.0;
186 target: "base";
187 target: "clip";
188 after: "move_down_end";
189 }
190 program { name: "move_down_end";
191 action: SIGNAL_EMIT "elm,focus,move,down,end" "elm";
192 }
193 program { name: "move_up";
194 signal: "elm,action,focus,move,up";
195 source: "elm";
196 transition: LIN 0.3;
197 action: STATE_SET "move_up" 0.0;
198 target: "base";
199 target: "clip";
200 after: "move_up_end";
201 }
202 program { name: "move_up_end";
203 action: SIGNAL_EMIT "elm,focus,move,up,end" "elm";
204 }
205 program { name: "move_home_from_up";
206 signal: "elm,action,focus,move,home,up";
207 source: "elm";
208 action: STATE_SET "move_up" 0.0;
209 target: "base";
210 target: "clip";
211 after: "move_home_from_up2";
212 }
213 program { name: "move_home_from_up2";
214 action: STATE_SET "default" 0.0;
215 transition: LIN 0.3;
216 target: "base";
217 target: "clip";
218 }
219 program { name: "move_home_from_down";
220 signal: "elm,action,focus,move,home,down";
221 source: "elm";
222 action: STATE_SET "move_down" 0.0;
223 target: "base";
224 target: "clip";
225 after: "move_home_from_down2";
226 }
227 program { name: "move_home_from_down2";
228 action: STATE_SET "default" 0.0;
229 transition: LIN 0.3;
230 target: "base";
231 target: "clip";
232 }
156 } 233 }
157} 234}
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index e874dc7cd..e33a8cfa5 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2269,7 +2269,7 @@ _elm_genlist_pan_evas_object_smart_calculate(Eo *obj EINA_UNUSED, Elm_Genlist_Pa
2269 else if (sd->reorder_fast == -1) 2269 else if (sd->reorder_fast == -1)
2270 eo_do((sd)->obj, elm_interface_scrollable_content_region_show(vx, vy + 10, vw, vh)); 2270 eo_do((sd)->obj, elm_interface_scrollable_content_region_show(vx, vy + 10, vw, vh));
2271 2271
2272 if (sd->focused_item) 2272 if (sd->focused_item && !sd->item_loop_enable)
2273 _elm_widget_focus_highlight_start(psd->wobj); 2273 _elm_widget_focus_highlight_start(psd->wobj);
2274 2274
2275 evas_event_thaw(evas_object_evas_get(obj)); 2275 evas_event_thaw(evas_object_evas_get(obj));
@@ -5188,42 +5188,73 @@ _decorate_item_unset(Elm_Genlist_Data *sd)
5188 5188
5189static void 5189static void
5190_elm_genlist_looping_up_cb(void *data, 5190_elm_genlist_looping_up_cb(void *data,
5191 Evas_Object *obj EINA_UNUSED, 5191 Evas_Object *obj EINA_UNUSED,
5192 const char *emission EINA_UNUSED, 5192 const char *emission EINA_UNUSED,
5193 const char *source EINA_UNUSED) 5193 const char *source EINA_UNUSED)
5194{ 5194{
5195 Evas_Object *genlist = data; 5195 Evas_Object *genlist = data;
5196 5196
5197 ELM_GENLIST_DATA_GET(genlist, sd); 5197 ELM_GENLIST_DATA_GET(genlist, sd);
5198 5198
5199 Elm_Object_Item *it = elm_genlist_last_item_get(genlist); 5199 Elm_Object_Item *it = elm_genlist_last_item_get(genlist);
5200 if (!_elm_config->item_select_on_focus_disable) 5200
5201 elm_genlist_item_selected_set(it, EINA_TRUE); 5201 elm_genlist_item_show((Elm_Object_Item *)it, ELM_GENLIST_ITEM_SCROLLTO_IN);
5202 else 5202 _elm_widget_focus_highlight_signal_emit(genlist, "elm,action,focus,move,up", "elm");
5203 elm_object_item_focus_set(it, EINA_TRUE);
5204 elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm"); 5203 elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm");
5205 sd->item_looping_on = EINA_FALSE; 5204 sd->item_looping_on = EINA_FALSE;
5206} 5205}
5207 5206
5208static void 5207static void
5209_elm_genlist_looping_down_cb(void *data, 5208_elm_genlist_looping_down_cb(void *data,
5210 Evas_Object *obj EINA_UNUSED, 5209 Evas_Object *obj EINA_UNUSED,
5211 const char *emission EINA_UNUSED, 5210 const char *emission EINA_UNUSED,
5212 const char *source EINA_UNUSED) 5211 const char *source EINA_UNUSED)
5213{ 5212{
5214 Evas_Object *genlist = data; 5213 Evas_Object *genlist = data;
5215 5214
5216 ELM_GENLIST_DATA_GET(genlist, sd); 5215 ELM_GENLIST_DATA_GET(genlist, sd);
5217 5216
5218 Elm_Object_Item *it = elm_genlist_first_item_get(genlist); 5217 Elm_Object_Item *it = elm_genlist_first_item_get(genlist);
5219 if (!_elm_config->item_select_on_focus_disable) 5218
5220 elm_genlist_item_selected_set(it, EINA_TRUE); 5219 elm_genlist_item_show((Elm_Object_Item *)it, ELM_GENLIST_ITEM_SCROLLTO_IN);
5221 else 5220 _elm_widget_focus_highlight_signal_emit(genlist, "elm,action,focus,move,down", "elm");
5222 elm_object_item_focus_set(it, EINA_TRUE);
5223 elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm"); 5221 elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm");
5224 sd->item_looping_on = EINA_FALSE; 5222 sd->item_looping_on = EINA_FALSE;
5225} 5223}
5226 5224
5225static void
5226_elm_genlist_focus_highlight_move_down_end_cb(void *data,
5227 Evas_Object *obj EINA_UNUSED,
5228 const char *emission EINA_UNUSED,
5229 const char *source EINA_UNUSED)
5230{
5231 Evas_Object *gl = data;
5232 Elm_Gen_Item *it = (Elm_Gen_Item *)elm_genlist_first_item_get(gl);
5233
5234 if (!_elm_config->item_select_on_focus_disable)
5235 elm_genlist_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
5236 else
5237 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
5238
5239 _elm_widget_focus_highlight_signal_emit(gl, "elm,action,focus,move,home,up", "elm");
5240}
5241
5242static void
5243_elm_genlist_focus_highlight_move_up_end_cb(void *data,
5244 Evas_Object *obj EINA_UNUSED,
5245 const char *emission EINA_UNUSED,
5246 const char *source EINA_UNUSED)
5247{
5248 Evas_Object *gl = data;
5249 Elm_Gen_Item *it = (Elm_Gen_Item *)elm_genlist_last_item_get(gl);
5250
5251 if (!_elm_config->item_select_on_focus_disable)
5252 elm_genlist_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
5253 else
5254 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
5255
5256 _elm_widget_focus_highlight_signal_emit(gl, "elm,action,focus,move,home,down", "elm");
5257}
5227 5258
5228EOLIAN static void 5259EOLIAN static void
5229_elm_genlist_evas_object_smart_add(Eo *obj, Elm_Genlist_Data *priv) 5260_elm_genlist_evas_object_smart_add(Eo *obj, Elm_Genlist_Data *priv)
@@ -7551,6 +7582,14 @@ _elm_genlist_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *
7551EOLIAN static void 7582EOLIAN static void
7552_elm_genlist_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enable) 7583_elm_genlist_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enable)
7553{ 7584{
7585 if (enable == EINA_TRUE)
7586 {
7587 _elm_widget_focus_highlight_signal_callback_add(obj, "elm,focus,move,down,end",
7588 "elm", _elm_genlist_focus_highlight_move_down_end_cb, obj);
7589 _elm_widget_focus_highlight_signal_callback_add(obj, "elm,focus,move,up,end",
7590 "elm", _elm_genlist_focus_highlight_move_up_end_cb, obj);
7591 }
7592
7554 sd->item_loop_enable = !!enable; 7593 sd->item_loop_enable = !!enable;
7555} 7594}
7556 7595