2 * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved
4 * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice, this
10 * list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //################################################################
29 //################################################################
31 group { name: "elm/segment_control/base/default";
32 #define SEGMENT_TYPE_SINGLE 1
33 #define SEGMENT_TYPE_LEFT 2
34 #define SEGMENT_TYPE_MIDDLE 3
35 #define SEGMENT_TYPE_RIGHT 4
36 #define SEGMENT_STATE_NORMAL 1
37 #define SEGMENT_STATE_PRESSED 2
38 #define SEGMENT_STATE_SELECTED 3
39 #define SEGMENT_STATUS_ENABLED 0
40 #define SEGMENT_STATUS_DISABLED 1
54 group { name: "elm/segment_control/item/default";
56 style { name: "segment_control_multiline_style";
57 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";
59 tag: "hilight" "+ font_weight=Bold";
60 tag: "b" "+ font_weight=Bold";
65 image: "00_badge_bg.#.png" COMP;
71 description { state: "default" 0.0;
75 part { name: "segment";
79 description { state: "default" 0.0;
92 description { state: "default_single" 0.0;
93 inherit: "default" 0.0;
96 description { state: "default_left" 0.0;
97 inherit: "default" 0.0;
100 description { state: "default_right" 0.0;
101 inherit: "default" 0.0;
104 description { state: "default_middle" 0.0;
105 inherit: "default" 0.0;
108 description { state: "pressed_single" 0.0;
109 inherit: "default" 0.0;
111 description { state: "pressed_left" 0.0;
112 inherit: "default" 0.0;
115 description { state: "pressed_right" 0.0;
116 inherit: "default" 0.0;
118 description { state: "pressed_middle" 0.0;
119 inherit: "default" 0.0;
121 description { state: "selected_single" 0.0;
122 inherit: "default" 0.0;
124 description { state: "selected_left" 0.0;
125 inherit: "default" 0.0;
127 description { state: "selected_right" 0.0;
128 inherit: "default" 0.0;
130 description { state: "selected_middle" 0.0;
131 inherit: "default" 0.0;
134 part { name: "seg_padding";
137 description { state: "default" 0.0;
151 description { state: "visible" 0.0;
152 inherit: "default" 0.0;
153 min: SEGMENT_CONTROL_DIVIDER_LINE_MIN_SIZE_INC;
157 part { name: "divider_left";
159 clip_to: "seg_padding";
161 description { state: "default" 0.0;
170 color: SEGMENT_CONTROL_DIVIDER_LEFT_COLOR_INC;
173 part { name: "divider_right";
175 clip_to: "seg_padding";
177 description { state: "default" 0.0;
186 color: SEGMENT_CONTROL_DIVIDER_RIGHT_COLOR_INC;
189 part { name: "left_text_padding";
193 description { state: "default" 0.0;
196 min: SEGMENT_CONTROL_TEXT_PADDING_MIN_SIZE_INC;
208 part { name: "right_text_padding";
212 description { state: "default" 0.0;
214 min: SEGMENT_CONTROL_TEXT_PADDING_MIN_SIZE_INC;
227 part { name: "icon.bg";
231 description { state: "default" 0.0;
234 rel1.to: "elm.swallow.icon";
235 rel2.to: "elm.swallow.icon";
238 part { name: "padding_icon_text";
242 description { state: "default" 0.0; //when only icon or no icon is there
254 description { state: "icononly" 0.0;
255 inherit: "default" 0.0;
257 description { state: "visible" 0.0; //when icon is visible
258 inherit: "default" 0.0;
262 part { name: "elm.swallow.icon";
265 description { state: "default" 0.0;
268 rel1.to: "left_text_padding";
269 rel1.relative: 1.0 0.0;
270 rel2.to: "left_text_padding";
271 rel2.relative: 1.0 1.0;
273 aspect_preference: BOTH;
275 description { state: "visible" 0.0;
276 inherit: "default" 0.0;
278 min: SEGMENT_CONTROL_VISIBLE_ICON_RECT_MIN_MAX_INC;
280 description { state: "icononly" 0.0;
281 inherit: "default" 0.0;
283 min: SEGMENT_CONTROL_VISIBLE_ICON_RECT_MIN_MAX_INC;
284 rel2.relative: 1.0 1.0;
287 part { name: "elm.text";
292 state: "default" 0.0;
297 to_x: "padding_icon_text";
302 to: "right_text_padding";
305 color: SEGMENT_CONTROL_DEFAULT_ITEM_TEXT_COLOR_NORMAL_INC;
307 style: "segment_control_multiline_style";
312 description { state: "normal" 0.0;
313 inherit: "default" 0.0;
316 description { state: "pressed" 0.0;
317 inherit: "default" 0.0;
319 color: SEGMENT_CONTROL_ITEM_TITLE_TEXT_COLOR_PRESSED_INC;
321 description { state: "selected" 0.0;
322 inherit: "default" 0.0;
324 color: SEGMENT_CONTROL_ITEM_TITLE_TEXT_COLOR_SELECTED_INC;
326 description { state: "disabled" 0.0;
327 inherit: "default" 0.0;
329 color: SEGMENT_CONTROL_ITEM_TITLE_TEXT_COLOR_DISABLED_INC;
332 part { name: "elm.text.badge.bg";
336 state: "default" 0.0;
339 to: "left.padding.text.badge";
343 to: "right.padding.text.badge";
347 color_class: "B0517";
348 image.normal: "00_badge_bg.#.png";
350 description { state: "normal" 0.0;
351 inherit: "default" 0.0;
354 description { state: "pressed" 0.0;
355 inherit: "default" 0.0;
358 description { state: "selected" 0.0;
359 inherit: "default" 0.0;
362 description { state: "disabled" 0.0;
363 inherit: "default" 0.0;
367 part { name: "left.padding.text.badge";
371 state: "default" 0.0;
374 min: SEGMENT_CONTROL_BADGE_TEXT_LEFT_PADDING_MIN_INC;
376 to: "elm.text.badge";
380 to: "elm.text.badge";
386 part { name: "right.padding.text.badge";
390 state: "default" 0.0;
393 min: SEGMENT_CONTROL_BADGE_TEXT_RIGHT_PADDING_MIN_INC;
405 part { name: "elm.text.badge";
410 state: "default" 0.0;
415 relative: 0.2 0.0; // rel_x is given 0.2, so bg image will not cross the segment image in left dir.
418 to: "right.padding.text.badge";
422 color: SEGMENT_CONTROL_BADGE_TEXT_COLOR_INC;
424 font: "Tizen:style=Bold";
425 size: SEGMENT_CONTROL_BADGE_TEXT_FONT_SIZE_INC;
430 description { state: "normal" 0.0;
431 inherit: "default" 0.0;
434 description { state: "pressed" 0.0;
435 inherit: "default" 0.0;
438 description { state: "selected" 0.0;
439 inherit: "default" 0.0;
442 description { state: "disabled" 0.0;
443 inherit: "default" 0.0;
447 part { name: "disabler";
451 description { state: "default" 0.0;
464 color: 255 255 255 150;
466 description { state: "disabled_single" 0.0;
467 inherit: "default" 0.0;
470 description { state: "disabled_left" 0.0;
471 inherit: "default" 0.0;
474 description { state: "disabled_right" 0.0;
475 inherit: "default" 0.0;
478 description { state: "disabled_middle" 0.0;
479 inherit: "default" 0.0;
486 public seg_type; // Single, Left, Middle, Right.
487 public seg_state; // Normal/Default, Pressed, Selected.
488 public seg_status;// Enabled/Default, Disabled
490 public update_state() {
491 new type, state, disabled;
492 type = get_int(seg_type);
493 state = get_int(seg_state);
494 disabled = get_int(seg_status);
496 if(state == SEGMENT_STATE_NORMAL)
498 if(type == SEGMENT_TYPE_SINGLE)
500 set_state(PART:"segment", "default_single", 0.0);
501 set_state(PART:"seg_padding", "default", 0.0);
503 else if(type == SEGMENT_TYPE_LEFT)
505 set_state(PART:"segment", "default_left", 0.0);
506 set_state(PART:"seg_padding", "visible", 0.0);
508 else if(type == SEGMENT_TYPE_MIDDLE)
510 set_state(PART:"segment", "default_middle", 0.0);
511 set_state(PART:"seg_padding", "visible", 0.0);
513 else if(type == SEGMENT_TYPE_RIGHT)
515 set_state(PART:"segment", "default_right", 0.0);
516 set_state(PART:"seg_padding", "default", 0.0);
518 set_state(PART:"elm.text", "normal", 0.0);
520 else if(state == SEGMENT_STATE_PRESSED)
522 if(type == SEGMENT_TYPE_SINGLE)
524 set_state(PART:"segment", "pressed_single", 0.0);
526 else if(type == SEGMENT_TYPE_LEFT)
528 set_state(PART:"segment", "pressed_left", 0.0);
529 set_state(PART:"seg_padding", "visible", 0.0);
531 else if(type == SEGMENT_TYPE_MIDDLE)
533 set_state(PART:"segment", "pressed_middle", 0.0);
534 set_state(PART:"seg_padding", "visible", 0.0);
536 else if(type == SEGMENT_TYPE_RIGHT)
538 set_state(PART:"segment", "pressed_right", 0.0);
539 set_state(PART:"seg_padding", "default", 0.0);
541 set_state(PART:"elm.text", "pressed", 0.0);
543 else if(state == SEGMENT_STATE_SELECTED)
545 if(type == SEGMENT_TYPE_SINGLE)
547 set_state(PART:"segment", "selected_single", 0.0);
548 set_state(PART:"seg_padding", "default", 0.0);
550 else if(type == SEGMENT_TYPE_LEFT)
552 set_state(PART:"segment", "selected_left", 0.0);
553 set_state(PART:"seg_padding", "visible", 0.0);
555 else if(type == SEGMENT_TYPE_MIDDLE)
557 set_state(PART:"segment", "selected_middle", 0.0);
558 set_state(PART:"seg_padding", "visible", 0.0);
560 else if(type == SEGMENT_TYPE_RIGHT)
562 set_state(PART:"segment", "selected_right", 0.0);
563 set_state(PART:"seg_padding", "default", 0.0);
565 set_state(PART:"elm.text", "selected", 0.0);
567 if(disabled == SEGMENT_STATUS_DISABLED)
569 if(type == SEGMENT_TYPE_SINGLE)
571 set_state(PART:"disabler", "disabled_single", 0.0);
572 set_state(PART:"seg_padding", "default", 0.0);
574 else if(type == SEGMENT_TYPE_LEFT)
576 set_state(PART:"disabler", "disabled_left", 0.0);
577 set_state(PART:"seg_padding", "visible", 0.0);
579 else if(type == SEGMENT_TYPE_MIDDLE)
581 set_state(PART:"disabler", "disabled_middle", 0.0);
582 set_state(PART:"seg_padding", "visible", 0.0);
584 else if(type == SEGMENT_TYPE_RIGHT)
586 set_state(PART:"disabler", "disabled_right", 0.0);
587 set_state(PART:"seg_padding", "default", 0.0);
589 set_state(PART:"elm.text", "disabled", 0.0);
593 set_state(PART:"disabler", "default", 0.0);
598 name: "segment_type_s";
599 signal: "elm,type,segment,single";
602 set_int(seg_type, SEGMENT_TYPE_SINGLE);
607 name: "segment_type_l";
608 signal: "elm,type,segment,left";
611 set_int(seg_type, SEGMENT_TYPE_LEFT);
616 name: "segment_type_m";
617 signal: "elm,type,segment,middle";
620 set_int(seg_type, SEGMENT_TYPE_MIDDLE);
625 name: "segment_type_r";
626 signal: "elm,type,segment,right";
629 set_int(seg_type, SEGMENT_TYPE_RIGHT);
634 name: "normal_segment";
635 signal: "elm,state,segment,normal";
638 set_int(seg_state, SEGMENT_STATE_NORMAL);
643 name: "pressed_segment";
644 signal: "elm,state,segment,pressed";
647 set_int(seg_state, SEGMENT_STATE_PRESSED);
652 name: "selected_segment";
653 signal: "elm,state,segment,selected";
656 set_int(seg_state, SEGMENT_STATE_SELECTED);
660 program { name: "disable_segment";
661 signal: "elm,state,disabled";
664 set_int(seg_status, SEGMENT_STATUS_DISABLED);
668 program { name: "enable_segment";
669 signal: "elm,state,enabled";
672 set_int(seg_status, SEGMENT_STATUS_ENABLED);
676 program { name: "text_show";
677 signal: "elm,state,text,visible";
682 get_state(PART:"elm.swallow.icon", st, 30, vl);
683 if (!strcmp(st, "icononly"))
685 set_state(PART:"elm.swallow.icon", "visible", 0.0);
686 set_state(PART:"padding_icon_text", "visible", 0.0);
688 get_state(PART:"elm.text", st, 30, vl);
689 if (!strcmp(st, "selected"))
690 set_state(PART:"elm.text", "selected", 0.0);
692 set_state(PART:"elm.text", "normal", 0.0);
695 program { name: "text_hide";
696 signal: "elm,state,text,hidden";
701 get_state(PART:"elm.swallow.icon", st, 30, vl);
702 if (!strcmp(st, "visible"))
704 set_state(PART:"elm.swallow.icon", "icononly", 0.0);
705 set_state(PART:"padding_icon_text", "icononly", 0.0);
707 set_state(PART:"elm.text", "default", 0.0);
710 program { name: "badge_text_show";
711 signal: "elm,state,elm.text.badge,visible";
716 get_state(PART:"elm.text.badge", st, 30, vl);
717 if (!strcmp(st, "selected"))
719 set_state(PART:"elm.text.badge", "selected", 0.0);
720 set_state(PART:"elm.text.badge.bg", "selected", 0.0);
724 set_state(PART:"elm.text.badge", "normal", 0.0);
725 set_state(PART:"elm.text.badge.bg", "normal", 0.0);
729 program { name: "badge_text_hide";
730 signal: "elm,state,elm.text.badge,hidden";
732 action: STATE_SET "default" 0.0;
733 target: "elm.text.badge";
734 target: "elm.text.badge.bg";
736 program { name: "icon_show";
737 signal: "elm,state,icon,visible";
742 get_state(PART:"elm.text", st, 30, vl);
743 if ((!strcmp(st, "normal")) || (!strcmp(st, "selected")))
745 set_state(PART:"elm.swallow.icon", "visible", 0.0);
746 set_state(PART:"padding_icon_text", "visible", 0.0);
750 set_state(PART:"elm.swallow.icon", "icononly", 0.0);
751 set_state(PART:"padding_icon_text", "icononly", 0.0);
755 program { name: "icon_hide";
756 signal: "elm,state,icon,hidden";
758 action: STATE_SET "default" 0.0;
759 target: "elm.swallow.icon";
762 #undef SEGMENT_TYPE_SINGLE
763 #undef SEGMENT_TYPE_LEFT
764 #undef SEGMENT_TYPE_MIDDLE
765 #undef SEGMENT_TYPE_RIGHT
766 #undef SEGMENT_STATE_NORMAL
767 #undef SEGMENT_STATE_PRESSED
768 #undef SEGMENT_STATE_SELECTED
769 #undef SEGMENT_STATUS_ENABLED
770 #undef SEGMENT_STATUS_DISABLED