Added a new theme for elm_button, it is used in the contact details.
authorIscaro <iscaro@profusion.mobi>
Wed, 8 Aug 2012 17:02:33 +0000 (14:02 -0300)
committerIscaro <iscaro@profusion.mobi>
Fri, 10 Aug 2012 20:34:20 +0000 (17:34 -0300)
Makefile.am
data/themes/default.edc
data/themes/includes/button.edc [new file with mode: 0644]
dialer/contacts.c

index 27718a1..ab0292e 100644 (file)
@@ -95,6 +95,7 @@ data/themes/images/bt_swap_pressed.png \
 data/themes/images/bt_swap_released.png
 
 THEME_INCLUDES = \
+data/themes/includes/button.edc \
 data/themes/includes/call.edc \
 data/themes/includes/colors.edc \
 data/themes/includes/contacts-bg.edc \
index 51fc741..9646c78 100644 (file)
@@ -10,5 +10,6 @@ collections {
 #include "includes/history.edc"
 #include "includes/history-bg.edc"
 #include "includes/scroller.edc"
+#include "includes/button.edc"
 
 }
diff --git a/data/themes/includes/button.edc b/data/themes/includes/button.edc
new file mode 100644 (file)
index 0000000..ea9fe30
--- /dev/null
@@ -0,0 +1,109 @@
+group {
+   name: "elm/button/base/contacts-btn";
+
+   parts {
+      part {
+         name: "bg";
+         type: RECT;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 0;
+            color_class: "action";
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 255;
+         }
+      }
+
+      part {
+         name: "elm.text.phone";
+         type: TEXT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "action";
+            rel2 {
+               relative: 1.0 0.5;
+            }
+            text {
+               font: FONT_NORMAL;
+               size: SIZE_MEDIUM;
+               size_range: SIZE_TINY SIZE_HUGE;
+               fit: 1 1;
+               align: 0.5 0.5;
+               ellipsis: 1.0;
+            }
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color: 16 16 16 255;
+         }
+      }
+
+      part {
+         name: "elm.text.type";
+         type: TEXT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 128;
+            color_class: "action";
+            rel1 {
+               to: "elm.text.phone";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               offset: 0 0;
+            }
+            text {
+               font: FONT_NORMAL;
+               size: SIZE_MEDIUM;
+               size_range: SIZE_TINY SIZE_HUGE;
+               fit: 1 1;
+               align: 0.5 0.5;
+               ellipsis: 0.0;
+            }
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color: 16 16 16 255;
+         }
+      }
+   }
+
+   programs {
+
+      program {
+         signal: "mouse,clicked,1";
+         source: "bg";
+         action: SIGNAL_EMIT "elm,action,click" "";
+      }
+
+      program {
+         signal: "mouse,down,1";
+         source: "bg";
+         transition: ACCELERATE 0.3;
+         action: STATE_SET "pressed" 0.0;
+         target: "bg";
+         target: "elm.text.phone";
+         target: "elm.text.type";
+      }
+
+      program {
+         signal: "mouse,up,1";
+         source: "bg";
+         transition: DECELERATE 0.3;
+         action: STATE_SET "default" 0.0;
+         target: "bg";
+         target: "elm.text.phone";
+         target: "elm.text.type";
+      }
+   }
+}
index 522f244..c77ad47 100644 (file)
@@ -162,7 +162,6 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__,
        Contacts *contacts = data;
        Elm_Object_Item *item = event_inf;
        Evas_Object *details, *btn;
-       char buf[1024];
        Contact_Info *c_info;
        char *phone;
 
@@ -176,10 +175,11 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__,
 
        btn = elm_button_add(details);
        EINA_SAFETY_ON_NULL_RETURN(btn);
+       elm_object_style_set(btn, "contacts-btn");
        phone = phone_format(c_info->mobile);
-       snprintf(buf, sizeof(buf), "Mobile: %s", phone);
+       elm_object_part_text_set(btn, "elm.text.type", "Mobile");
+       elm_object_part_text_set(btn, "elm.text.phone", phone);
        free(phone);
-       elm_object_part_text_set(btn, NULL, buf);
        evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
                                                EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -190,10 +190,11 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__,
 
        btn = elm_button_add(details);
        EINA_SAFETY_ON_NULL_RETURN(btn);
+       elm_object_style_set(btn, "contacts-btn");
        phone = phone_format(c_info->home);
-       snprintf(buf, sizeof(buf), "Home: %s", phone);
+       elm_object_part_text_set(btn, "elm.text.type", "Home");
+       elm_object_part_text_set(btn, "elm.text.phone", phone);
        free(phone);
-       elm_object_part_text_set(btn, NULL, buf);
        evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
                                                EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -204,10 +205,11 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__,
 
        btn = elm_button_add(details);
        EINA_SAFETY_ON_NULL_RETURN(btn);
+       elm_object_style_set(btn, "contacts-btn");
        phone = phone_format(c_info->work);
-       snprintf(buf, sizeof(buf), "Work: %s", phone);
+       elm_object_part_text_set(btn, "elm.text.type", "Work");
+       elm_object_part_text_set(btn, "elm.text.phone", phone);
        free(phone);
-       elm_object_part_text_set(btn, NULL, buf);
        evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
                                                EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);