elm_calendar: provides way for configuration of weekend text color
authorJiwon Kim <jwkim0000@gmail.com>
Mon, 11 Jul 2016 07:10:34 +0000 (16:10 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 11 Jul 2016 07:10:35 +0000 (16:10 +0900)
Summary:
Suggest new mark_type for elm_calendar_mark_add().
The mark names are "weekend/day1", "weekend/day2".
It can be used for each country.
Some country can apply to "weekend/day2" to friday if day rest only a day for a week.
Until now, there is no way to separate holiday, saturday and sunday.

Test Plan:
1. saturday
```
struct tm t = { 0, 0, 12, 6, 0, 0, 6, 6, -1 };
elm_calendar_mark_add(obj, "weekend/day1", &t, ELM_CALENDAR_WEEKLY);
```
2. sunday
```
 struct tm t = { 0, 0, 12, 7, 0, 0, 0, 0, -1 };
 elm_calendar_mark_add(obj, "weekend/day2", &t, ELM_CALENDAR_WEEKLY);
```

Reviewers: CHAN, cedric, raster

Reviewed By: raster

Subscribers: raster, akanad, id213sin, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4148

data/elementary/themes/colorclasses.edc
data/elementary/themes/edc/elm/calendar.edc
src/lib/elementary/elm_removed.h

index dbfc3f8..ab6dc07 100644 (file)
@@ -170,6 +170,16 @@ color_classes {
       color3: 255 255 255 192;
       desc: "Disabled Day Text";
    }
+   color_class { name: "calendar_day_text_weekend1";
+      color: 128 128 128 255;
+      color3: 0 0 0 128;
+      desc: "Weekend Day1 Text";
+   }
+   color_class { name: "calendar_day_text_weekend2";
+      color: 128 128 128 255;
+      color3: 0 0 0 128;
+      desc: "Weekend Day2 Text";
+   }
    color_class { name: "check_text";
       color: FN_COL_DEFAULT;
       desc: "Text of a checkbox's label";
index e5edcba..662bd51 100644 (file)
       style { name: "calendar_date_disabled_style";\
          base: "font="FN" font_size=10 color=#151515 style=shadow,bottom shadow_color=#ffffffc0 align=center text_class=calendar_day_text_disabled text_class=calendar_day_text_disabled";\
       }\
+      style { name: "calendar_date_weekend1_style";\
+         base: "font="FN" font_size=10 color=#2020C0 style=shadow,bottom shadow_color=#ffffffc0 align=center text_class=calendar_day_text_weekend1 color_class=calendar_day_text_weekend1";\
+      }\
+      style { name: "calendar_date_weekend2_style";\
+         base: "font="FN" font_size=10 color=#C02020 style=shadow,bottom shadow_color=#ffffffc0 align=center text_class=calendar_day_text_weekend2 color_class=calendar_day_text_weekend2";\
+      }\
 
 #define CAL_SPIN(_sufix, _text, _relative)\
       part { name: "left_bt"#_sufix; type: SPACER;\
          inherit: "default" 0.0; \
          text.style: "calendar_date_disabled_style"; \
       } \
+      description { state: "weekend/day1" 0.0; \
+         inherit: "default" 0.0; \
+         text.style: "calendar_date_weekend1_style"; \
+      } \
+      description { state: "weekend/day2" 0.0; \
+         inherit: "default" 0.0; \
+         text.style: "calendar_date_weekend2_style"; \
+      } \
    } \
    part { name: "cit_"#_pos".check"; mouse_events: 0; \
       scale: 1; \
          source:  "elm"; \
          action:  STATE_SET "default" 0.0; \
          target:  "cit_"#_pos".check"; \
+         after:   "cit_"#_pos".weekends_clear"; \
          after:   "cit_"#_pos".holiday_clear"; \
       } \
       program { \
+         name:    "cit_"#_pos".weekends_clear"; \
+         script { \
+            new st[31]; \
+            new Float:vl; \
+            get_state(PART:"cit_"#_pos".text", st, 30, vl); \
+            if (!strcmp(st, "weekend/day1") || !strcmp(st, "weekend/day2")) \
+              set_state(PART:"cit_"#_pos".text", "default", 0.0); \
+         } \
+      } \
+      program { \
          name:    "cit_"#_pos".holiday_clear"; \
          script { \
             new st[31]; \
               set_state(PART:"cit_"#_pos".text", "holiday", 0.0); \
          } \
       } \
+      program { \
+         name:    "cit_"#_pos".weekend/day1"; \
+         signal:  "cit_"#_pos",weekend/day1"; \
+         source:  "elm"; \
+         script { \
+            new st[31]; \
+            new Float:vl; \
+            get_state(PART:"cit_"#_pos".text", st, 30, vl); \
+            if ((strcmp(st, "today")) && (strcmp(st, "holiday")) )\
+              set_state(PART:"cit_"#_pos".text", "weekend/day1", 0.0); \
+         } \
+      } \
+      program { \
+         name:    "cit_"#_pos".weekend/day2"; \
+         signal:  "cit_"#_pos",weekend/day2"; \
+         source:  "elm"; \
+         script { \
+            new st[31]; \
+            new Float:vl; \
+            get_state(PART:"cit_"#_pos".text", st, 30, vl); \
+            if ((strcmp(st, "today")) && (strcmp(st, "holiday")) )\
+              set_state(PART:"cit_"#_pos".text", "weekend/day2", 0.0); \
+         } \
+      } \
    }
 
 group { name: "elm/calendar/base/default";
index e416cc4..2d0e0c2 100644 (file)
@@ -1293,7 +1293,7 @@ EINA_DEPRECATED EAPI Evas_Object *elm_button_icon_unset(Evas_Object *obj);
  *
  * @code
  * struct tm t = { 0, 0, 12, 6, 0, 0, 6, 6, -1 };
- * elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
+ * elm_calendar_mark_add(obj, "weekend/day1", &t, ELM_CALENDAR_WEEKLY);
  * @endcode
  *
  * @see elm_calendar_mark_add()
@@ -1313,7 +1313,7 @@ EINA_DEPRECATED EAPI void elm_calendar_text_saturday_color_set(Evas_Object *obj,
  *
  * @code
  * struct tm t = { 0, 0, 12, 7, 0, 0, 0, 0, -1 };
- * elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
+ * elm_calendar_mark_add(obj, "weekend/day2", &t, ELM_CALENDAR_WEEKLY);
  * @endcode
  *
  * @see elm_calendar_mark_add()