[Genlist] change edit mode style
[platform/core/uifw/efl-theme-tizen.git] / themes / widgets / segmentedcontrol.edc
1 /*
2  * efl-theme-tizen
3  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18
19
20 //################################################################
21 //Segment Control
22 //################################################################
23
24 group { name: "elm/segment_control/base/default";
25 #define SEGMENT_TYPE_SINGLE 1
26 #define SEGMENT_TYPE_LEFT 2
27 #define SEGMENT_TYPE_MIDDLE 3
28 #define SEGMENT_TYPE_RIGHT 4
29 #define SEGMENT_STATE_NORMAL 1
30 #define SEGMENT_STATE_PRESSED 2
31 #define SEGMENT_STATE_SELECTED 3
32 #define SEGMENT_STATUS_ENABLED 0
33 #define SEGMENT_STATUS_DISABLED 1
34    parts {
35       part { name: "bg";
36          type: RECT;
37          mouse_events: 0;
38          scale: 1;
39          description {
40             state: "default" 0.0;
41             min: 100 40;
42             visible: 0;
43          }
44       }
45    }
46 }
47 group { name: "elm/segment_control/item/default";
48    styles{
49       style { name: "segment_control_multiline_style";
50          base: "font=Tizen:style=Bold font_size="SEGMENT_CONTROL_MULTILINE_TEXT_SIZE_INC" align=center color=#ffffff wrap=char ellipsis=1.0 text_class=tizen";
51          tag:  "br" "\n";
52          tag:  "hilight" "+ font=Tizen:style=Bold";
53          tag:  "b" "+ font=Tizen:style=Bold";
54          tag:  "tab" "\t";
55       }
56    }
57    images {
58       image: "00_badge_bg.png" COMP;
59    }
60    parts {
61       part { name: "base";
62          mouse_events: 0;
63          scale: 1;
64          description { state: "default" 0.0;
65             visible: 0;
66          }
67       }
68       part { name: "segment";
69          type: RECT;
70          mouse_events: 1;
71          scale: 1;
72          description { state: "default" 0.0;
73             min: 1 1;
74             visible: 0;
75             rel1 {
76                to: "base";
77                relative: 0.0 0.0;
78             }
79             rel2 {
80                to: "base";
81                relative: 1.0 1.0;
82             }
83             color: 0 0 0 0;
84          }
85          description { state: "default_single" 0.0;
86             inherit: "default" 0.0;
87             visible: 1;
88          }
89          description { state: "default_left" 0.0;
90             inherit: "default" 0.0;
91             visible: 1;
92          }
93          description { state: "default_right" 0.0;
94             inherit: "default" 0.0;
95             visible: 1;
96          }
97          description { state: "default_middle" 0.0;
98             inherit: "default" 0.0;
99             visible: 1;
100          }
101          description { state: "pressed_single" 0.0;
102             inherit: "default" 0.0;
103          }
104          description { state: "pressed_left" 0.0;
105             inherit: "default" 0.0;
106             visible: 1;
107          }
108          description { state: "pressed_right" 0.0;
109             inherit: "default" 0.0;
110          }
111          description { state: "pressed_middle" 0.0;
112             inherit: "default" 0.0;
113          }
114          description { state: "selected_single" 0.0;
115             inherit: "default" 0.0;
116          }
117          description { state: "selected_left" 0.0;
118             inherit: "default" 0.0;
119          }
120          description { state: "selected_right" 0.0;
121             inherit: "default" 0.0;
122          }
123          description { state: "selected_middle" 0.0;
124             inherit: "default" 0.0;
125          }
126       }
127       part { name: "seg_padding";
128          type: RECT;
129          mouse_events: 0;
130          description { state: "default" 0.0;
131             visible: 0;
132             min: 0 0;
133             fixed: 1 0;
134             align: 1.0 0.5;
135             rel1 {
136                to: "segment";
137                relative: 1.0 0.5;
138             }
139             rel2 {
140                to: "segment";
141                relative: 1.0 0.5;
142             }
143          }
144          description { state: "visible" 0.0;
145             inherit: "default" 0.0;
146             min: SEGMENT_CONTROL_DIVIDER_LINE_MIN_SIZE_INC;
147             visible: 1;
148          }
149       }
150       part { name: "divider_left";
151          type: RECT;
152          clip_to: "seg_padding";
153          mouse_events: 0;
154          description { state: "default" 0.0;
155             rel1 {
156                to: "seg_padding";
157                relative: 0.0 0.0;
158             }
159             rel2 {
160                to: "seg_padding";
161                relative: 0.5 1.0;
162             }
163             color: SEGMENT_CONTROL_DIVIDER_LEFT_COLOR_INC;
164          }
165       }
166       part { name: "divider_right";
167          type: RECT;
168          clip_to: "seg_padding";
169          mouse_events: 0;
170          description { state: "default" 0.0;
171             rel1 {
172                to: "seg_padding";
173                relative: 0.5 0.0;
174             }
175             rel2 {
176                to: "seg_padding";
177                relative: 1.0 1.0;
178             }
179             color: SEGMENT_CONTROL_DIVIDER_RIGHT_COLOR_INC;
180          }
181       }
182       part { name: "left_text_padding";
183          type: RECT;
184          scale: 1;
185          mouse_events: 0;
186          description { state: "default" 0.0;
187             visible: 0;
188             align: 0.0 0.5;
189             min: SEGMENT_CONTROL_TEXT_PADDING_MIN_SIZE_INC;
190             fixed: 1 0;
191             rel1 {
192                to: "segment";
193                relative: 0.0 0.0;
194             }
195             rel2 {
196                to: "segment";
197                relative: 0.0 1.0;
198             }
199          }
200       }
201       part { name: "right_text_padding";
202          type: RECT;
203          scale: 1;
204          mouse_events: 0;
205          description { state: "default" 0.0;
206             visible: 0;
207             min: SEGMENT_CONTROL_TEXT_PADDING_MIN_SIZE_INC;
208             fixed: 1 0;
209             align: 1.0 0.5;
210             rel1 {
211                to: "segment";
212                relative: 1.0 0.0;
213             }
214             rel2 {
215                to: "segment";
216                relative: 1.0 1.0;
217             }
218          }
219       }
220       part { name: "icon.bg";
221          type: RECT;
222          scale: 1;
223          mouse_events: 0;
224          description { state: "default" 0.0;
225             visible: 0;
226             fixed: 1 0;
227             rel1.to: "elm.swallow.icon";
228             rel2.to: "elm.swallow.icon";
229          }
230       }
231       part { name: "padding_icon_text";
232          type: RECT;
233          scale: 1;
234          mouse_events: 0;
235          description { state: "default" 0.0; //when only icon or no icon is there
236             visible: 0;
237             align: 0.0 0.0;
238             rel1 {
239                to: "icon.bg";
240                relative: 1.0 0.0;
241             }
242             rel2 {
243                to: "icon.bg";
244                relative: 1.0 1.0;
245             }
246          }
247          description { state: "icononly" 0.0;
248             inherit: "default" 0.0;
249          }
250          description { state: "visible" 0.0; //when icon is visible
251             inherit: "default" 0.0;
252             rel2.offset: 2 0;
253          }
254       }
255       part { name: "elm.swallow.icon";
256          type: SWALLOW;
257          scale: 1;
258          description { state: "default" 0.0;
259             visible: 0;
260             fixed: 1 0;
261             rel1.to: "left_text_padding";
262             rel1.relative: 1.0 0.0;
263             rel2.to: "left_text_padding";
264             rel2.relative: 1.0 1.0;
265             aspect: 1.0 1.0;
266             aspect_preference: BOTH;
267          }
268          description { state: "visible" 0.0;
269             inherit: "default" 0.0;
270             visible: 1;
271             min: SEGMENT_CONTROL_VISIBLE_ICON_RECT_MIN_MAX_INC;
272          }
273          description { state: "icononly" 0.0;
274             inherit: "default" 0.0;
275             visible: 1;
276             min: SEGMENT_CONTROL_VISIBLE_ICON_RECT_MIN_MAX_INC;
277             rel2.relative: 1.0 1.0;
278          }
279       }
280       part { name: "elm.text";
281          type: TEXTBLOCK;
282          mouse_events: 0;
283          scale: 1;
284          description {
285             state: "default" 0.0;
286             visible: 0;
287             fixed: 1 1;
288             max: 9999 84;
289             rel1 {
290                to_x: "padding_icon_text";
291                to_y: "base";
292                relative: 1.0 0.0;
293             }
294             rel2 {
295                to: "right_text_padding";
296                relative: 0.0 1.0;
297             }
298             color: SEGMENT_CONTROL_DEFAULT_ITEM_TEXT_COLOR_NORMAL_INC;
299             text {
300               style: "segment_control_multiline_style";
301               min: 0 1;
302               max: 0 1;
303             }
304          }
305          description { state: "normal" 0.0;
306             inherit: "default" 0.0;
307             visible: 1;
308          }
309          description { state: "pressed" 0.0;
310             inherit: "default" 0.0;
311             visible: 1;
312             color: SEGMENT_CONTROL_ITEM_TITLE_TEXT_COLOR_PRESSED_INC;
313          }
314          description { state: "selected" 0.0;
315             inherit: "default" 0.0;
316             visible: 1;
317             color: SEGMENT_CONTROL_ITEM_TITLE_TEXT_COLOR_SELECTED_INC;
318          }
319          description { state: "disabled" 0.0;
320             inherit: "default" 0.0;
321             visible: 1;
322             color: SEGMENT_CONTROL_ITEM_TITLE_TEXT_COLOR_DISABLED_INC;
323          }
324       }
325       part { name: "elm.text.badge.bg";
326          mouse_events: 0;
327          scale: 1;
328          description {
329             state: "default" 0.0;
330             visible: 0;
331             rel1 {
332                to: "left.padding.text.badge";
333                relative: 0.0 0.0;
334             }
335             rel2 {
336                to: "right.padding.text.badge";
337                relative: 1.0 1.0;
338             }
339             align: 1.0 0.5;
340             image {
341                normal: "00_badge_bg.png";
342                border: 29 24 0 0;
343                border_scale: 1;
344             }
345          }
346          description { state: "normal" 0.0;
347             inherit: "default" 0.0;
348             visible: 1;
349          }
350          description { state: "pressed" 0.0;
351             inherit: "default" 0.0;
352             visible: 1;
353          }
354          description { state: "selected" 0.0;
355             inherit: "default" 0.0;
356             visible: 1;
357          }
358          description { state: "disabled" 0.0;
359             inherit: "default" 0.0;
360             visible: 1;
361          }
362       }
363       part { name: "left.padding.text.badge";
364          type: RECT;
365          scale: 1;
366          description {
367             state: "default" 0.0;
368             visible: 0;
369             fixed: 1 1;
370             min: SEGMENT_CONTROL_BADGE_TEXT_LEFT_PADDING_MIN_INC;
371             rel1 {
372                to: "elm.text.badge";
373                relative: 0.0 0.0;
374             }
375             rel2 {
376                to: "elm.text.badge";
377                relative: 0.0 0.0;
378             }
379             align: 1.0 0.0;
380          }
381       }
382       part { name: "right.padding.text.badge";
383          type: RECT;
384          scale: 1;
385          description {
386             state: "default" 0.0;
387             visible: 0;
388             fixed: 1 1;
389             min: SEGMENT_CONTROL_BADGE_TEXT_RIGHT_PADDING_MIN_INC;
390             rel1 {
391                to: "segment";
392                relative: 1.0 0.0;
393             }
394             rel2 {
395                to: "segment";
396                relative: 1.0 0.0;
397             }
398             align: 1.0 0.0;
399          }
400       }
401       part { name: "elm.text.badge";
402          type: TEXT;
403          mouse_events: 0;
404          scale: 1;
405          description {
406             state: "default" 0.0;
407             visible: 0;
408             min: 1 1;
409             rel1 {
410                to: "segment";
411                relative: 0.2 0.0; // rel_x is given 0.2, so bg image will not cross the segment image in left dir.
412             }
413             rel2 {
414                to: "right.padding.text.badge";
415                relative: 0.0 1.0;
416             }
417             align: 1.0 0.5;
418             color: SEGMENT_CONTROL_BADGE_TEXT_COLOR_INC;
419             text {
420                font: "Tizen:style=Bold";
421                size: SEGMENT_CONTROL_BADGE_TEXT_FONT_SIZE_INC;
422                min: 1 1;
423                max: 1 0;
424             }
425          }
426          description { state: "normal" 0.0;
427             inherit: "default" 0.0;
428             visible: 1;
429          }
430          description { state: "pressed" 0.0;
431             inherit: "default" 0.0;
432             visible: 1;
433          }
434          description { state: "selected" 0.0;
435             inherit: "default" 0.0;
436             visible: 1;
437          }
438          description { state: "disabled" 0.0;
439             inherit: "default" 0.0;
440             visible: 1;
441          }
442       }
443       part { name: "disabler";
444          type: RECT;
445          repeat_events: 0;
446          scale: 1;
447          description { state: "default" 0.0;
448             visible: 0;
449             fixed: 1 1;
450             min: 1 1;
451             align: 0.0 0.5;
452             rel1 {
453                relative: 0.0 0.0;
454                to: "segment";
455             }
456             rel2 {
457                relative: 1.0 1.0;
458                to: "segment";
459             }
460             color: 255 255 255 150;
461          }
462          description { state: "disabled_single" 0.0;
463             inherit: "default" 0.0;
464             visible: 1;
465          }
466          description { state: "disabled_left" 0.0;
467             inherit: "default" 0.0;
468             visible: 1;
469          }
470          description { state: "disabled_right" 0.0;
471             inherit: "default" 0.0;
472             visible: 1;
473          }
474          description { state: "disabled_middle" 0.0;
475             inherit: "default" 0.0;
476             visible: 1;
477          }
478       }
479    }
480    programs {
481       script {
482          public seg_type; // Single, Left, Middle, Right.
483          public seg_state; // Normal/Default, Pressed, Selected.
484          public seg_status;// Enabled/Default, Disabled
485
486          public update_state() {
487             new type, state, disabled;
488             type = get_int(seg_type);
489             state = get_int(seg_state);
490             disabled = get_int(seg_status);
491
492             if(state == SEGMENT_STATE_NORMAL)
493               {
494                  if(type == SEGMENT_TYPE_SINGLE)
495                    {
496                       set_state(PART:"segment", "default_single", 0.0);
497                       set_state(PART:"seg_padding", "default", 0.0);
498                    }
499                  else if(type == SEGMENT_TYPE_LEFT)
500                    {
501                       set_state(PART:"segment", "default_left", 0.0);
502                       set_state(PART:"seg_padding", "visible", 0.0);
503                    }
504                  else if(type == SEGMENT_TYPE_MIDDLE)
505                    {
506                       set_state(PART:"segment", "default_middle", 0.0);
507                       set_state(PART:"seg_padding", "visible", 0.0);
508                    }
509                  else if(type == SEGMENT_TYPE_RIGHT)
510                    {
511                       set_state(PART:"segment", "default_right", 0.0);
512                       set_state(PART:"seg_padding", "default", 0.0);
513                    }
514                  set_state(PART:"elm.text", "normal", 0.0);
515               }
516             else if(state == SEGMENT_STATE_PRESSED)
517               {
518                  if(type == SEGMENT_TYPE_SINGLE)
519                    {
520                       set_state(PART:"segment", "pressed_single", 0.0);
521                    }
522                  else if(type == SEGMENT_TYPE_LEFT)
523                    {
524                       set_state(PART:"segment", "pressed_left", 0.0);
525                       set_state(PART:"seg_padding", "visible", 0.0);
526                    }
527                  else if(type == SEGMENT_TYPE_MIDDLE)
528                    {
529                       set_state(PART:"segment", "pressed_middle", 0.0);
530                       set_state(PART:"seg_padding", "visible", 0.0);
531                    }
532                  else if(type == SEGMENT_TYPE_RIGHT)
533                    {
534                       set_state(PART:"segment", "pressed_right", 0.0);
535                       set_state(PART:"seg_padding", "default", 0.0);
536                    }
537                  set_state(PART:"elm.text", "pressed", 0.0);
538               }
539             else if(state == SEGMENT_STATE_SELECTED)
540               {
541                  if(type == SEGMENT_TYPE_SINGLE)
542                    {
543                       set_state(PART:"segment", "selected_single", 0.0);
544                       set_state(PART:"seg_padding", "default", 0.0);
545                    }
546                  else if(type == SEGMENT_TYPE_LEFT)
547                    {
548                       set_state(PART:"segment", "selected_left", 0.0);
549                       set_state(PART:"seg_padding", "visible", 0.0);
550                    }
551                  else if(type == SEGMENT_TYPE_MIDDLE)
552                    {
553                       set_state(PART:"segment", "selected_middle", 0.0);
554                       set_state(PART:"seg_padding", "visible", 0.0);
555                    }
556                  else if(type == SEGMENT_TYPE_RIGHT)
557                    {
558                       set_state(PART:"segment", "selected_right", 0.0);
559                       set_state(PART:"seg_padding", "default", 0.0);
560                    }
561                  set_state(PART:"elm.text", "selected", 0.0);
562               }
563             if(disabled == SEGMENT_STATUS_DISABLED)
564               {
565                  if(type == SEGMENT_TYPE_SINGLE)
566                    {
567                        set_state(PART:"disabler", "disabled_single", 0.0);
568                       set_state(PART:"seg_padding", "default", 0.0);
569                    }
570                  else if(type == SEGMENT_TYPE_LEFT)
571                    {
572                       set_state(PART:"disabler", "disabled_left", 0.0);
573                       set_state(PART:"seg_padding", "visible", 0.0);
574                    }
575                  else if(type == SEGMENT_TYPE_MIDDLE)
576                    {
577                       set_state(PART:"disabler", "disabled_middle", 0.0);
578                       set_state(PART:"seg_padding", "visible", 0.0);
579                    }
580                  else if(type == SEGMENT_TYPE_RIGHT)
581                    {
582                       set_state(PART:"disabler", "disabled_right", 0.0);
583                       set_state(PART:"seg_padding", "default", 0.0);
584                    }
585                  set_state(PART:"elm.text", "disabled", 0.0);
586               }
587             else
588               {
589                  set_state(PART:"disabler", "default", 0.0);
590               }
591          }
592       }
593       program {
594          name: "segment_type_s";
595          signal: "elm,type,segment,single";
596          source: "elm";
597          script {
598             set_int(seg_type, SEGMENT_TYPE_SINGLE);
599             update_state();
600          }
601       }
602       program {
603          name: "segment_type_l";
604          signal: "elm,type,segment,left";
605          source: "elm";
606          script {
607             set_int(seg_type, SEGMENT_TYPE_LEFT);
608             update_state();
609          }
610       }
611       program {
612          name: "segment_type_m";
613          signal: "elm,type,segment,middle";
614          source: "elm";
615          script {
616             set_int(seg_type, SEGMENT_TYPE_MIDDLE);
617             update_state();
618          }
619       }
620       program {
621          name: "segment_type_r";
622          signal: "elm,type,segment,right";
623          source: "elm";
624          script {
625             set_int(seg_type, SEGMENT_TYPE_RIGHT);
626             update_state();
627          }
628       }
629       program {
630          name: "normal_segment";
631          signal: "elm,state,segment,normal";
632          source: "elm";
633          script {
634             set_int(seg_state, SEGMENT_STATE_NORMAL);
635             update_state();
636          }
637       }
638       program {
639          name: "pressed_segment";
640          signal: "elm,state,segment,pressed";
641          source: "elm";
642          script {
643             set_int(seg_state, SEGMENT_STATE_PRESSED);
644             update_state();
645          }
646       }
647       program {
648          name: "selected_segment";
649          signal: "elm,state,segment,selected";
650          source: "elm";
651          script {
652             set_int(seg_state, SEGMENT_STATE_SELECTED);
653             update_state();
654          }
655       }
656       program { name: "disable_segment";
657          signal: "elm,state,disabled";
658          source: "elm";
659          script {
660             set_int(seg_status, SEGMENT_STATUS_DISABLED);
661             update_state();
662          }
663       }
664       program { name: "enable_segment";
665          signal: "elm,state,enabled";
666          source: "elm";
667          script {
668             set_int(seg_status, SEGMENT_STATUS_ENABLED);
669             update_state();
670          }
671       }
672       program { name: "text_show";
673          signal: "elm,state,text,visible";
674          source: "elm";
675          script {
676             new st[31];
677             new Float:vl;
678             get_state(PART:"elm.swallow.icon", st, 30, vl);
679             if (!strcmp(st, "icononly"))
680               {
681                  set_state(PART:"elm.swallow.icon", "visible", 0.0);
682                  set_state(PART:"padding_icon_text", "visible", 0.0);
683               }
684             get_state(PART:"elm.text", st, 30, vl);
685             if (!strcmp(st, "selected"))
686                set_state(PART:"elm.text", "selected", 0.0);
687             else
688                set_state(PART:"elm.text", "normal", 0.0);
689          }
690       }
691       program { name: "text_hide";
692          signal: "elm,state,text,hidden";
693          source: "elm";
694          script {
695             new st[31];
696             new Float:vl;
697             get_state(PART:"elm.swallow.icon", st, 30, vl);
698             if (!strcmp(st, "visible"))
699               {
700                  set_state(PART:"elm.swallow.icon", "icononly", 0.0);
701                  set_state(PART:"padding_icon_text", "icononly", 0.0);
702               }
703             set_state(PART:"elm.text", "default", 0.0);
704          }
705       }
706       program { name: "badge_text_show";
707          signal: "elm,state,elm.text.badge,visible";
708          source: "elm";
709          script {
710             new st[31];
711             new Float:vl;
712             get_state(PART:"elm.text.badge", st, 30, vl);
713             if (!strcmp(st, "selected"))
714             {
715                set_state(PART:"elm.text.badge", "selected", 0.0);
716                set_state(PART:"elm.text.badge.bg", "selected", 0.0);
717             }
718             else
719             {
720                set_state(PART:"elm.text.badge", "normal", 0.0);
721                set_state(PART:"elm.text.badge.bg", "normal", 0.0);
722             }
723          }
724       }
725       program { name: "badge_text_hide";
726          signal: "elm,state,elm.text.badge,hidden";
727          source: "elm";
728          action:  STATE_SET "default" 0.0;
729          target: "elm.text.badge";
730          target: "elm.text.badge.bg";
731       }
732       program { name: "icon_show";
733          signal: "elm,state,icon,visible";
734          source: "elm";
735          script {
736             new st[31];
737             new Float:vl;
738             get_state(PART:"elm.text", st, 30, vl);
739             if ((!strcmp(st, "normal")) || (!strcmp(st, "selected")))
740               {
741                  set_state(PART:"elm.swallow.icon", "visible", 0.0);
742                  set_state(PART:"padding_icon_text", "visible", 0.0);
743               }
744             else
745               {
746                  set_state(PART:"elm.swallow.icon", "icononly", 0.0);
747                  set_state(PART:"padding_icon_text", "icononly", 0.0);
748               }
749          }
750       }
751       program { name: "icon_hide";
752          signal: "elm,state,icon,hidden";
753          source: "elm";
754          action:  STATE_SET "default" 0.0;
755          target: "elm.swallow.icon";
756       }
757    }
758 #undef SEGMENT_TYPE_SINGLE
759 #undef SEGMENT_TYPE_LEFT
760 #undef SEGMENT_TYPE_MIDDLE
761 #undef SEGMENT_TYPE_RIGHT
762 #undef SEGMENT_STATE_NORMAL
763 #undef SEGMENT_STATE_PRESSED
764 #undef SEGMENT_STATE_SELECTED
765 #undef SEGMENT_STATUS_ENABLED
766 #undef SEGMENT_STATUS_DISABLED
767 }