[elm_colorselector]: merged from Opensource 2. config/slp updated with
authorshilpa singh <shilpa.singh@samsung.com>
Sat, 10 Mar 2012 06:32:33 +0000 (12:02 +0530)
committershilpa singh <shilpa.singh@samsung.com>
Sat, 10 Mar 2012 06:32:33 +0000 (12:02 +0530)
dayselector and colorselector parameters

14 files changed:
config/default/base.src
config/illume/base.src
config/slp/base.src
config/standard/base.src
data/themes/widgets/colorselector.edc
doc/Makefile.am
doc/examples.dox
doc/widgets/widget_preview_colorselector.c
src/bin/test_colorselector.c
src/examples/colorselector_example_01.c
src/lib/elm_colorselector.c
src/lib/elm_colorselector.h
src/lib/elm_config.c
src/lib/elm_priv.h

index 9566dc0..4a37a35 100644 (file)
@@ -59,4 +59,160 @@ group "Elm_Config" struct {
   value "week_start" int: 1;
   value "weekend_start" int: 6;
   value "weekend_len" int: 2;
+  group "color_palette" list {
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "default";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 180;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 92;
+              value "g" uint: 142;
+              value "b" uint: 151;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 68;
+              value "b" uint: 59;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 46;
+              value "b" uint: 68;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 68;
+              value "g" uint: 40;
+              value "b" uint: 55;
+              value "a" uint: 255;
+           }
+        }
+     }
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "painting";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 18;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 213;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 146;
+              value "g" uint: 255;
+              value "b" uint: 11;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 9;
+              value "g" uint: 186;
+              value "b" uint: 10;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 86;
+              value "g" uint: 201;
+              value "b" uint: 242;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 18;
+              value "g" uint: 83;
+              value "b" uint: 128;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 140;
+              value "g" uint: 53;
+              value "b" uint: 238;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 145;
+              value "b" uint: 145;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 59;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 69;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+        }
+     }
+  }
 }
index 0057da1..2c68f74 100644 (file)
@@ -60,4 +60,160 @@ group "Elm_Config" struct {
   value "week_start" int: 1;
   value "weekend_start" int: 6;
   value "weekend_len" int: 2;
+  group "color_palette" list {
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "default";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 180;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 92;
+              value "g" uint: 142;
+              value "b" uint: 151;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 68;
+              value "b" uint: 59;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 46;
+              value "b" uint: 68;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 68;
+              value "g" uint: 40;
+              value "b" uint: 55;
+              value "a" uint: 255;
+           }
+        }
+     }
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "painting";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 18;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 213;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 146;
+              value "g" uint: 255;
+              value "b" uint: 11;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 9;
+              value "g" uint: 186;
+              value "b" uint: 10;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 86;
+              value "g" uint: 201;
+              value "b" uint: 242;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 18;
+              value "g" uint: 83;
+              value "b" uint: 128;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 140;
+              value "g" uint: 53;
+              value "b" uint: 238;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 145;
+              value "b" uint: 145;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 59;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 69;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+        }
+     }
+  }
 }
index 093c081..fd1e220 100644 (file)
@@ -56,4 +56,151 @@ group "Elm_Config" struct {
   value "glayer_flick_time_limit_ms" uint: 60; /* 60 ms to finish flick */
   value "glayer_long_tap_start_timeout" double: 1.2; /* 1.2 sec to start long-tap */
   value "glayer_continues_enable" uchar: 1;          /* Continues gesture enabled */
+  value "week_start" int: 1;
+  value "weekend_start" int: 6;
+  value "weekend_len" int: 2;
+  group "color_palette" list {
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "default";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 18;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 213;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 146;
+              value "g" uint: 255;
+              value "b" uint: 11;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 9;
+              value "g" uint: 186;
+              value "b" uint: 10;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 86;
+              value "g" uint: 201;
+              value "b" uint: 242;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 18;
+              value "g" uint: 83;
+              value "b" uint: 128;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 140;
+              value "g" uint: 53;
+              value "b" uint: 238;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 145;
+              value "b" uint: 145;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 59;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 69;
+              value "a" uint: 255;
+           }
+        }
+     }
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "painting";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 180;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 92;
+              value "g" uint: 142;
+              value "b" uint: 151;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 68;
+              value "b" uint: 59;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 46;
+              value "b" uint: 68;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 68;
+              value "g" uint: 40;
+              value "b" uint: 55;
+              value "a" uint: 255;
+           }
+        }
+     }
+  }
 }
index 159d792..24d65e4 100644 (file)
@@ -59,4 +59,160 @@ group "Elm_Config" struct {
   value "week_start" int: 1;
   value "weekend_start" int: 6;
   value "weekend_len" int: 2;
+  group "color_palette" list {
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "default";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 0;
+              value "g" uint: 255;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 0;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 180;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 92;
+              value "g" uint: 142;
+              value "b" uint: 151;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 68;
+              value "b" uint: 59;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 41;
+              value "g" uint: 46;
+              value "b" uint: 68;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 68;
+              value "g" uint: 40;
+              value "b" uint: 55;
+              value "a" uint: 255;
+           }
+        }
+     }
+     group "Elm_Custom_Palette" struct {
+        value "palette_name" string: "painting";
+        group "color_list" list {
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 90;
+              value "b" uint: 18;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 213;
+              value "b" uint: 0;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 146;
+              value "g" uint: 255;
+              value "b" uint: 11;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 9;
+              value "g" uint: 186;
+              value "b" uint: 10;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 86;
+              value "g" uint: 201;
+              value "b" uint: 242;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 18;
+              value "g" uint: 83;
+              value "b" uint: 128;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 140;
+              value "g" uint: 53;
+              value "b" uint: 238;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 145;
+              value "b" uint: 145;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 59;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 69;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 255;
+              value "g" uint: 255;
+              value "b" uint: 119;
+              value "a" uint: 255;
+           }
+           group "Elm_Color_RGBA" struct {
+              value "r" uint: 133;
+              value "g" uint: 100;
+              value "b" uint: 255;
+              value "a" uint: 255;
+           }
+        }
+     }
+  }
 }
index fd824be..1573f5b 100644 (file)
@@ -1,3 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////
+group {
+   name: "elm/colorselector/palette/default";
+   data.item: "horizontal_pad" "10";
+   data.item: "vertical_pad" "10";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         mouse_events: 1;
+         description { state: "default" 0.0;
+            visible: 0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "palette";
+         type: SWALLOW;
+         scale: 1;
+         mouse_events: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "base";
+            }
+            rel2 {
+               relative: 1.0 0.0;
+               to: "base";
+            }
+         }
+      }
+      part{ name: "bottom_padding";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 0;
+            min: 0 20;
+            fixed: 0 1;
+            rel1.relative: 0.0 1.0;
+            rel1.to: "palette";
+            rel2.to: "palette";
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "selector";
+         type: SWALLOW;
+         scale: 1;
+         mouse_events: 1;
+         description { state: "default" 0.0;
+            align: 0.0 1.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "bottom_padding";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "base";
+            }
+         }
+      }
+   }
+}
+
 group { name: "elm/colorselector/bg/default";
    parts {
       part { name: "elm.colorbar_0";
@@ -165,8 +228,7 @@ group { name: "elm/colorselector/base/default";
          type: SWALLOW;
          mouse_events: 1;
          scale: 1;
-         description {
-            state: "default" 0.0;
+         description { state: "default" 0.0;
             min: 24 24;
             fixed: 1 1;
             rel1 {
@@ -284,3 +346,68 @@ group { name: "elm/colorselector/arrow/default";
       }
    }
 }
+
+group { name: "elm/colorselector/item/default";
+   parts {
+      part { name: "color_bg";
+         type: RECT;
+         mouse_events: 1;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 40 40;
+         }
+      }
+      part { name: "color_obj";
+         type: SWALLOW;
+         mouse_events: 1;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "color_bg";
+            rel2.to: "color_bg";
+         }
+      }
+      part { name: "focus_color";
+         mouse_events:1;
+         scale: 1;
+         type: RECT;
+         description { state: "default" 0.0;
+            visible: 0;
+            min: 38 38;
+            rel1.to: "color_bg";
+            rel2.to: "color_bg";
+            color: 255 255 255 80;
+         }
+         description { state: "focused" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+   }
+   programs {
+      program { name: "item_focus";
+         source: "elm";
+         signal: "elm,state,selected";
+         action: STATE_SET "focused" 0.0;
+         target: "focus_color";
+      }
+      program { name: "item_unfocus";
+         source: "elm";
+         signal: "elm,state,unselected";
+         action: STATE_SET "default" 0.0;
+         target: "focus_color";
+      }
+   }
+}
+
+group { name: "elm/colorselector/item/color/default";
+   parts {
+      part { name: "color_rect";
+         type: RECT;
+         mouse_events: 1;
+         scale: 1;
+         description{ state: "default" 0.0;
+         }
+      }
+   }
+}
+
index 8fab361..81d4cd7 100644 (file)
@@ -24,7 +24,7 @@ WGT_PREVIEW = \
        bubble:preview-00.png:widget_preview_bubble1:160:50 \
        bubble:preview-01.png:widget_preview_bubble2:160:50 \
        bubble:preview-02.png:widget_preview_bubble3:160:50 \
-       colorselector:preview-00.png:widget_preview_colorselector:160:200 \
+       colorselector:preview-00.png:widget_preview_colorselector:320:300 \
        layout:preview-00.png:widget_preview_layout:200:160 \
        conformant:preview-00.png:widget_preview_conformant:200:400 \
        list:preview-00.png:widget_preview_list:200:200 \
index 39094fa..ea894ca 100644 (file)
  * @until show(rect)
  *
  * Now that we have a window with background and a rectangle we can create
- * our color_selector and set it's initial color to fully opaque blue:
- * @until show
+ * our color_selector
+ * @until elm_colorselector_add
+ *
+ * Now colors can be loaded to color selector's palette by setting the palette name
+ * @until show(cs)
  *
- * Next we tell ask to be notified whenever the color changes:
+ * Next we ask to be notified whenever the color changes on selector:
  * @until changed
  *
- * We follow that we some more run of the mill setup code:
+ * Next we ask to be notified whenever the color item is selected and longpressed:
+ * @until color,item,longpressed
+ *
+ * We add some more code to the usual setup code:
  * @until ELM_MAIN()
  *
- * And now get to the callback that sets the color of the rectangle:
+ * now get to the "changed" callback that sets the color of the rectangle:
+ * @until }
+ *
+ * And now get to the "color,item,selected" callback that sets the color of the rectangle:
+ * @until }
+ *
+ * And now get to the "color,item,longpressed" callback that gets and displays 
+ * the color of the rectangle:
  * @until }
  *
  * This example will look like this:
index f737039..784a2d6 100644 (file)
@@ -1,8 +1,14 @@
 #include "widget_preview_tmpl_head.c"
+Evas_Object *bx = elm_box_add(win);
+evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, bx);
+evas_object_show(bx);
 
 Evas_Object *o = elm_colorselector_add(win);
 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-elm_win_resize_object_add(win, o);
+evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);;
+elm_box_pack_end(bx, o);
 evas_object_show(o);
 
 #include "widget_preview_tmpl_foot.c"
index d36452f..879c8f7 100644 (file)
@@ -21,10 +21,28 @@ _colorselector_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSE
    evas_object_color_set(re, r, g, b, a);
 }
 
+static void
+_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info)
+{
+   int r = 0, g = 0, b = 0 ,a = 0;
+   Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
+   elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+   evas_object_color_set((Evas_Object *) data, r, g, b , a);
+}
+
+static void
+_colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+   int r = 0,g = 0,b = 0 ,a = 0;
+   Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
+   elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+   printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a);
+}
+
 void
 test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bx, *cp, *fr, *ly, *re;
+   Evas_Object *win, *bg, *bx, *cs, *fr, *ly, *re;
    char buf[PATH_MAX];
    int r, g, b, a;
 
@@ -69,21 +87,35 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
    elm_box_pack_end(bx, fr);
    evas_object_show(fr);
 
-   cp = elm_colorselector_add(win);
+   cs = elm_colorselector_add(win);
+   elm_colorselector_palette_color_add(cs, 255, 90, 18, 255);
+   elm_colorselector_palette_color_add(cs, 255, 213, 0, 255);
+   elm_colorselector_palette_color_add(cs, 146, 255, 11, 255);
+   elm_colorselector_palette_color_add(cs, 9, 186, 10, 255);
+   elm_colorselector_palette_color_add(cs, 86, 201, 242, 255);
+   elm_colorselector_palette_color_add(cs, 18, 83, 128, 255);
+   elm_colorselector_palette_color_add(cs, 140, 53, 238, 255);
+   elm_colorselector_palette_color_add(cs, 255, 145, 145, 255);
+   elm_colorselector_palette_color_add(cs, 255, 59, 119, 255);
+   elm_colorselector_palette_color_add(cs, 133, 100, 69, 255);
+   elm_colorselector_palette_color_add(cs, 255, 255, 119, 255);
+   elm_colorselector_palette_color_add(cs, 133, 100, 255, 255);
 
    a = 180;
    r = 255;
    g = 160;
    b = 132;
 
-   elm_colorselector_color_set(cp, r, g, b, a);
-   evas_object_size_hint_weight_set(cp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_size_hint_align_set(cp, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_object_content_set(fr, cp);
-   evas_object_show(cp);
-   evas_object_smart_callback_add(cp, "changed", _colorselector_clicked_cb, re);
+   elm_colorselector_color_set(cs, r, g, b, a);
+   evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_content_set(fr, cs);
+   evas_object_show(cs);
+   evas_object_smart_callback_add(cs, "changed", _colorselector_clicked_cb, re);
+   evas_object_smart_callback_add(cs, "color,item,selected", _colorpalette_clicked_cb, re);
+   evas_object_smart_callback_add(cs, "color,item,longpressed", _colorpalette_longpressed_cb, re);
 
-   elm_colorselector_color_get(cp, &r, &g, &b, &a);
+   elm_colorselector_color_get(cs, &r, &g, &b, &a);
    /* Fix Alpha pre multiplication by edje */
    r = (r * a) / 255;
    g = (g * a) / 255;
index 0d024a1..6a7fe8e 100644 (file)
@@ -7,12 +7,13 @@
 #endif
 
 static void _change_color(void *data, Evas_Object *obj, void *event_info);
+static void _colorpalette_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+static void _colorpalette_longpressed_cb(void *data, Evas_Object *obj, void *event_info);
 
 EAPI_MAIN int
 elm_main(int argc, char **argv)
 {
-   Evas_Object *win, *bg, *cs, *frame, *rect;
-   char buf[256];
+   Evas_Object *win, *bg, *cs, *rect, *bx, *fr;
 
    win = elm_win_add(NULL, "color selector", ELM_WIN_BASIC);
    elm_win_title_set(win, "Color selector");
@@ -20,26 +21,50 @@ elm_main(int argc, char **argv)
    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
 
    bg = elm_bg_add(win);
+   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(win, bg);
    evas_object_show(bg);
 
+   bx = elm_box_add(win);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_win_resize_object_add(win, bx);
+   evas_object_show(bx);
+
+   fr = elm_frame_add(win);
+   evas_object_size_hint_weight_set(fr, 1.0, 0.5);
+   evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_text_set(fr, "Color View");
+   elm_box_pack_end(bx, fr);
+   evas_object_show(fr);
+
    rect = evas_object_rectangle_add(evas_object_evas_get(win));
-   evas_object_resize(rect, 50, 50);
-   evas_object_move(rect, 125, 325);
-   evas_object_color_set(rect, 0, 0, 255, 255);
+   elm_object_content_set(fr, rect);
+   evas_object_color_set(rect, 255, 90, 18, 255);
    evas_object_show(rect);
 
+   fr = elm_frame_add(win);
+   evas_object_size_hint_weight_set(fr, 1.0, 0.5);
+   evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_object_text_set(fr, "Color Selector");
+   elm_box_pack_end(bx, fr);
+   evas_object_show(fr);
+
    cs = elm_colorselector_add(win);
-   elm_colorselector_color_set(cs, 0, 0, 255, 255);
-   evas_object_resize(cs, 300, 300);
+   elm_colorselector_palette_name_set(cs, "painting");
+   evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, 0.0);
+   elm_colorselector_color_set(cs, 255, 90, 18, 255);
    evas_object_show(cs);
    evas_object_smart_callback_add(cs, "changed", _change_color, rect);
+   evas_object_smart_callback_add(cs, "color,item,selected", _colorpalette_clicked_cb, rect);
+   evas_object_smart_callback_add(cs, "color,item,longpressed", _colorpalette_longpressed_cb, rect);
+   elm_object_content_set(fr, cs);
 
-   evas_object_resize(win, 300, 400);
+   evas_object_resize(win, 320, 480);
    evas_object_show(win);
 
    elm_run();
-   evas_object_del(rect);
 
    return 0;
 }
@@ -52,3 +77,21 @@ _change_color(void *data, Evas_Object *obj, void *event_info)
    elm_colorselector_color_get(obj, &r, &g, &b, &a);
    evas_object_color_set(data, r, g, b, a);
 }
+
+static void
+_colorpalette_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+   int r = 0, g = 0, b = 0 ,a = 0;
+   Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
+   elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+   evas_object_color_set(data, r, g, b, a);
+}
+
+static void
+_colorpalette_longpressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+   int r = 0,g = 0,b = 0 ,a = 0;
+   Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
+   elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+   printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a);
+}
index 8c585d4..6a8d207 100644 (file)
@@ -6,6 +6,8 @@
 #define SAT_STEP 128.0
 #define LIG_STEP 256.0
 #define ALP_STEP 256.0
+#define DEFAULT_HOR_PAD 10
+#define DEFAULT_VER_PAD 10
 
 typedef enum _Color_Type
 {
@@ -30,16 +32,32 @@ struct _Colorselector_Data
 };
 
 typedef struct _Widget_Data Widget_Data;
+typedef struct _Elm_Color_Item Elm_Color_Item;
 struct _Widget_Data
 {
+   Evas_Object *sel;
    Evas_Object *base;
+   Evas_Object *box;
+   Eina_List *items;
    Colorselector_Data *cp[4];
+   Ecore_Timer *longpress_timer;
+   const char *palette_name;
    Evas_Coord _x, _y, _w, _h;
    int r, g, b, a;
    int er, eg, eb;
    int sr, sg, sb;
    int lr, lg, lb;
    double h, s, l;
+   Elm_Colorselector_Mode mode;
+   Eina_Bool longpressed : 1;
+   Eina_Bool config_load: 1;
+};
+
+struct _Elm_Color_Item
+{
+   ELM_WIDGET_ITEM;
+   Evas_Object *color_obj;
+   Elm_Color_RGBA *color;
 };
 
 static const char *widtype = NULL;
@@ -47,6 +65,7 @@ static const char *widtype = NULL;
 static void _del_hook(Evas_Object *obj);
 static void _theme_hook(Evas_Object *obj);
 static void _sizing_eval(Evas_Object *obj);
+static void _resize_cb(void *data, Evas *a, Evas_Object *obj, void *event_info);
 static void _rgb_to_hsl(void *data);
 static void _hsl_to_rgb(void *data);
 static void _color_with_saturation(void *data);
@@ -66,13 +85,26 @@ static void _right_button_repeat_cb(void *data, Evas_Object * obj,
                                     void *event_info);
 static void _add_colorbar(Evas_Object *obj);
 static void _set_color(Evas_Object *obj, int r, int g, int b, int a);
+static Elm_Color_Item *_item_new(Evas_Object *obj);
+static void _item_sizing_eval(Elm_Color_Item *item);
+static void _item_highlight(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _item_unhighlight(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static Eina_Bool _long_press(void *data);
+static void _remove_items(Widget_Data *wd);
+static void _colors_remove(Evas_Object *obj);
+static void _colors_save(Evas_Object *obj);
+static void _colors_load_apply(Evas_Object *obj);
 
 static const char SIG_CHANGED[] = "changed";
+static const char SIG_COLOR_ITEM_SELECTED[] = "color,item,selected";
+static const char SIG_COLOR_ITEM_LONGPRESSED[] = "color,item,longpressed";
 
 static const Evas_Smart_Cb_Description _signals[] =
 {
-     {SIG_CHANGED, ""},
-     {NULL, NULL}
+   {SIG_COLOR_ITEM_SELECTED, ""},
+   {SIG_COLOR_ITEM_LONGPRESSED, ""},
+   {SIG_CHANGED, ""},
+   {NULL, NULL}
 };
 
 static void
@@ -82,6 +114,9 @@ _del_hook(Evas_Object *obj)
    int i = 0;
 
    if (!wd) return;
+   if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
+   if (wd->palette_name) eina_stringshare_del(wd->palette_name);
+   _remove_items(wd);
    for (i = 0; i < 4; i++) free(wd->cp[i]);
    free(wd);
 }
@@ -90,13 +125,21 @@ static void
 _theme_hook(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_List *elist;
+   Elm_Color_Item *item;
    int i;
 
-   if ((!wd) || (!wd->base)) return;
+   if ((!wd) || (!wd->sel)) return;
 
-   _elm_theme_object_set(obj, wd->base, "colorselector", "bg",
+   _elm_theme_object_set(obj, wd->base, "colorselector", "palette",
                          elm_widget_style_get(obj));
-
+   _elm_theme_object_set(obj, wd->sel, "colorselector", "bg",
+                         elm_widget_style_get(obj));
+   EINA_LIST_FOREACH(wd->items, elist, item)
+     {
+        elm_layout_theme_set(VIEW(item), "colorselector", "item", elm_widget_style_get(obj));
+        _elm_theme_object_set(obj, item->color_obj, "colorselector", "item/color", elm_widget_style_get(obj));
+     }
    for (i = 0; i < 4; i++)
      {
         evas_object_del(wd->cp[i]->colorbar);
@@ -136,10 +179,52 @@ _colorselector_set_size_hints(Evas_Object *obj, int timesw, int timesh)
 }
 
 static void
-_sizing_eval(Evas_Object *obj)
+_item_sizing_eval(Elm_Color_Item *item)
+{
+   Evas_Coord minw = -1, minh = -1;
+
+   if (!item) return;
+
+   elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+   edje_object_size_min_restricted_calc(VIEW(item), &minw, &minh, minw,
+                                        minh);
+   evas_object_size_hint_min_set(VIEW(item), minw, minh);
+}
+
+static void _resize_cb(void *data, Evas *a __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   _sizing_eval(data);
+}
+
+static void
+_sizing_eval_palette(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_List *elist;
+   Elm_Color_Item *item;
+   Evas_Coord bw = 0, bh = 0;
+   Evas_Coord w = 0, h = 0;
+   if (!wd) return;
+
+   EINA_LIST_FOREACH(wd->items, elist, item)
+     {
+        _item_sizing_eval(item);
+     }
+   evas_object_size_hint_min_get(wd->box, &bw, &bh);
+   evas_object_size_hint_min_set(obj, bw, bh);
+   evas_object_size_hint_max_set(obj, -1, -1);
+   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+   if (w < bw) w = bw;
+   if (h < bh) h = bh;
+   evas_object_resize(obj, w, h);
+}
+
+static void
+_sizing_eval_selector(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    Evas_Coord minw = -1, minh = -1;
+   Evas_Coord w = 0, h = 0;
    int i;
 
    if (!wd) return;
@@ -156,9 +241,211 @@ _sizing_eval(Evas_Object *obj)
      }
 
    elm_coords_finger_size_adjust(4, &minw, 4, &minh);
-   edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
+   edje_object_size_min_restricted_calc(wd->sel, &minw, &minh, minw, minh);
    evas_object_size_hint_min_set(obj, minw, minh);
    evas_object_size_hint_max_set(obj, -1, -1);
+   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+   if (w < minw) w = minw;
+   if (h < minh) h = minh;
+   evas_object_resize(obj, w, h);
+}
+
+static void
+_sizing_eval_palette_selector(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Evas_Coord minw = -1, minh = -1;
+   Evas_Coord bw = 0, bh = 0;
+   Evas_Coord w = 0, h = 0;
+   int i;
+   if (!wd) return;
+   elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+   for (i = 0; i < 4; i++)
+     {
+        if (wd->cp[i]->bg_rect)
+          _colorselector_set_size_hints(wd->cp[i]->bg_rect, 1, 1);
+        _colorselector_set_size_hints(wd->cp[i]->bar, 1, 1);
+        _colorselector_set_size_hints(wd->cp[i]->rbt, 1, 1);
+        _colorselector_set_size_hints(wd->cp[i]->lbt, 1, 1);
+
+        _colorselector_set_size_hints(wd->cp[i]->colorbar, 4, 1);
+     }
+
+   elm_coords_finger_size_adjust(4, &minw, 4, &minh);
+   edje_object_size_min_restricted_calc(wd->sel, &minw, &minh, minw, minh);
+   evas_object_size_hint_min_get(wd->box, &bw, &bh);
+   evas_object_size_hint_min_set(obj, minw, minh+bh);
+   evas_object_size_hint_max_set(obj, -1, -1);
+   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+   if (w < minw) w = minw;
+   if (h < (minh+bh)) h = (minh+bh);
+   evas_object_resize(obj, w, h);
+}
+
+static void
+_sizing_eval(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   switch (wd->mode)
+     {
+        case ELM_COLORSELECTOR_PALETTE:
+           _sizing_eval_palette(obj);
+           break;
+        case ELM_COLORSELECTOR_COMPONENTS:
+           _sizing_eval_selector(obj);
+           break;
+        case ELM_COLORSELECTOR_BOTH:
+           _sizing_eval_palette_selector(obj);
+           break;
+        default:
+           break;
+     }
+}
+
+static Eina_Bool
+_long_press(void *data)
+{
+   Elm_Color_Item *item = (Elm_Color_Item *) data;
+   Widget_Data *wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return ECORE_CALLBACK_CANCEL;
+   wd->longpress_timer = NULL;
+   wd->longpressed = EINA_TRUE;
+   evas_object_smart_callback_call(WIDGET(item), SIG_COLOR_ITEM_LONGPRESSED, item);
+   return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_item_highlight(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Elm_Color_Item *item = (Elm_Color_Item *) data;
+   Evas_Event_Mouse_Down *ev = event_info;
+   if (!item) return;
+   Widget_Data *wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+   if (ev->button != 1) return;
+   elm_object_signal_emit(VIEW(item), "elm,state,selected", "elm");
+   wd->longpressed = EINA_FALSE;
+   if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
+   wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
+}
+
+static void
+_item_unhighlight(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Elm_Color_Item *item = (Elm_Color_Item *) data;
+   Evas_Event_Mouse_Down *ev = event_info;
+   if (!item) return;
+   Widget_Data *wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+   if (ev->button != 1) return;
+   if (wd->longpress_timer)
+     {
+        ecore_timer_del(wd->longpress_timer);
+        wd->longpress_timer = NULL;
+     }
+   elm_object_signal_emit(VIEW(item), "elm,state,unselected", "elm");
+   if (!wd->longpressed)
+     {
+        evas_object_smart_callback_call(WIDGET(item), SIG_COLOR_ITEM_SELECTED, item);
+        elm_colorselector_color_set(WIDGET(item), item->color->r, item->color->g, item->color->b, item->color->a);
+     }
+}
+
+static void
+_remove_items(Widget_Data *wd)
+{
+   Elm_Color_Item *item;
+
+   if (!wd->items) return;
+
+   EINA_LIST_FREE(wd->items, item)
+     {
+        free(item->color);
+        elm_widget_item_free(item);
+     }
+
+   wd->items = NULL;
+}
+
+static Elm_Color_Item*
+_item_new(Evas_Object *obj)
+{
+   Elm_Color_Item *item;
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+
+   item = elm_widget_item_new(obj, Elm_Color_Item);
+   if (!item) return NULL;
+
+   VIEW(item) = elm_layout_add(obj);
+   elm_layout_theme_set(VIEW(item), "colorselector", "item", elm_widget_style_get(obj));
+   evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
+   item->color_obj = edje_object_add(evas_object_evas_get(obj));
+   _elm_theme_object_set(obj, item->color_obj, "colorselector", "item/color", elm_widget_style_get(obj));
+   evas_object_size_hint_weight_set(item->color_obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(item->color_obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   evas_object_event_callback_add(item->color_obj, EVAS_CALLBACK_MOUSE_DOWN, _item_highlight, item);
+   evas_object_event_callback_add(item->color_obj, EVAS_CALLBACK_MOUSE_UP, _item_unhighlight, item);
+   elm_object_part_content_set(VIEW(item), "color_obj", item->color_obj);
+   _item_sizing_eval(item);
+   evas_object_show(VIEW(item));
+
+   return item;
+}
+
+static void
+_colors_remove(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+
+   _remove_items(wd);
+   _elm_config_colors_free(wd->palette_name);
+}
+
+static void _colors_save(Evas_Object *obj)
+{
+   Eina_List *elist;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Elm_Color_Item *item;
+   _elm_config_colors_free(wd->palette_name);
+   EINA_LIST_FOREACH(wd->items, elist, item)
+     {
+        _elm_config_color_set(wd->palette_name, item->color->r, item->color->g,
+                              item->color->b, item->color->a);
+     }
+}
+
+static void
+_colors_load_apply(Evas_Object *obj)
+{
+   Elm_Color_RGBA *color;
+   Eina_List *elist;
+   Eina_List *color_list;
+   Elm_Color_Item *item;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   color_list = _elm_config_color_list_get(wd->palette_name);
+   if (!color_list) return;
+   EINA_LIST_FOREACH(color_list, elist, color)
+     {
+        item = _item_new(obj);
+        if (!item) return;
+        item->color = ELM_NEW(Elm_Color_RGBA);
+        if (!item->color) return;
+        item->color->r = color->r;
+        item->color->g = color->g;
+        item->color->b = color->b;
+        item->color->a = color->a;
+        elm_box_pack_end(wd->box, VIEW(item));
+        evas_object_color_set(item->color_obj, item->color->r, item->color->g,
+                              item->color->b, item->color->a);
+        wd->items = eina_list_append(wd->items, item);
+        _sizing_eval_palette(obj);
+     }
+   wd->config_load = EINA_TRUE;
 }
 
 static void
@@ -604,7 +891,7 @@ _add_colorbar(Evas_Object *obj)
         snprintf(colorbar_s, sizeof(colorbar_s), "elm.colorbar_%d", i);
         edje_object_signal_callback_add(wd->cp[i]->colorbar, "drag", "*",
                                         _arrow_cb, wd->cp[i]);
-        edje_object_part_swallow(wd->base, colorbar_s, wd->cp[i]->colorbar);
+        edje_object_part_swallow(wd->sel, colorbar_s, wd->cp[i]->colorbar);
         elm_widget_sub_object_add(obj, wd->cp[i]->colorbar);
 
         /* load colorbar image */
@@ -741,6 +1028,9 @@ elm_colorselector_add(Evas_Object *parent)
    Evas_Object *obj = NULL;
    Widget_Data *wd = NULL;
    Evas *e;
+   const char *hpadstr, *vpadstr;
+   unsigned int h_pad = DEFAULT_HOR_PAD;
+   unsigned int v_pad = DEFAULT_VER_PAD;
 
    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
 
@@ -750,11 +1040,40 @@ elm_colorselector_add(Evas_Object *parent)
    elm_widget_data_set(obj, wd);
    elm_widget_del_hook_set(obj, _del_hook);
    elm_widget_theme_hook_set(obj, _theme_hook);
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
 
    /* load background edj */
    wd->base = edje_object_add(e);
-   _elm_theme_object_set(obj, wd->base, "colorselector", "bg", "default");
+   _elm_theme_object_set(obj, wd->base, "colorselector", "palette", "default");
    elm_widget_resize_object_set(obj, wd->base);
+   evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE,
+                                  _resize_cb, obj);
+
+   wd->box = elm_box_add(obj);
+   elm_box_layout_set(wd->box, evas_object_box_layout_flow_horizontal,
+                      NULL, NULL);
+   elm_box_horizontal_set(wd->box, EINA_TRUE);
+   evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
+                                    0);
+   evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0);
+   elm_box_homogeneous_set(wd->box, EINA_TRUE);
+   hpadstr = edje_object_data_get(wd->sel, "horizontal_pad");
+   if (hpadstr) h_pad = atoi(hpadstr);
+   vpadstr = edje_object_data_get(wd->sel, "vertical_pad");
+   if (vpadstr) v_pad = atoi(vpadstr);
+   elm_box_padding_set(wd->box, h_pad, v_pad);
+   elm_box_align_set(wd->box, 0.5, 0.5);
+   elm_widget_sub_object_add(obj, wd->box);
+   evas_object_show(wd->box);
+   edje_object_part_swallow(wd->base, "palette", wd->box);
+   wd->palette_name = eina_stringshare_add("default");
+   _colors_load_apply(obj);
+
+   /* load background edj */
+    wd->sel = edje_object_add(e);
+    _elm_theme_object_set(obj, wd->sel, "colorselector", "bg", "default");
+    edje_object_part_swallow(wd->base, "selector", wd->sel);
+    wd->mode = ELM_COLORSELECTOR_BOTH;
 
    wd->er = 255;
    wd->eg = 0;
@@ -768,7 +1087,6 @@ elm_colorselector_add(Evas_Object *parent)
    _add_colorbar(obj);
    _sizing_eval(obj);
 
-   evas_object_smart_callbacks_descriptions_set(obj, _signals);
    return obj;
 }
 
@@ -782,8 +1100,8 @@ elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a)
 EAPI void
 elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
    ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
 
    if (r) *r = wd->r;
    if (g) *g = wd->g;
@@ -792,60 +1110,154 @@ elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int
 }
 
 EAPI void
-elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode __UNUSED__)
+elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
-   //TODO: Implement!
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (wd->mode == mode) return;
+   wd->mode = mode;
+   switch (wd->mode)
+     {
+        case ELM_COLORSELECTOR_PALETTE:
+           if (edje_object_part_swallow_get(wd->base, "selector"))
+             {
+                edje_object_part_unswallow(wd->base, wd->sel);
+                evas_object_hide(wd->sel);
+             }
+           if (!edje_object_part_swallow_get(wd->base, "palette"))
+             {
+                edje_object_part_swallow(wd->base, "palette", wd->box);
+                evas_object_show(wd->box);
+             }
+           break;
+        case ELM_COLORSELECTOR_COMPONENTS:
+           if (edje_object_part_swallow_get(wd->base, "palette"))
+             {
+                edje_object_part_unswallow(wd->base, wd->box);
+                evas_object_hide(wd->box);
+             }
+           if (!edje_object_part_swallow_get(wd->base, "selector"))
+             {
+                edje_object_part_swallow(wd->base, "selector", wd->sel);
+                evas_object_show(wd->sel);
+             }
+           break;
+        case ELM_COLORSELECTOR_BOTH:
+           if (!edje_object_part_swallow_get(wd->base, "palette"))
+             {
+                edje_object_part_swallow(wd->base, "palette", wd->box);
+                evas_object_show(wd->box);
+             }
+           if (!edje_object_part_swallow_get(wd->base, "selector"))
+             {
+                edje_object_part_swallow(wd->base, "selector", wd->sel);
+                evas_object_show(wd->sel);
+             }
+           break;
+        default:
+           return;
+     }
+   _sizing_eval(obj);
 }
 
 EAPI Elm_Colorselector_Mode
 elm_colorselector_mode_get(const Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) ELM_COLORSELECTOR_PALETTE;
-   //TODO: Implement!
-   return ELM_COLORSELECTOR_PALETTE;
+   ELM_CHECK_WIDTYPE(obj, widtype) ELM_COLORSELECTOR_BOTH;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return ELM_COLORSELECTOR_BOTH;
+   return wd->mode;
 }
 
 EAPI void
 elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r __UNUSED__, int *g __UNUSED__, int *b __UNUSED__, int*a __UNUSED__)
 {
    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   //TODO: Implement!
+   Elm_Color_Item *item;
+   item = (Elm_Color_Item *) it;
+   if (item)
+     {
+        if(r) *r = item->color->r;
+        if(g) *g = item->color->g;
+        if(b) *b = item->color->b;
+        if(a) *a = item->color->a;
+     }
 }
 
 EAPI void
 elm_colorselector_palette_item_color_set(Elm_Object_Item *it, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__)
 {
    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   //TODO: Implement!
+   Elm_Color_Item *item;
+   item = (Elm_Color_Item *) it;
+   item->color->r = r;
+   item->color->g = g;
+   item->color->b = b;
+   item->color->a = a;
+   evas_object_color_set(item->color_obj, item->color->r, item->color->g, item->color->b, item->color->a);
+   _colors_save(WIDGET(it));
 }
 
 EAPI Elm_Object_Item *
-elm_colorselector_palette_color_add(Evas_Object *obj, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__)
+elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a)
 {
+   Elm_Color_Item *item;
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   //TODO: Implement!
-   return NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   if (wd->config_load)
+     {
+        _colors_remove(obj);
+        wd->config_load = EINA_FALSE;
+     }
+   item = _item_new(obj);
+   if (!item) return NULL;
+   item->color = ELM_NEW(Elm_Color_RGBA);
+   if (!item->color) return NULL;
+   item->color->r = r;
+   item->color->g = g;
+   item->color->b = b;
+   item->color->a = a;
+   _elm_config_color_set(wd->palette_name, item->color->r, item->color->g,
+                         item->color->b, item->color->a);
+   elm_box_pack_end(wd->box, VIEW(item));
+   evas_object_color_set(item->color_obj, item->color->r, item->color->g,
+                         item->color->b, item->color->a);
+   wd->items = eina_list_append(wd->items, item);
+   _sizing_eval(obj);
+   return (Elm_Object_Item *) item;
 }
 
 EAPI void
 elm_colorselector_palette_clear(Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
-   //TODO: Implement!
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   _colors_remove(obj);
 }
 
 EAPI void
-elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name __UNUSED__)
+elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
-   //TODO: Implement!
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (!strcmp(wd->palette_name, palette_name)) return;
+   if (palette_name)
+     {
+        _colors_remove(obj);
+        eina_stringshare_replace(&wd->palette_name, palette_name);
+        _colors_load_apply(obj);
+     }
 }
 
 EAPI const char*
 elm_colorselector_palette_name_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   //TODO: Implement!
-   return NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   return wd->palette_name;
 }
index 19707ec..b726222 100644 (file)
@@ -1,24 +1,56 @@
 /**
  * @defgroup Colorselector Colorselector
- *
- * @{
+ * @ingroup Elementary
  *
  * @image html img/widget/colorselector/preview-00.png
  * @image latex img/widget/colorselector/preview-00.eps
  *
- * @brief Widget for user to select a color.
+ * A ColorSelector is a color selection widget. It allows application to set a
+ * series of colors.It also allows to load/save colors from/to config with a
+ * unique identifier, by default, the colors are loaded/saved from/to config
+ * using "default" identifier.
+ * The colors can be picked by user from the color set by clicking on individual color
+ * item on the palette or by selecting it from selector.
  *
  * Signals that you can add callbacks for are:
- * "changed" - When the color value changes(event_info is NULL).
+ * - "changed" - When the color value changes on selector(event_info is NULL).
+ * - "color,item,selected" - When user clicks on color item. The event_info parameter
+ * of the callback will be the selected color item.
+ * - "color,item,longpressed" - When user long presses on color item. The event info
+ * parameter of the callback contains selected color item.
  *
  * See @ref tutorial_colorselector.
+ * @{
  */
 
+typedef struct _Elm_Color_RGBA
+{
+   unsigned int r;
+   unsigned int g;
+   unsigned int b;
+   unsigned int a;
+} Elm_Color_RGBA;
+
+typedef struct _Elm_Custom_Palette
+{
+   const char *palette_name;
+   Eina_List  *color_list;
+} Elm_Custom_Palette;
+
+/**
+ * @enum _Elm_Colorselector_Mode
+ * @typedef Elm_Colorselector_Mode
+ *
+ * Different modes supported by Colorselector
+ *
+ * @see elm_colorselector_mode_set()
+ * @see elm_colorselector_mode_get()
+ */
 typedef enum
 {
-   ELM_COLORSELECTOR_PALETTE = 0,
-   ELM_COLORSELECTOR_COMPONENTS,
-   ELM_COLORSELECTOR_BOTH
+   ELM_COLORSELECTOR_PALETTE = 0, /**< only color palette is displayed */
+   ELM_COLORSELECTOR_COMPONENTS, /**< only color selector is displayed */
+   ELM_COLORSELECTOR_BOTH /**< Both Palette and selector is displayed, default */
 } Elm_Colorselector_Mode;
 
 /**
@@ -32,60 +64,55 @@ typedef enum
 EAPI Evas_Object *elm_colorselector_add(Evas_Object *parent);
 
 /**
- * Set a color for the colorselector
+ * Set color to colorselector
  *
- * @param obj   Colorselector object
- * @param r     r-value of color
- * @param g     g-value of color
- * @param b     b-value of color
- * @param a     a-value of color
+ * @param obj Colorselector object
+ * @param r r-value of color
+ * @param g g-value of color
+ * @param b b-value of color
+ * @param a a-value of color
  *
  * @ingroup Colorselector
  */
 EAPI void elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a);
 
 /**
- * Get a color from the colorselector
+ * Get current color from colorselector
  *
- * @param obj   Colorselector object
- * @param r     integer pointer for r-value of color
- * @param g     integer pointer for g-value of color
- * @param b     integer pointer for b-value of color
- * @param a     integer pointer for a-value of color
+ * @param obj Colorselector object
+ * @param r integer pointer for r-value of color
+ * @param g integer pointer for g-value of color
+ * @param b integer pointer for b-value of color
+ * @param a integer pointer for a-value of color
  *
  * @ingroup Colorselector
  */
 EAPI void elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a);
 
 /**
- * Set a Colorselector mode.
- * Colorselector 
+ * Set Colorselector's mode.
  *
  * @param obj Colorselector object
- * @param mode 
- * @param g G color value to be returned
- * @param b B color value to be returned
- * @param a A color value to be returned
+ * @param mode Elm_Colorselector_Mode
  * 
+ * Colorselector supports three modes palette only, selector only and both.
+ *
  * @ingroup Colorselector
  */
 EAPI void elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode);
 
 /**
- * Get a Colorselector mode.
+ * Get Colorselector's mode.
  *
- * @param item The color palette item.
- * @param r R color value to be returned
- * @param g G color value to be returned
- * @param b B color value to be returned
- * @param a A color value to be returned
+ * @param obj Colorselector object
+ * @return mode The current mode of colorselector
  * 
  * @ingroup Colorselector
  */
 EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj);
 
 /**
- * Get a palette item's color.
+ * Get Palette item's color.
  *
  * @param item The color palette item.
  * @param r integer pointer for r-value of color
@@ -98,7 +125,7 @@ EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj);
 EAPI void elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r, int *g, int *b, int *a);
 
 /**
- * Set the palette item's color.
+ * Set palette item's color.
  *
  * @param item The color palette item.
  * @param r r-value of color
@@ -129,9 +156,6 @@ EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int
  *
  * @param obj The Colorselector object
  *
- * @note This API will be available when ELM_COLORSELECTOR_PALETTE or
- * ELM_COLORSELECTOR_BOTH mode is set.
- *
  * @ingroup Colorselector
  */
 EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
@@ -148,7 +172,7 @@ EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
  *
  * @ingroup Colorselector
  */
-EAPI void                    elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name);
+EAPI void elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name);
 
 /**
  * Get current palette's name
@@ -161,7 +185,7 @@ EAPI void                    elm_colorselector_palette_name_set(Evas_Object *obj
  *
  * @ingroup Colorselector
  */
-EAPI const char             *elm_colorselector_palette_name_get(const Evas_Object *obj);
+EAPI const char *elm_colorselector_palette_name_get(const Evas_Object *obj);
 
 /**
  * @}
index b72cab0..b5895aa 100644 (file)
@@ -15,6 +15,8 @@ Elm_Config *_elm_config = NULL;
 char *_elm_profile = NULL;
 static Eet_Data_Descriptor *_config_edd = NULL;
 static Eet_Data_Descriptor *_config_font_overlay_edd = NULL;
+static Eet_Data_Descriptor *_config_color_edd = NULL;
+static Eet_Data_Descriptor *_config_color_palette_edd = NULL;
 const char *_elm_preferred_engine = NULL;
 
 static Ecore_Poller *_elm_cache_flush_poller = NULL;
@@ -259,6 +261,33 @@ _desc_init(void)
         eet_data_descriptor_free(_config_edd);
         return;
      }
+
+   memset(&eddc, 0, sizeof(eddc)); /* just in case... */
+   EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Color_RGBA);
+   eddc.func.str_direct_alloc = NULL;
+   eddc.func.str_direct_free = NULL;
+
+   _config_color_edd = eet_data_descriptor_stream_new(&eddc);
+   if (!_config_color_edd)
+     {
+        printf("EEEK! eet_data_descriptor_stream_new() failed\n");
+        eet_data_descriptor_free(_config_edd);
+        return;
+     }
+
+   memset(&eddc, 0, sizeof(eddc)); /* just in case... */
+   EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Custom_Palette);
+   eddc.func.str_direct_alloc = NULL;
+   eddc.func.str_direct_free = NULL;
+
+   _config_color_palette_edd = eet_data_descriptor_stream_new(&eddc);
+   if (!_config_color_palette_edd)
+     {
+        printf("EEEK! eet_data_descriptor_stream_new() failed\n");
+        eet_data_descriptor_free(_config_edd);
+        return;
+     }
+
 #define T_INT    EET_T_INT
 #define T_DOUBLE EET_T_DOUBLE
 #define T_STRING EET_T_STRING
@@ -272,6 +301,22 @@ _desc_init(void)
 #undef T
 #undef D
 
+#define T Elm_Color_RGBA
+#define D _config_color_edd
+   ELM_CONFIG_VAL(D, T, r, EET_T_UINT);
+   ELM_CONFIG_VAL(D, T, g, EET_T_UINT);
+   ELM_CONFIG_VAL(D, T, b, EET_T_UINT);
+   ELM_CONFIG_VAL(D, T, a, EET_T_UINT);
+#undef T
+#undef D
+
+#define T Elm_Custom_Palette
+#define D _config_color_palette_edd
+   ELM_CONFIG_VAL(D, T, palette_name, EET_T_STRING);
+   ELM_CONFIG_LIST(D, T, color_list, _config_color_edd);
+#undef T
+#undef D
+
 #define T Elm_Config
 #define D _config_edd
    ELM_CONFIG_VAL(D, T, config_version, T_INT);
@@ -338,6 +383,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, week_start, T_INT);
    ELM_CONFIG_VAL(D, T, weekend_start, T_INT);
    ELM_CONFIG_VAL(D, T, weekend_len, T_INT);
+   ELM_CONFIG_LIST(D, T, color_palette, _config_color_palette_edd);
 #undef T
 #undef D
 #undef T_INT
@@ -360,6 +406,18 @@ _desc_shutdown(void)
         eet_data_descriptor_free(_config_font_overlay_edd);
         _config_font_overlay_edd = NULL;
      }
+
+   if (_config_color_edd)
+     {
+        eet_data_descriptor_free(_config_color_edd);
+        _config_color_edd = NULL;
+     }
+
+   if (_config_color_palette_edd)
+     {
+        eet_data_descriptor_free(_config_color_palette_edd);
+        _config_color_palette_edd = NULL;
+     }
 }
 
 static int
@@ -562,6 +620,63 @@ _elm_config_text_classes_free(Eina_List *l)
 }
 
 Eina_List *
+_elm_config_color_list_get(const char *palette_name)
+{
+    Eina_List *plist;
+    Elm_Custom_Palette *cpalette;
+    EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette)
+      {
+         if (strcmp(cpalette->palette_name, palette_name))
+           continue;
+         return cpalette->color_list;
+      }
+    return NULL;
+}
+
+void
+_elm_config_color_set(const char *palette_name,
+                      int r,
+                      int g,
+                      int b,
+                      int a)
+{
+   Eina_List *plist;
+   Elm_Custom_Palette *cpalette;
+   Elm_Color_RGBA *color;
+   EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette)
+     {
+        if (strcmp(cpalette->palette_name, palette_name))
+          continue;
+
+        color = calloc(1, sizeof(Elm_Color_RGBA));
+        color->r = r;
+        color->g = g;
+        color->b = b;
+        color->a = a;
+        cpalette->color_list = eina_list_prepend(cpalette->color_list,
+                                                       color);
+     }
+}
+
+void
+_elm_config_colors_free(const char *palette_name)
+{
+   Eina_List *plist;
+   Elm_Custom_Palette *cpalette;
+   Elm_Color_RGBA *color;
+   EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette)
+     {
+        if (strcmp(cpalette->palette_name, palette_name))
+          continue;
+
+        EINA_LIST_FREE(cpalette->color_list, color)
+          {
+             free(color);
+          }
+     }
+}
+
+Eina_List *
 _elm_config_profiles_list(void)
 {
    Eina_File_Direct_Info *info;
@@ -716,6 +831,8 @@ _config_free(void)
 {
    Elm_Font_Overlay *fo;
    const char *fontdir;
+   Elm_Custom_Palette *palette;
+   Elm_Color_RGBA *color;
 
    if (!_elm_config) return;
    EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
@@ -729,6 +846,12 @@ _config_free(void)
         if (fo->font) eina_stringshare_del(fo->font);
         free(fo);
      }
+   EINA_LIST_FREE(_elm_config->color_palette, palette)
+     {
+        if (palette->palette_name) eina_stringshare_del(palette->palette_name);
+        EINA_LIST_FREE(palette->color_list, color) free(color);
+        free(palette);
+     }
    if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
    if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
    free(_elm_config);
@@ -920,6 +1043,7 @@ _config_load(void)
    _elm_config->week_start = 1; /* monday */
    _elm_config->weekend_start = 6; /* saturday */
    _elm_config->weekend_len = 2;
+   _elm_config->color_palette = NULL;
 }
 
 static const char *
index b91299d..f4ec723 100644 (file)
@@ -169,6 +169,7 @@ struct _Elm_Config
    int           week_start;
    int           weekend_start;
    int           weekend_len;
+   Eina_List    *color_palette;
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;
@@ -278,6 +279,10 @@ char                *_elm_util_text_to_mkup(const char *text);
 
 Eina_Bool            _elm_video_check(Evas_Object *video);
 
+Eina_List           *_elm_config_color_list_get(const char *palette_name);
+void                 _elm_config_color_set(const char *palette_name, int r, int g, int b, int a);
+void                 _elm_config_colors_free(const char *palette_name);
+
 extern char *_elm_appname;
 extern Elm_Config *_elm_config;
 extern const char *_elm_data_dir;