adding elm_list style and customizing
authorHyoyoung Chang <hyoyoung.chang@samsung.com>
Thu, 7 Oct 2010 11:00:08 +0000 (20:00 +0900)
committerHyoyoung Chang <hyoyoung.chang@samsung.com>
Thu, 7 Oct 2010 11:00:08 +0000 (20:00 +0900)
CMakeLists.txt
data/images/00_list_bar_press_1x80.png [new file with mode: 0644]
data/themes/cbhmdrawer.edc
data/themes/extstyles.edc [new file with mode: 0644]
src/cbhm_main.c
src/cbhm_main.h
src/clipdrawer.c

index 4d3ce5d..f0b489c 100755 (executable)
@@ -32,6 +32,7 @@ ADD_CUSTOM_TARGET(cbhmdrawer.edj
                -id ${CMAKE_CURRENT_SOURCE_DIR}/data/images             
                ${CMAKE_SOURCE_DIR}/data/themes/cbhmdrawer.edc ${CMAKE_BINARY_DIR}/data/themes/cbhmdrawer.edj
                DEPENDS ${CMAKE_SOURCE_DIR}/data/themes/cbhmdrawer.edc
+               DEPENDS ${CMAKE_SOURCE_DIR}/data/themes/extstyles.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} cbhmdrawer.edj)
 
diff --git a/data/images/00_list_bar_press_1x80.png b/data/images/00_list_bar_press_1x80.png
new file mode 100644 (file)
index 0000000..1dc6e15
Binary files /dev/null and b/data/images/00_list_bar_press_1x80.png differ
index 5125398..d1fe60e 100644 (file)
@@ -3,6 +3,9 @@
 
 collections 
 {
+
+#include "extstyles.edc"
+
        group 
        {
                name: "cbhmdrawer";
@@ -140,8 +143,8 @@ collections
                                description
                                {
                                        state: "default" 0.0;
-                                       rel1 { relative: 0.0916666666 0.4626865672; to: "background"; }
-                                       rel2 { relative: 0.98125 1.0; to: "background"; }
+                                       rel1 { relative: 0.0856666666 0.4505; to: "background"; }
+                                       rel2 { relative: 0.98725 1.0; to: "background"; }
                                        image 
                                        {
                                                normal: "clipboard_panel_list_bg.png";
@@ -182,4 +185,199 @@ collections
                                }
                } //programs
        } // group
+
+/*
+#define BEAT_GENLIST_PART_BASE( param_item_height ) \
+         part { name: "base"; \
+            type: RECT; \
+            repeat_events: 1; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               min: 0 param_item_height; \
+               color: 246 245 237 255; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_BG_IMAGE \
+         part { name: "bg_image"; \
+            clip_to: "disclip"; \
+            mouse_events: 0; \
+            description { state: "default" 0.0; \
+               visible: 0; \
+               image.normal: "00_list_bar_press_1x80.png"; \
+            } \
+            description { state: "selected" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 1; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_BOTTOM_LINE \
+         part { name: "bottom_line"; \
+            type: RECT; \
+            clip_to: "disclip"; \
+            mouse_events: 0; \
+            description { state: "default" 0.0; \
+               min: 0 1; \
+               fixed: 0 1; \
+               visible: 1; \
+               color: 212 212 212 255; \
+               rel1 { \
+                  relative: 0.0 1.0; \
+                  offset: 0 -1; \
+               } \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_PADDING_LEFT( param_padding_size ) \
+         part { name: "elm.padding.left"; \
+            type: RECT; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               min: param_padding_size 0; \
+               fixed: 1 0; \
+               visible: 0; \
+               rel2.relative: 0.0 1.0; \
+               align: 0.0 0.0; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
+       part { name: "elm.padding.right"; \
+            type: RECT; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               min: param_padding_size 0; \
+               fixed: 1 0; \
+               visible: 0; \
+               rel1.relative: 1.0  0.0; \
+               align: 1.0 0.0; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_DISCLIP \
+        part { name: "disclip"; \
+            type: RECT; \
+            description { state: "default" 0.0; \
+            } \
+            description { state: "disabled" 0.0; \
+               inherit: "default" 0.0; \
+               color: 255 255 255 64; \
+            } \
+         }
+
+   group { name: "elm/genlist/item/default/extended/historylist";
+      alias: "elm/genlist/item_odd/default/extended/historylist";
+      alias: "elm/list/item/extended/historylist";
+      alias: "elm/list/item_odd/extended/historylist";
+      alias: "elm/list/item_compress/extended/historylist";
+      alias: "elm/list/item_compress_odd/extended/historylist";
+
+      data.item: "stacking" "above";
+      data.item: "selectraise" "on";
+      data.item: "labels" "elm.text";
+      data.item: "icons" "elm.swallow.icon elm.swallow.end";
+      images {
+         image: "00_list_bar_press_1x80.png" COMP;
+      }
+      parts {
+         BEAT_GENLIST_PART_BASE( 60 )
+         BEAT_GENLIST_PART_BG_IMAGE
+         BEAT_GENLIST_PART_BOTTOM_LINE
+         BEAT_GENLIST_PART_PADDING_LEFT( 15 )
+         BEAT_GENLIST_PART_PADDING_RIGHT( 15 )
+         part { name: "elm.swallow.end";
+            clip_to: "disclip";
+            type: SWALLOW;
+            scale: 1;
+            description { state: "default" 0.0;
+               fixed: 1 0;
+               align: 1.0 0.5;
+               rel1.to_x: "elm.padding.right";
+               rel2 {
+                  relative: 0.0  1.0;
+                  to_x: "elm.padding.right";
+               }
+            }
+         }
+         part { name: "elm.text";
+            clip_to: "disclip";
+            type: TEXT;
+            mouse_events: 0;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1 {
+                  relative: 1.0  0.0;
+                  offset: 0 0;
+                  to_x: "elm.swallow.icon";
+               }
+               rel2 {
+                  to_x: "elm.swallow.end";
+                  relative: 0.0  1.0;
+                  offset:   0   0;
+               }
+               color: 0 0 0 255;
+               text {
+                  font: "SLP:style=Roman";
+                  size: 32;
+                  min: 0 1;
+                  align: 0.0 0.5;
+               }
+            }
+            description { state: "selected" 0.0;
+               inherit: "default" 0.0;
+               color: 225 225 225 255;
+            }
+         }
+         part { name: "elm.swallow.icon";
+            clip_to: "disclip";
+            type: SWALLOW;
+            description { state: "default" 0.0;
+               fixed: 1 0;
+               align: 0.0 0.5;
+               rel1 {
+                  relative: 1.0 0.0;
+                  to_x: "elm.padding.left";
+               }
+               rel2.to_x: "elm.padding.left";
+            }
+         }
+         BEAT_GENLIST_PART_DISCLIP
+      } // parts
+      programs {
+         // signal: elm,state,%s,active
+         //   a "check" item named %s went active
+         // signal: elm,state,%s,passive
+         //   a "check" item named %s went passive
+         // default is passive
+         program { name: "go_active";
+            signal: "elm,state,selected";
+            source: "elm";
+            action: STATE_SET "selected" 0.0;
+            target: "bg_image";
+            target: "elm.text";
+         }
+         program { name: "go_passive";
+            signal: "elm,state,unselected";
+            source: "elm";
+            action: STATE_SET "default" 0.0;
+            target: "bg_image";
+            target: "elm.text";
+            transition: LINEAR 0.1;
+         }
+         program { name: "go_disabled";
+            signal: "elm,state,disabled";
+            source: "elm";
+            action: STATE_SET "disabled" 0.0;
+            target: "disclip";
+         }
+         program { name: "go_enabled";
+            signal: "elm,state,enabled";
+            source: "elm";
+            action: STATE_SET "default" 0.0;
+            target: "disclip";
+         }
+      } // programs
+   } // group
+*/
 } // collections
diff --git a/data/themes/extstyles.edc b/data/themes/extstyles.edc
new file mode 100644 (file)
index 0000000..19fa2c5
--- /dev/null
@@ -0,0 +1,192 @@
+#define BEAT_GENLIST_PART_BASE( param_item_height ) \
+         part { name: "base"; \
+            type: RECT; \
+            repeat_events: 1; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               min: 0 param_item_height; \
+               color: 246 245 237 255; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_BG_IMAGE \
+         part { name: "bg_image"; \
+            clip_to: "disclip"; \
+            mouse_events: 0; \
+            description { state: "default" 0.0; \
+               visible: 0; \
+               image.normal: "00_list_bar_press_1x80.png"; \
+            } \
+            description { state: "selected" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 1; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_BOTTOM_LINE \
+         part { name: "bottom_line"; \
+            type: RECT; \
+            clip_to: "disclip"; \
+            mouse_events: 0; \
+            description { state: "default" 0.0; \
+               min: 0 1; \
+               fixed: 0 1; \
+               visible: 1; \
+               color: 212 212 212 255; \
+               rel1 { \
+                  relative: 0.0 1.0; \
+                  offset: 0 -1; \
+               } \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_PADDING_LEFT( param_padding_size ) \
+         part { name: "elm.padding.left"; \
+            type: RECT; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               min: param_padding_size 0; \
+               fixed: 1 0; \
+               visible: 0; \
+               rel2.relative: 0.0 1.0; \
+               align: 0.0 0.0; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
+       part { name: "elm.padding.right"; \
+            type: RECT; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               min: param_padding_size 0; \
+               fixed: 1 0; \
+               visible: 0; \
+               rel1.relative: 1.0  0.0; \
+               align: 1.0 0.0; \
+            } \
+         }
+
+#define BEAT_GENLIST_PART_DISCLIP \
+        part { name: "disclip"; \
+            type: RECT; \
+            description { state: "default" 0.0; \
+            } \
+            description { state: "disabled" 0.0; \
+               inherit: "default" 0.0; \
+               color: 255 255 255 64; \
+            } \
+         }
+
+   group { name: "elm/genlist/item/default/extended/historylist";
+      alias: "elm/genlist/item_odd/default/extended/historylist";
+      alias: "elm/list/item/extended/historylist";
+      alias: "elm/list/item_odd/extended/historylist";
+      alias: "elm/list/item_compress/extended/historylist";
+      alias: "elm/list/item_compress_odd/extended/historylist";
+
+      data.item: "stacking" "above";
+      data.item: "selectraise" "on";
+      data.item: "labels" "elm.text";
+      data.item: "icons" "elm.swallow.icon elm.swallow.end";
+      images {
+         image: "00_list_bar_press_1x80.png" COMP;
+      }
+      parts {
+         BEAT_GENLIST_PART_BASE(60)
+         BEAT_GENLIST_PART_BG_IMAGE
+         BEAT_GENLIST_PART_BOTTOM_LINE
+         BEAT_GENLIST_PART_PADDING_LEFT(15)
+         BEAT_GENLIST_PART_PADDING_RIGHT(15)
+         part { name: "elm.swallow.end";
+            clip_to: "disclip";
+            type: SWALLOW;
+            scale: 1;
+            description { state: "default" 0.0;
+               fixed: 1 0;
+               align: 1.0 0.5;
+               rel1.to_x: "elm.padding.right";
+               rel2 {
+                  relative: 0.0  1.0;
+                  to_x: "elm.padding.right";
+               }
+            }
+         }
+         part { name: "elm.text";
+            clip_to: "disclip";
+            type: TEXT;
+            mouse_events: 0;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1 {
+                  relative: 1.0  0.0;
+                  offset: 0 0;
+                  to_x: "elm.swallow.icon";
+               }
+               rel2 {
+                  to_x: "elm.swallow.end";
+                  relative: 0.0  1.0;
+                  offset:   0   0;
+               }
+               color: 0 0 0 255;
+               text {
+                  font: "SLP:style=Roman";
+                  size: 32;
+                  min: 0 1;
+                  align: 0.0 0.5;
+               }
+            }
+            description { state: "selected" 0.0;
+               inherit: "default" 0.0;
+               color: 225 225 225 255;
+            }
+         }
+         part { name: "elm.swallow.icon";
+            clip_to: "disclip";
+            type: SWALLOW;
+            description { state: "default" 0.0;
+               fixed: 1 0;
+               align: 0.0 0.5;
+               rel1 {
+                  relative: 1.0 0.0;
+                  to_x: "elm.padding.left";
+               }
+               rel2.to_x: "elm.padding.left";
+            }
+         }
+         BEAT_GENLIST_PART_DISCLIP
+      } // parts
+      programs {
+         // signal: elm,state,%s,active
+         //   a "check" item named %s went active
+         // signal: elm,state,%s,passive
+         //   a "check" item named %s went passive
+         // default is passive
+         program { name: "go_active";
+            signal: "elm,state,selected";
+            source: "elm";
+            action: STATE_SET "selected" 0.0;
+            target: "bg_image";
+            target: "elm.text";
+         }
+         program { name: "go_passive";
+            signal: "elm,state,unselected";
+            source: "elm";
+            action: STATE_SET "default" 0.0;
+            target: "bg_image";
+            target: "elm.text";
+            transition: LINEAR 0.1;
+         }
+         program { name: "go_disabled";
+            signal: "elm,state,disabled";
+            source: "elm";
+            action: STATE_SET "disabled" 0.0;
+            target: "disclip";
+         }
+         program { name: "go_enabled";
+            signal: "elm,state,enabled";
+            source: "elm";
+            action: STATE_SET "default" 0.0;
+            target: "disclip";
+         }
+      } // programs
+   } // group
index 3f1bf41..8b8e193 100644 (file)
@@ -45,7 +45,7 @@ int init_appview(void *data)
        ad->evas = evas_object_evas_get(win);
        ad->win_main = win;
 
-       ly = load_edj(win, EDJ_FILE, GRP_MAIN);
+       ly = load_edj(win, APP_EDJ_FILE, GRP_MAIN);
        if (ly == NULL)
                return -1; 
        elm_win_resize_object_add(win, ly);
index e1de458..0cc5bc3 100755 (executable)
@@ -7,7 +7,8 @@
 #define LOCALEDIR "/usr/share/locale"
 
 #define EDJ_PATH "/usr/share/edje"
-#define EDJ_FILE "/usr/share/edje/cbhmdrawer.edj"
+#define APP_EDJ_FILE EDJ_PATH"/cbhmdrawer.edj"
+//#define EXTSTYLE_EDJ_FILE EDJ_PATH"/extstyles.edj"
 #define GRP_MAIN "cbhmdrawer"
 
 struct appdata
index 4466d19..82307d3 100644 (file)
@@ -219,7 +219,9 @@ int clipdrawer_init(void *data)
 
        ad->txtlist = elm_list_add(ad->win_main);
        elm_layout_content_set(ad->ly_main, "texthistory/list", ad->txtlist);
-       elm_list_horizontal_mode_set(ad->txtlist, ELM_LIST_COMPRESS);
+       elm_theme_extension_add(NULL, APP_EDJ_FILE);
+       elm_object_style_set(ad->txtlist, "extended/historylist");
+       evas_object_size_hint_weight_set(ad->txtlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_smart_callback_add(ad->txtlist, "selected", _list_click, ad);
        elm_list_item_append(ad->txtlist, "default", NULL, NULL, NULL, ad);