tizen 2.4 release
[apps/home/quickpanel.git] / data / quickpanel_theme_slider.edc
1 /*
2  * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include "color_classes.edc"
19
20 #define SLIDER_BASE_HEIGHT_INC  6
21 #define SLIDER_INDICATOR_SIZE_INC 42
22 #define SLIDER_SWALLOWBAR_HEIGHT_INC  42
23 #define SLIDER_LEFT_RIGHT_PADDING_SIZE_INC 20 0
24 #define SLIDER_ICON_PADDING_SIZE_INC 5 0
25 #define SLIDER_CENTER_POINT_SIZE_INC 10 24
26
27 #define SLIDER_POPUP_WIDTH_INC 80
28 #define SLIDER_POPUP_HEIGHT_INC 92
29
30 group {
31         name: "elm/slider/horizontal/indicator/quickpanel_style";
32         images {
33                 image: "core_slider_handle_normal.png" COMP;
34                 image: "core_slider_handle_press.png" COMP;
35         }
36         parts {
37                 part {
38                         name: "access";
39                         type: RECT;
40                         description { state: "default" 0.0;
41                                 fixed: 1 1;
42                                 color: 0 0 0 0;
43                         }
44                 }
45                 part {
46                         name: "button_events";
47                         type: RECT;
48                         mouse_events: 1;
49                         scale: 1;
50                         description {
51                                 state: "default" 0.0;
52                                 fixed: 1 1;
53                                 min: 2*SLIDER_INDICATOR_SIZE_INC 1.5*SLIDER_INDICATOR_SIZE_INC;
54                                 aspect: 1.0 1.0;
55                                 aspect_preference: VERTICAL;
56                                 color: 0 0 0 0;
57                         }
58                         description {
59                                 state: "disabled" 0.0;
60                                 inherit: "default" 0.0;
61                                 visible: 0;
62                         }
63                 }
64                 part {
65                         name: "button0";
66                         mouse_events: 0;
67                         scale: 1;
68                         description {
69                                 state: "default" 0.0;
70                                 fixed: 1 1;
71                                 min: SLIDER_INDICATOR_SIZE_INC SLIDER_INDICATOR_SIZE_INC;
72                                 max: SLIDER_INDICATOR_SIZE_INC SLIDER_INDICATOR_SIZE_INC;
73                                 image {
74                                         normal: "core_slider_handle_normal.png";
75                                 }
76                                 color_class: "AO005L3";
77                         }
78                         description {
79                                 state: "disabled" 0.0;
80                                 inherit: "default" 0.0;
81                                 color_class: "AO004D";
82                                 visible: 1;
83                         }
84                 }
85                 part {
86                         name: "button0_press";
87                         mouse_events: 0;
88                         scale: 1;
89                         description {
90                                 state: "default" 0.0;
91                                 fixed: 1 1;
92                                 min: SLIDER_INDICATOR_SIZE_INC SLIDER_INDICATOR_SIZE_INC;
93                                 max: SLIDER_INDICATOR_SIZE_INC SLIDER_INDICATOR_SIZE_INC;
94                                 image {
95                                         normal: "core_slider_handle_press.png";
96                                 }
97                                 color_class: "AO005L4";
98                                 visible: 0;
99                                 }
100                         description {
101                                 state: "pressed" 0.0;
102                                 inherit: "default" 0.0;
103                                 visible: 1;
104                         }
105                 }
106         }
107         programs {
108                 program { name: "mouse_down";
109                         signal: "mouse,down,*";
110                         source: "button_events";
111                         action:  STATE_SET "pressed" 0.0;
112                         target: "button0_press";
113                 }
114                 program { name: "mouse_up";
115                         signal: "mouse,up,*";
116                         source: "button_events";
117                         action:  STATE_SET "default" 0.0;
118                         target: "button0_press";
119                 }
120                 program { name: "slider_disable";
121                         signal: "elm,state,disabled";
122                         source: "elm";
123                         action:  STATE_SET "disabled" 0.0;
124                         target: "button0";
125                         target: "button_events";
126                 }
127                 program { name: "slider_enable";
128                         signal: "elm,state,enabled";
129                         source: "elm";
130                         action:  STATE_SET "default" 0.0;
131                         target: "button0";
132                         target: "button_events";
133                 }
134         }
135 }
136
137 group {
138         name: "elm/slider/horizontal/quickpanel_style";
139                 images {
140                         image: "core_progressbar_bg.#.png" COMP;
141                         image: "core_progress_bar.#.png" COMP;
142                         image: "core_slider_center_point_bg.png" COMP;
143                 }
144                 script {
145                         public invert_on = 0;
146                         public popup_show = 1;
147                         public show = 0;
148                         public set_popup_show() {
149                                 set_int(popup_show, 1);
150                         }
151                         public set_popup_hide() {
152                                 set_int(popup_show, 0);
153                         }
154                         public set_invert_on() {
155                                 set_state(PART:"level", "inverted", 0.0);
156                                 set_state(PART:"level2", "inverted", 0.0);
157                                 set_int(invert_on, 1);
158                         }
159                         public set_invert_off() {
160                                 set_state(PART:"level", "default", 0.0);
161                                 set_state(PART:"level2", "default", 0.0);
162                                 set_int(invert_on, 0);
163                         }
164                         public thumb_down() {
165                                 if (get_int(invert_on) == 0) {
166                                         set_state(PART:"level", "pressed", 0.0);
167                                         set_state(PART:"level2", "pressed", 0.0);
168                                 }
169                                 if (get_int(popup_show) == 1) {
170                                         emit("popup,show", "elm");
171                                 }
172                         }
173                         public thumb_up() {
174                                 if (get_int(invert_on) == 0) {
175                                         set_state(PART:"level", "default", 0.0);
176                                         set_state(PART:"level2", "default", 0.0);
177                                 }
178                                 if (get_int(popup_show) == 1) {
179                                         emit("popup,hide", "elm");
180                                 }
181                         }
182                         public drag_state() {
183                                 new Float:dx, Float:dy;
184                                 get_drag(PART:"elm.dragable.slider", dx, dy);
185                                 if (dx > 0.5) {
186                                         set_state(PART:"level", "default", 0.0);
187                                         set_state(PART:"level2", "default", 0.0);
188                                         set_int(invert_on, 0);
189                                 }
190                                 else {
191                                         set_state(PART:"level", "inverted", 0.0);
192                                         set_state(PART:"level2", "inverted", 0.0);
193                                         set_int(invert_on, 1);
194                                 }
195                         }
196                         public message(Msg_Type:type, id, ...) {
197                                 if (type == MSG_FLOAT_SET) {
198                                         new Float:ratio;
199                                         ratio = getfarg(2);
200                                         if (id == 1) {
201                                                 custom_state(PART:"left_restrict", "default", 0.0);
202                                                 set_state_val(PART:"left_restrict", STATE_REL2, ratio, 0.0);
203                                                 set_state(PART:"left_restrict", "custom", 0.0);
204                                         } else if (id == 2) {
205                                                 custom_state(PART:"right_restrict", "default", 0.0);
206                                                 set_state_val(PART:"right_restrict", STATE_REL1, 1.0 - ratio, 0.0);
207                                                 set_state(PART:"right_restrict", "custom", 0.0);
208                                         }
209                                 }
210                         }
211                 }
212         parts {
213                 part {
214                         name: "access";
215                         type: RECT;
216                         description {
217                                 state: "default" 0.0;
218                                 fixed: 1 1;
219                                 color: 0 0 0 0;
220                         }
221                 }
222                 part {
223                         name: "bg";
224                         type: SPACER;
225                         scale: 1;
226                         description {
227                                 state: "default" 0.0;
228                                 min: 0 SLIDER_SWALLOWBAR_HEIGHT_INC;
229                         }
230                 }
231                 part {
232                         name: "elm.swallow.icon";
233                         type: SWALLOW;
234                         clip_to: "icon_clipper";
235                         scale: 1;
236                         description {
237                                 state: "default" 0.0;
238                                 visible: 0;
239                                 align: 0.0 0.5;
240                                 max: SLIDER_SWALLOWBAR_HEIGHT_INC SLIDER_SWALLOWBAR_HEIGHT_INC;
241                                 rel1 {
242                                         relative: 0.0 0.0;
243                                         to: "bg";
244                                 }
245                                 rel2 {
246                                         relative: 0.0 1.0;
247                                         to: "bg";
248                                 }
249                         }
250                         description {
251                                 state: "visible" 0.0;
252                                 inherit: "default" 0.0;
253                                 visible: 1;
254                         }
255                 }
256                 part {
257                         name: "bar_icon_right_padding_1";
258                         type: SPACER;
259                         scale: 1;
260                         description {
261                                 state: "default" 0.0;
262                                 align: 0.0 0.5;
263                                 min: 0 0;
264                                 max: 0 0;
265                                 rel1 {
266                                         relative: 1.0  0.0;
267                                         to: "elm.swallow.icon";
268                                 }
269                                 rel2 {
270                                         relative: 1.0  1.0;
271                                         to: "elm.swallow.icon";
272                                 }
273                                 fixed: 1 1;
274                         }
275                         description { state: "visible";
276                                 inherit: "default" 0.0;
277                                 min: SLIDER_ICON_PADDING_SIZE_INC;
278                                 max: SLIDER_ICON_PADDING_SIZE_INC;
279                         }
280                 }
281                 part {
282                         name: "bar_icon_right_padding_2";
283                         type: SPACER;
284                         scale: 1;
285                         description {
286                                 state: "default" 0.0;
287                                 align: 0.0 0.5;
288                                 min: SLIDER_LEFT_RIGHT_PADDING_SIZE_INC;
289                                 max: SLIDER_LEFT_RIGHT_PADDING_SIZE_INC;
290                                 rel1 {
291                                 relative: 1.0  0.0;
292                                         to: "bar_icon_right_padding_1";
293                                 }
294                                 rel2 {
295                                         relative: 1.0  1.0;
296                                         to: "bar_icon_right_padding_1";
297                                 }
298                                 fixed: 1 1;
299                         }
300                 }
301                 part {
302                         name: "left_restrict";
303                         type: RECT;
304                         scale: 1;
305                         description {
306                                 state: "default" 0.0;
307                                 min: 0 SLIDER_BASE_HEIGHT_INC;
308                                 max: -1 SLIDER_BASE_HEIGHT_INC;
309                                 fixed: 1 1;
310                                 rel1 {
311                                         to: "base";
312                                         relative: 0.0 0.0;
313                                 }
314                                 rel2 {
315                                         to: "base";
316                                         relative: 0.0 1.0;
317                                 }
318                                 align: 0.0 0.5;
319                         }
320                 }
321                 part {
322                         name: "right_restrict";
323                         type: RECT;
324                         scale: 1;
325                         description {
326                                 state: "default" 0.0;
327                                 min: 0 SLIDER_BASE_HEIGHT_INC;
328                                 max: -1 SLIDER_BASE_HEIGHT_INC;
329                                 rel1 {
330                                         to: "base";
331                                         relative: 1.0 0.0;
332                                 }
333                                 rel2 {
334                                         to: "base";
335                                         relative: 1.0 1.0;
336                                 }
337                         }
338                 }
339                 part {
340                         name: "base";
341                         mouse_events: 0;
342                         scale: 1;
343                         description {
344                                 state: "default" 0.0;
345                                 min: 0 SLIDER_BASE_HEIGHT_INC;
346                                 max: -1 SLIDER_BASE_HEIGHT_INC;
347                                 rel1 {
348                                         to: "bar_icon_right_padding_2";
349                                         relative: 1.0 0.0;
350                                 }
351                                 rel2 {
352                                         to: "bar_image_right_padding";
353                                         relative: 0.0 1.0;
354                                 }
355                                 fixed: 0 1;
356                                 image.normal: "core_progressbar_bg.#.png";
357                                 color: 255 255 255 255;
358                                 color_class: "AO005L1";
359                         }
360                         description {
361                                 state: "disabled" 0.0;
362                                 inherit: "default" 0.0;
363                                 color_class: "AO005L1D";
364                         }
365                 }
366                 part {
367                         name: "drag_base";
368                         type: "SPACER";
369                         description {
370                                 state: "default" 0.0;
371                                 min: 0 SLIDER_SWALLOWBAR_HEIGHT_INC;
372                                 rel1 {
373                                         to_x: "left_restrict";
374                                         to_y: "bg";
375                                         relative: 1.0 0.0;
376                                         offset: -SLIDER_LEFT_RIGHT_PADDING_SIZE_INC;
377                                 }
378                                 rel2 {
379                                         to_x: "right_restrict";
380                                         to_y: "bg";
381                                         relative: 0.0 1.0;
382                                         offset: SLIDER_LEFT_RIGHT_PADDING_SIZE_INC;
383                                 }
384                                 fixed: 1 1;
385                         }
386                 }
387                 part {
388                         name: "level";
389                         mouse_events: 0;
390                         scale: 1;
391                         clip_to: "clipper";
392                         description {
393                                 state: "default" 0.0;
394                                 rel1 {
395                                         to_x: "bar_icon_right_padding_2";
396                                         relative: 1.0 0.0;
397                                 }
398                                 rel2 {
399                                         to_x: "elm.dragable.slider";
400                                         relative: 0.5 1.0;
401                                 }
402                                 fixed: 1 1;
403                                 min: 0 SLIDER_BASE_HEIGHT_INC;
404                                 max: -1 SLIDER_BASE_HEIGHT_INC;
405                                 image.normal: "core_progressbar_bg.#.png";
406                         }
407                         description {
408                                 state: "inverted" 0.0;
409                                 inherit: "default" 0.0;
410                                 visible: 0;
411                         }
412                 }
413                 part { 
414                         name: "level2";
415                         mouse_events: 0;
416                         scale: 1;
417                         clip_to: "clipper";
418                         description {
419                                 state: "default" 0.0;
420                                 fixed: 1 1;
421                                 visible: 0;
422                                 rel1 {
423                                         to_y: "base";
424                                         to_x: "elm.dragable.slider";
425                                         relative: 0.5 0.0;
426                                 }
427                                 rel2.to: "base";
428                                         image.normal: "core_progressbar_bg.#.png";
429                                 }
430                                 description {
431                                         state: "inverted" 0.0;
432                                         inherit: "default" 0.0;
433                                         visible: 1;
434                         }
435                 }
436                 part {
437                         name: "bar_image_right_padding";
438                         type: SPACER;
439                         scale: 1;
440                         description {
441                                 state: "default" 0.0;
442                                 min: SLIDER_LEFT_RIGHT_PADDING_SIZE_INC;
443                                 max: SLIDER_LEFT_RIGHT_PADDING_SIZE_INC;
444                                 fixed: 1 0;
445                                 rel1 {
446                                         relative: 1.0  0.0;
447                                         to: "bg";
448                                 }
449                                 rel2 {
450                                         relative: 1.0  1.0;
451                                         to: "bg";
452                                 }
453                                 align: 1.0 0.5;
454                         }
455                 }
456                 part { name: "icon_clipper";
457                         scale: 1;
458                         type: RECT;
459                         description {
460                                 state: "default" 0.0;
461                                 color_class: "W0661";
462                         }
463                         description {
464                                 state: "disabled" 0.0;
465                                 color_class: "W0661D";
466                         }
467                 }
468                 part {
469                         name: "elm.swallow.bar";
470                         type: SWALLOW;
471                         scale: 1;
472                         description {
473                                 state: "default" 0.0;
474                                 min: 0  SLIDER_SWALLOWBAR_HEIGHT_INC;
475                                 max: -1 SLIDER_SWALLOWBAR_HEIGHT_INC;
476                                 fixed: 0 1;
477                                 rel1 {
478                                         to: "bar_icon_right_padding_2";
479                                         relative: 1.0 0.0;
480                                 }
481                                 rel2 {
482                                         to: "bar_image_right_padding";
483                                         relative: 0.0 1.0;
484                                 }
485                         }
486                 }
487                 part {
488                         name:"center_point";
489                         scale: 1;
490                         description {
491                                 state: "default" 0.0;
492                                 min: SLIDER_CENTER_POINT_SIZE_INC;
493                                 max: SLIDER_CENTER_POINT_SIZE_INC;
494                                 visible: 0;
495                                 image.normal: "core_slider_center_point_bg.png";
496                                 rel1.to: "base";
497                                 rel2.to: "base";
498                                 fixed: 0 1;
499                                 color_class: "W062L1";
500                         }
501                         description {
502                                 state: "visible" 0.0;
503                                 inherit: "default" 0.0;
504                                 visible: 1;
505                         }
506                         description {
507                                 state: "disabled" 0.0;
508                                 inherit: "default" 0.0;
509                                 visible: 1;
510                                 color_class: "W062L1D";
511                         }
512                 }
513                 part {
514                         name: "elm.track.slider";
515                         type: SWALLOW;
516                         mouse_events: 0;
517                         scale: 1;
518                         description {
519                                 state: "default" 0.0;
520                                 min: 0 SLIDER_POPUP_HEIGHT_INC;
521                                 max: -1 SLIDER_POPUP_HEIGHT_INC;
522                                 align: 0.5 1.0;
523                                 fixed: 0 1;
524                                 rel1.to: "elm.dragable.slider";
525                                 rel1.offset: 0 8;
526                                 rel2 {
527                                         relative: 1.0 0.0;
528                                         to: "elm.dragable.slider";
529                                         offset: 0 8;
530                                 }
531                         }
532                 }
533                 part {
534                         name: "elm.dragable.slider";
535                         type: GROUP;
536                         source: "elm/slider/horizontal/indicator/quickpanel_style";
537                         mouse_events: 1;
538                         scale: 1;
539                         dragable {
540                                 x: 1 1 0;
541                                 y: 0 0 0;
542                                 confine: "drag_base";
543                         }
544                         description {
545                                 state: "default" 0.0;
546                                 min: SLIDER_INDICATOR_SIZE_INC SLIDER_INDICATOR_SIZE_INC;
547                                 fixed: 1 1;
548                                 align: 0.5 0.5;
549                                 rel1.to: "drag_base";
550                                 rel1.relative: 0.5 0.5;
551                                 rel2.to: "drag_base";
552                                 rel2.relative: 0.5 0.5;
553                                 color: 0 0 0 0;
554                         }
555                 }
556                 part {
557                         name: "disabler";
558                         type: RECT;
559                         mouse_events: 1;
560                         repeat_events: 0;
561                         scale: 1;
562                         description {
563                                 state: "default" 0.0;
564                                 visible: 0;
565                                 color: 0 0 0 0;
566                         }
567                         description {
568                                 state: "disabled" 0.0;
569                                 inherit: "default" 0.0;
570                                 visible: 1;
571                         }
572                 }
573                 part {
574                         name: "clipper";
575                         type: RECT;
576                         description {
577                                 state: "default" 0.0;
578                                         color_class: "AO005L2";
579                                 }
580                                 description {
581                                         state: "pressed" 0.0;
582                                         color_class: "AO005L2";
583                                 }
584                                 description {
585                                         state: "disabled" 0.0;
586                                         color_class: "AO004D";
587                                 }
588                         }
589                 }
590                 programs {
591                         program {
592                         name: "invert_on";
593                         signal: "elm,state,inverted,on";
594                         source: "elm";
595                         script {
596                                 set_invert_on();
597                         }
598                 }
599                 program {
600                         name: "invert_off";
601                         signal: "elm,state,inverted,off";
602                         source: "elm";
603                         script {
604                                 set_invert_off();
605                         }
606                 }
607                 program {
608                         name: "val_show";
609                         signal: "mouse,down,*";
610                         source: "elm.dragable.slider";
611                         script {
612                                 thumb_down();
613                         }
614                 }
615                 program {
616                         name: "val_hide";
617                         signal: "mouse,up,*";
618                         source: "elm.dragable.slider";
619                         script {
620                                 thumb_up();
621                         }
622                 }
623                 program {
624                         name: "popup_show";
625                         signal: "elm,state,val,show";
626                         source: "elm";
627                         script {
628                                 set_popup_show();
629                         }
630                 }
631                 program {
632                         name: "popup_hide";
633                         signal: "elm,state,val,hide";
634                         source: "elm";
635                         script {
636                                 set_popup_hide();
637                         }
638                 }
639                 program {
640                         name: "icon_show";
641                         signal: "elm,state,icon,visible";
642                         source: "elm";
643                         action:  STATE_SET "visible" 0.0;
644                         target: "elm.swallow.icon";
645                         target: "bar_icon_right_padding_1";
646                 }
647                 program {
648                         name: "center_point_enable";
649                         signal: "slider,center,point,show";
650                         source: "elm";
651                         script {
652                                 set_state(PART:"center_point", "visible", 0.0);
653                                 set_int(show, 1);
654                         }
655                 }
656                 program {
657                         name: "center_point_disable";
658                         signal: "slider,center,point,hide";
659                         source: "elm";
660                         script {
661                                 set_state(PART:"center_point", "default", 0.0);
662                                 set_int(show, 0);
663                         }
664                 }
665                 program {
666                         name: "slider_disable";
667                         signal: "elm,state,disabled";
668                         source: "elm";
669                         script {
670                                 if (get_int(show)) {
671                                         set_state(PART:"center_point", "disabled", 0.0);
672                                 }
673                                 set_state(PART:"disabler", "disabled", 0.0);
674                                 set_state(PART:"icon_clipper", "disabled", 0.0);
675                                 set_state(PART:"clipper", "disabled", 0.0);
676                                 set_state(PART:"base", "disabled", 0.0);
677                         }
678                 }
679                 program {
680                         name: "slider_enable";
681                         signal: "elm,state,enabled";
682                         source: "elm";
683                         script {
684                                 if (get_int(show)) {
685                                         set_state(PART:"center_point", "default", 0.0);
686                                 }
687                                 set_state(PART:"disabler", "default", 0.0);
688                                 set_state(PART:"icon_clipper", "default", 0.0);
689                                 set_state(PART:"clipper", "default", 0.0);
690                                 set_state(PART:"base", "default", 0.0);
691                         }
692                 }
693         }
694 }