new popup that fits better our theme.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 19 Aug 2012 15:15:22 +0000 (12:15 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 19 Aug 2012 15:15:22 +0000 (12:15 -0300)
the new popup can have 2 buttons, with different classes (dialer or
dialer-caution).

While there is no content, it will show a loading animation.

20 files changed:
Makefile.am
data/themes/default-hd.edc
data/themes/default-sd.edc
data/themes/default.edc
data/themes/images/loading_0.png [new file with mode: 0644]
data/themes/images/loading_1.png [new file with mode: 0644]
data/themes/images/loading_2.png [new file with mode: 0644]
data/themes/images/loading_3.png [new file with mode: 0644]
data/themes/images/loading_4.png [new file with mode: 0644]
data/themes/images/loading_5.png [new file with mode: 0644]
data/themes/images/loading_6.png [new file with mode: 0644]
data/themes/images/loading_7.png [new file with mode: 0644]
data/themes/includes/buttons.edc [new file with mode: 0644]
data/themes/includes/colors.edc
data/themes/includes/popup.edc [new file with mode: 0644]
data/themes/includes/scroller.edc
dialer/callscreen.c
dialer/gui.c
dialer/gui.h
dialer/history.c

index 5dbf91b..6c41e32 100644 (file)
@@ -80,9 +80,18 @@ data/themes/images/ico_mute.png \
 data/themes/images/ico_person.png \
 data/themes/images/ico_speaker.png \
 data/themes/images/ico_swap.png \
-data/themes/images/ico_voicemail.png
+data/themes/images/ico_voicemail.png \
+data/themes/images/loading_0.png \
+data/themes/images/loading_1.png \
+data/themes/images/loading_2.png \
+data/themes/images/loading_3.png \
+data/themes/images/loading_4.png \
+data/themes/images/loading_5.png \
+data/themes/images/loading_6.png \
+data/themes/images/loading_7.png
 
 THEME_INCLUDES = \
+data/themes/includes/buttons.edc \
 data/themes/includes/call.edc \
 data/themes/includes/colors.edc \
 data/themes/includes/contacts-bg.edc \
@@ -92,6 +101,7 @@ data/themes/includes/history.edc \
 data/themes/includes/keypad.edc \
 data/themes/includes/main.edc \
 data/themes/includes/multiparty-list.edc \
+data/themes/includes/popup.edc \
 data/themes/includes/scroller.edc
 
 
index e5ece60..e997519 100644 (file)
@@ -29,4 +29,6 @@
 
 #define GROUP_HEIGHT 30
 
+#define LOADING_SIZE 128
+
 #include "default.edc"
index 88cdebf..1f4cb9b 100644 (file)
@@ -29,4 +29,6 @@
 
 #define GROUP_HEIGHT 20
 
+#define LOADING_SIZE 64
+
 #include "default.edc"
index 51fc741..37e05de 100644 (file)
@@ -10,5 +10,7 @@ collections {
 #include "includes/history.edc"
 #include "includes/history-bg.edc"
 #include "includes/scroller.edc"
+#include "includes/popup.edc"
+#include "includes/buttons.edc"
 
 }
diff --git a/data/themes/images/loading_0.png b/data/themes/images/loading_0.png
new file mode 100644 (file)
index 0000000..ef4ffcc
Binary files /dev/null and b/data/themes/images/loading_0.png differ
diff --git a/data/themes/images/loading_1.png b/data/themes/images/loading_1.png
new file mode 100644 (file)
index 0000000..d994cec
Binary files /dev/null and b/data/themes/images/loading_1.png differ
diff --git a/data/themes/images/loading_2.png b/data/themes/images/loading_2.png
new file mode 100644 (file)
index 0000000..c7db609
Binary files /dev/null and b/data/themes/images/loading_2.png differ
diff --git a/data/themes/images/loading_3.png b/data/themes/images/loading_3.png
new file mode 100644 (file)
index 0000000..17a8110
Binary files /dev/null and b/data/themes/images/loading_3.png differ
diff --git a/data/themes/images/loading_4.png b/data/themes/images/loading_4.png
new file mode 100644 (file)
index 0000000..32f6eb5
Binary files /dev/null and b/data/themes/images/loading_4.png differ
diff --git a/data/themes/images/loading_5.png b/data/themes/images/loading_5.png
new file mode 100644 (file)
index 0000000..802472b
Binary files /dev/null and b/data/themes/images/loading_5.png differ
diff --git a/data/themes/images/loading_6.png b/data/themes/images/loading_6.png
new file mode 100644 (file)
index 0000000..c207ac7
Binary files /dev/null and b/data/themes/images/loading_6.png differ
diff --git a/data/themes/images/loading_7.png b/data/themes/images/loading_7.png
new file mode 100644 (file)
index 0000000..7f9686e
Binary files /dev/null and b/data/themes/images/loading_7.png differ
diff --git a/data/themes/includes/buttons.edc b/data/themes/includes/buttons.edc
new file mode 100644 (file)
index 0000000..3fe7b73
--- /dev/null
@@ -0,0 +1,261 @@
+group {
+   name: "elm/button/base/dialer";
+
+   parts {
+      part {
+         name: "area";
+         type: RECT;
+         scale: 1;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 0 0 0 0;
+            min: 0 (ACTION_HEIGHT + SEPARATOR_HEIGHT);
+         }
+      }
+
+      part {
+         name: "bg";
+         type: RECT;
+         scale: 1;
+         mouse_events: 1;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 0;
+            color_class: "action";
+            min: 0 ACTION_HEIGHT;
+            rel1.offset: 0 SEPARATOR_HEIGHT;
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 255;
+         }
+      }
+
+      part {
+         name: "elm.text";
+         type: TEXT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "action";
+           rel1.offset: BORDER_PADDING SEPARATOR_HEIGHT;
+            text {
+               font: FONT_NORMAL;
+               size: SIZE_LARGE;
+               align: 0.5 0.5;
+               ellipsis: 0.0;
+            }
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color_class: "bg";
+         }
+      }
+
+#define SEPARATOR(id, rely, offy, relto)                                \
+      part {                                                            \
+         name: "separator.dark."##id;                                   \
+         type: RECT;                                                    \
+         mouse_events: 0;                                               \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "dark";                                        \
+            rel1 {                                                      \
+               relative: 0.0 rely;                                      \
+               offset: 0 offy;                                          \
+               to_y: relto;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               relative: 1.0 rely;                                      \
+               offset: -1 (offy + SEPARATOR_HEIGHT / 2);                \
+               to_y: relto;                                             \
+            }                                                           \
+         }                                                              \
+      }                                                                 \
+      part {                                                            \
+         name: "separator.bg."##id;                                     \
+         type: RECT;                                                    \
+         mouse_events: 0;                                               \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "bg";                                          \
+            rel1 {                                                      \
+               relative: 0.0 rely;                                      \
+               offset: 0 (offy + SEPARATOR_HEIGHT / 2);                 \
+               to_y: relto;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               relative: 1.0 rely;                                      \
+               offset: -1 (offy + SEPARATOR_HEIGHT);                    \
+               to_y: relto;                                             \
+            }                                                           \
+         }                                                              \
+      }
+
+      SEPARATOR("separator", 0.0, 0, "");
+#undef SEPARATOR
+   }
+
+   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";
+      }
+
+      program {
+         signal: "mouse,up,1";
+         source: "bg";
+         transition: DECELERATE 0.3;
+         action: STATE_SET "default" 0.0;
+         target: "bg";
+         target: "elm.text";
+      }
+   }
+}
+
+group {
+   name: "elm/button/base/dialer-caution";
+
+   parts {
+      part {
+         name: "area";
+         type: RECT;
+         scale: 1;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 0 0 0 0;
+            min: 0 (ACTION_HEIGHT + SEPARATOR_HEIGHT);
+         }
+      }
+
+      part {
+         name: "bg";
+         type: RECT;
+         scale: 1;
+         mouse_events: 1;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 0;
+            color_class: "caution";
+            min: 0 ACTION_HEIGHT;
+            rel1.offset: 0 SEPARATOR_HEIGHT;
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 255;
+         }
+      }
+
+      part {
+         name: "elm.text";
+         type: TEXT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "caution";
+           rel1.offset: BORDER_PADDING SEPARATOR_HEIGHT;
+            text {
+               font: FONT_NORMAL;
+               size: SIZE_LARGE;
+               align: 0.5 0.5;
+               ellipsis: 0.0;
+            }
+         }
+         description {
+            state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            color_class: "bg";
+         }
+      }
+
+#define SEPARATOR(id, rely, offy, relto)                                \
+      part {                                                            \
+         name: "separator.dark."##id;                                   \
+         type: RECT;                                                    \
+         mouse_events: 0;                                               \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "dark";                                        \
+            rel1 {                                                      \
+               relative: 0.0 rely;                                      \
+               offset: 0 offy;                                          \
+               to_y: relto;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               relative: 1.0 rely;                                      \
+               offset: -1 (offy + SEPARATOR_HEIGHT / 2);                \
+               to_y: relto;                                             \
+            }                                                           \
+         }                                                              \
+      }                                                                 \
+      part {                                                            \
+         name: "separator.bg."##id;                                     \
+         type: RECT;                                                    \
+         mouse_events: 0;                                               \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "bg";                                          \
+            rel1 {                                                      \
+               relative: 0.0 rely;                                      \
+               offset: 0 (offy + SEPARATOR_HEIGHT / 2);                 \
+               to_y: relto;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               relative: 1.0 rely;                                      \
+               offset: -1 (offy + SEPARATOR_HEIGHT);                    \
+               to_y: relto;                                             \
+            }                                                           \
+         }                                                              \
+      }
+
+      SEPARATOR("separator", 0.0, 0, "");
+#undef SEPARATOR
+   }
+
+   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";
+      }
+
+      program {
+         signal: "mouse,up,1";
+         source: "bg";
+         transition: DECELERATE 0.3;
+         action: STATE_SET "default" 0.0;
+         target: "bg";
+         target: "elm.text";
+      }
+   }
+}
index 71e84c9..cdb4bf4 100644 (file)
@@ -13,16 +13,19 @@ color_classes {
       name: "light";
       color: 55 88 84 255;
    }
+#define TEXTBLOCK_COLOR_LIGHT "#375854"
 
    color_class {
       name: "action";
       color: 123 184 155 255;
    }
+#define TEXTBLOCK_COLOR_ACTION "#7bb89b"
 
    color_class {
       name: "caution";
       color: 193 39 44 255;
    }
+#define TEXTBLOCK_COLOR_CAUTION "#c1272c"
 
    color_class {
       name: "disabled";
diff --git a/data/themes/includes/popup.edc b/data/themes/includes/popup.edc
new file mode 100644 (file)
index 0000000..9d0a5e8
--- /dev/null
@@ -0,0 +1,433 @@
+group {
+   name: "elm/layout/dialer/popup";
+
+   images {
+      image: "loading_0.png" COMP;
+      image: "loading_1.png" COMP;
+      image: "loading_2.png" COMP;
+      image: "loading_3.png" COMP;
+      image: "loading_4.png" COMP;
+      image: "loading_5.png" COMP;
+      image: "loading_6.png" COMP;
+      image: "loading_7.png" COMP;
+   }
+
+   parts {
+      part {
+         name: "bg";
+         type: RECT;
+         mouse_events: 1; /* do not let events fall through */
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 200;
+            color_class: "bg";
+         }
+         description {
+            state: "content" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 230;
+         }
+      }
+
+#define SEPARATOR(id, clip, rely, offy, relto)                          \
+      part {                                                            \
+         name: "separator.dark."##id;                                   \
+         type: RECT;                                                    \
+         mouse_events: 0;                                               \
+         clip_to: clip;                                                 \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "dark";                                        \
+            rel1 {                                                      \
+               relative: 0.0 rely;                                      \
+               offset: 0 offy;                                          \
+               to_y: relto;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               relative: 1.0 rely;                                      \
+               offset: -1 (offy + SEPARATOR_HEIGHT / 2);                \
+               to_y: relto;                                             \
+            }                                                           \
+         }                                                              \
+      }                                                                 \
+      part {                                                            \
+         name: "separator.bg."##id;                                     \
+         type: RECT;                                                    \
+         mouse_events: 0;                                               \
+         clip_to: clip;                                                 \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "bg";                                          \
+            rel1 {                                                      \
+               relative: 0.0 rely;                                      \
+               offset: 0 (offy + SEPARATOR_HEIGHT / 2);                 \
+               to_y: relto;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               relative: 1.0 rely;                                      \
+               offset: -1 (offy + SEPARATOR_HEIGHT);                    \
+               to_y: relto;                                             \
+            }                                                           \
+         }                                                              \
+      }
+
+      part {
+         name: "clipper.title";
+         type: RECT;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 0;
+            visible: 0;
+         }
+         description {
+            state: "visible" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 255;
+            visible: 1;
+         }
+      }
+
+      part {
+         name: "elm.text.title";
+         type: TEXT;
+         mouse_events: 0;
+         clip_to: "clipper.title";
+         description {
+            state: "default" 0.0;
+            min: 0 (ACTION_HEIGHT / 2);
+            color_class: "action";
+            visible: 1;
+            rel1 {
+               relative: 0.0 0.0;
+               offset: 0 (-ACTION_HEIGHT / 2 - SEPARATOR_HEIGHT);
+            }
+            rel2 {
+               relative: 1.0 0.0;
+               offset: -1 (-SEPARATOR_HEIGHT - 1);
+            }
+            text {
+               font: FONT_NORMAL;
+               size: SIZE_MEDIUM;
+               ellipsis: 0.0;
+               text: "contents";
+            }
+         }
+         description {
+            state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+            rel1 {
+               relative: 0.0 0.0;
+               offset: 0 0;
+            }
+            rel2 {
+               relative: 1.0 0.0;
+               offset: -1 (ACTION_HEIGHT / 2 - 1);
+            }
+         }
+      }
+      SEPARATOR("title", "clipper.title", 1.0, 0, "elm.text.title");
+
+      programs {
+         program {
+            signal: "show,title";
+            source: "gui";
+            action: STATE_SET "visible" 0.0;
+            target: "clipper.title";
+            target: "elm.text.title";
+         }
+         program {
+            signal: "hide,title";
+            source: "gui";
+            action: STATE_SET "default" 0.0;
+            target: "clipper.title";
+            target: "elm.text.title";
+         }
+      }
+
+      part {
+         name: "loading";
+         type: IMAGE;
+         description {
+            state: "default" 0.0;
+            min: LOADING_SIZE LOADING_SIZE;
+            max: LOADING_SIZE LOADING_SIZE;
+            align: 0.5 0.5;
+            rel1.to: "elm.swallow.content";
+            rel2.to: "elm.swallow.content";
+            color_class: "action";
+            visible: 0;
+         }
+         description {
+            state: "visible" 0.0;
+            inherit: "default" 0.0;
+            image {
+               tween: "loading_0.png";
+               tween: "loading_1.png";
+               tween: "loading_2.png";
+               tween: "loading_3.png";
+               tween: "loading_4.png";
+               tween: "loading_5.png";
+               tween: "loading_6.png";
+               normal: "loading_7.png";
+               scale_hint: STATIC;
+            }
+            visible: 1;
+         }
+      }
+
+      part {
+         name: "elm.swallow.content";
+         type: SWALLOW;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               to_y: "elm.text.title";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to_y: "bg.buttons";
+               relative: 1.0 0.0;
+               offset: -1 0;
+            }
+         }
+      }
+
+      programs {
+         program {
+            signal: "show,content";
+            source: "gui";
+            action: STATE_SET "content" 0.0;
+            target: "bg";
+            after: "stop,loading";
+         }
+         program {
+            signal: "hide,content";
+            source: "gui";
+            action: STATE_SET "default" 0.0;
+            target: "bg";
+            after: "start,loading";
+         }
+
+         program {
+            name: "stop,loading";
+            action: ACTION_STOP;
+            target: "start,loading";
+            after: "hide,loading";
+         }
+         program {
+            name: "hide,loading";
+            action: STATE_SET "default" 0.0;
+            target: "loading";
+         }
+
+         program {
+            name: "start,loading";
+            action: STATE_SET "visible" 0.0;
+            transition: LINEAR 0.6666;
+            target: "loading";
+            after: "start,loading";
+         }
+
+         program {
+            signal: "load";
+            after: "start,loading";
+         }
+      }
+
+      /* note: this button 1/2 is ugly but simple */
+      part {
+         name: "bg.buttons";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "bg";
+            align: 0.5 1.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: 0 -1;
+            }
+         }
+         description {
+            state: "button1" 0.0;
+            inherit: "default" 0.0;
+            min: 0 (ACTION_HEIGHT + SEPARATOR_HEIGHT);
+         }
+         description {
+            state: "button2" 0.0;
+            inherit: "default" 0.0;
+            min: 0 (2 * ACTION_HEIGHT + 2 * SEPARATOR_HEIGHT);
+         }
+      }
+
+      part {
+         name: "elm.swallow.button1";
+         type: SWALLOW;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: 0 -1;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               offset: -1 -1;
+            }
+         }
+         description {
+            state: "button1" 0.0;
+            inherit: "default" 0.0;
+            min: 0 (ACTION_HEIGHT + SEPARATOR_HEIGHT);
+            visible: 1;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: 0 (-ACTION_HEIGHT - SEPARATOR_HEIGHT);
+            }
+         }
+         description {
+            state: "button2" 0.0;
+            inherit: "default" 0.0;
+            min: 0 (ACTION_HEIGHT + SEPARATOR_HEIGHT);
+            visible: 1;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: 0 (-2 * ACTION_HEIGHT - 2 * SEPARATOR_HEIGHT);
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               offset: -1 (-ACTION_HEIGHT - SEPARATOR_HEIGHT - 1);
+            }
+         }
+      }
+
+      part {
+         name: "elm.swallow.button2";
+         type: SWALLOW;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: 0 -1;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               offset: -1 -1;
+            }
+         }
+         description {
+            state: "button1" 0.0;
+            inherit: "default" 0.0;
+         }
+         description {
+            state: "button2" 0.0;
+            inherit: "default" 0.0;
+            min: 0 (ACTION_HEIGHT + SEPARATOR_HEIGHT);
+            visible: 1;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: 0 (-ACTION_HEIGHT - SEPARATOR_HEIGHT);
+            }
+         }
+      }
+
+      programs {
+         program {
+            signal: "buttons,0";
+            source: "gui";
+            action: STATE_SET "default" 0.0;
+            target: "bg.buttons";
+            target: "elm.swallow.button1";
+            target: "elm.swallow.button2";
+         }
+         program {
+            signal: "buttons,1";
+            source: "gui";
+            action: STATE_SET "button1" 0.0;
+            target: "bg.buttons";
+            target: "elm.swallow.button1";
+            target: "elm.swallow.button2";
+         }
+         program {
+            signal: "buttons,2";
+            source: "gui";
+            action: STATE_SET "button2" 0.0;
+            target: "bg.buttons";
+            target: "elm.swallow.button1";
+            target: "elm.swallow.button2";
+         }
+      }
+
+#undef SEPARATOR
+   }
+}
+
+group {
+   name: "elm/entry/base/dialer-popup";
+   alias: "elm/entry/base-noedit/dialer-popup";
+
+   styles {
+      style {
+         name: "entry_textblock_style";
+         base: "font="FONT_NORMAL" font_size="SIZE_MEDIUM" color="TEXTBLOCK_COLOR_ACTION" wrap=word valign=middle align=center";
+      }
+      style {
+         name: "entry_textblock_disabled_style";
+         base: "font="FONT_NORMAL" font_size="SIZE_MEDIUM" color="TEXTBLOCK_COLOR_ACTION" wrap=word valign=middle align=center";
+      }
+   }
+   parts {
+      part {
+         name: "elm.text";
+         type: TEXTBLOCK;
+         mouse_events: 1;
+         scale: 1;
+         multiline: 1;
+         description {
+            state: "default" 0.0;
+            text {
+               style: "entry_textblock_style";
+               min: 0 1;
+               max: 1 1;
+               align: 0.5 0.5;
+            }
+         }
+         description {
+            state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            text {
+               style: "entry_textblock_disabled_style";
+            }
+         }
+      }
+   }
+
+   programs {
+      program {
+         signal: "load";
+         source: "";
+         action: FOCUS_SET;
+         target: "elm.text";
+      }
+      program {
+         signal: "elm,state,disabled";
+         source: "elm";
+         action: STATE_SET "disabled" 0.0;
+         target: "elm.text";
+      }
+      program {
+         signal: "elm,state,enabled";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         target: "elm.text";
+      }
+   }
+}
index a9ccc7f..6792afc 100644 (file)
@@ -218,3 +218,224 @@ group {
       }
    }
 }
+
+group {
+   name: "elm/scroller/entry/dialer-popup";
+
+   script {
+      public sbvis_v, sbalways_v, sbvis_timer;
+      public timer0(val) {
+         new v;
+         v = get_int(sbvis_v);
+         if (v) {
+            v = get_int(sbalways_v);
+            if (!v) {
+               emit("do-hide-vbar", "");
+               set_int(sbvis_v, 0);
+            }
+         }
+         set_int(sbvis_timer, 0);
+         return 0;
+      }
+   }
+
+   parts {
+      part {
+         name: "clipper";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+         }
+      }
+
+      part {
+         name: "elm.swallow.content";
+         clip_to: "clipper";
+         type: SWALLOW;
+         description {
+            state: "default" 0.0;
+            rel1.offset: BORDER_PADDING 0;
+            rel2.offset: (-BORDER_PADDING - 1) -1;
+         }
+      }
+
+      part {
+         name: "sb_vbar_clip_master";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+         }
+         description {
+            state: "hidden" 0.0;
+            color: 255 255 255 0;
+            visible: 0;
+         }
+      }
+
+      part {
+         name: "sb_vbar_clip";
+         clip_to: "sb_vbar_clip_master";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+         }
+         description {
+            state: "hidden" 0.0;
+            color: 255 255 255 0;
+            visible: 0;
+         }
+      }
+
+      part {
+         name: "sb_vbar";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            min: SCROLLBAR_WIDTH SCROLLBAR_HEIGHT;
+            align: 1.0 0.0;
+            rel1 {
+               relative: 1.0 0.0;
+               offset: -1 0;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               offset: -1 -1;
+            }
+         }
+      }
+
+      part {
+         name: "elm.dragable.vbar";
+         type: RECT;
+         clip_to: "sb_vbar_clip";
+         mouse_events: 0;
+         dragable {
+            x: 0 0 0;
+            y: 1 1 0;
+            confine: "sb_vbar";
+         }
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "light";
+            fixed: 1 1;
+            min: SCROLLBAR_WIDTH SCROLLBAR_HEIGHT;
+            max: SCROLLBAR_WIDTH 99999;
+            rel1 {
+               relative: 0.5 0.5;
+               offset: 0 0;
+               to: "sb_vbar";
+            }
+            rel2 {
+               relative: 0.5 0.5;
+               offset: 0 0;
+               to: "sb_vbar";
+            }
+         }
+      }
+   }
+
+   programs {
+      program {
+         signal: "load";
+         source: "";
+         script {
+            set_state(PART:"sb_vbar_clip", "hidden", 0.0);
+            set_int(sbvis_v, 0);
+            set_int(sbalways_v, 0);
+            set_int(sbvis_timer, 0);
+         }
+      }
+
+      program {
+         name: "vbar_show";
+         signal: "elm,action,show,vbar";
+         source: "elm";
+         action:  STATE_SET "default" 0.0;
+         target: "sb_vbar_clip_master";
+      }
+
+      program {
+         name: "vbar_hide";
+         signal: "elm,action,hide,vbar";
+         source: "elm";
+         action:  STATE_SET "hidden" 0.0;
+         target: "sb_vbar_clip_master";
+      }
+
+      program {
+         name: "vbar_show_always";
+         signal: "elm,action,show_always,vbar";
+         source: "elm";
+         script {
+            new v;
+            v = get_int(sbvis_v);
+            v |= get_int(sbalways_v);
+            if (!v) {
+               set_int(sbalways_v, 1);
+               emit("do-show-vbar", "");
+               set_int(sbvis_v, 1);
+            }
+         }
+      }
+
+      program {
+         name: "vbar_show_notalways";
+         signal: "elm,action,show_notalways,vbar";
+         source: "elm";
+         script {
+            new v;
+            v = get_int(sbalways_v);
+            if (v) {
+               set_int(sbalways_v, 0);
+               v = get_int(sbvis_v);
+               if (!v) {
+                  emit("do-hide-vbar", "");
+                  set_int(sbvis_v, 0);
+               }
+            }
+         }
+      }
+
+      program {
+         signal: "do-show-vbar";
+         source: "";
+         action:  STATE_SET "default" 0.0;
+         transition: LINEAR 0.5;
+         target: "sb_vbar_clip";
+      }
+
+      program {
+         signal: "do-hide-vbar";
+         source: "";
+         action:  STATE_SET "hidden" 0.0;
+         transition: LINEAR 0.5;
+         target: "sb_vbar_clip";
+      }
+
+      program {
+         name: "scroll";
+         signal: "elm,action,scroll";
+         source: "elm";
+         script {
+            new v;
+            v = get_int(sbvis_v);
+            v |= get_int(sbalways_v);
+            if (!v) {
+               emit("do-show-vbar", "");
+               set_int(sbvis_v, 1);
+            }
+            v = get_int(sbvis_timer);
+            if (v > 0) cancel_timer(v);
+            v = timer(1.0, "timer0", 0);
+            set_int(sbvis_timer, v);
+         }
+      }
+   }
+}
index 944321e..a5653a7 100644 (file)
@@ -294,7 +294,7 @@ static void _popup_redial(void *data, Evas_Object *o __UNUSED__, void *event __U
 static void _call_disconnected_show(Callscreen *ctx, OFono_Call *c,
                                        const char *reason)
 {
-       Evas_Object *p, *bt;
+       Evas_Object *p;
        const char *number, *title;
        char msg[1024];
 
@@ -346,25 +346,18 @@ static void _call_disconnected_show(Callscreen *ctx, OFono_Call *c,
 
        eina_stringshare_replace(&ctx->disconnected.number, number);
 
-       ctx->disconnected.popup = p = elm_popup_add(ctx->self);
-       evas_object_size_hint_weight_set(p, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_object_part_text_set(p, "title,text", title);
-       elm_object_text_set(p, msg);
-
-       bt = elm_button_add(p);
-       elm_object_text_set(bt, "Close");
-       elm_object_part_content_set(p, "button1", bt);
-       evas_object_smart_callback_add(bt, "clicked", _popup_close, ctx);
-
-       bt = elm_button_add(p);
-       elm_object_text_set(bt, "Redial");
-       elm_object_part_content_set(p, "button2", bt);
-       evas_object_smart_callback_add(bt, "clicked", _popup_redial, ctx);
+       ctx->disconnected.popup = p = gui_simple_popup(title, msg);
+       gui_simple_popup_buttons_set(p,
+                                       "Dismiss",
+                                       "dialer",
+                                       _popup_close,
+                                       "Redial",
+                                       "dialer",
+                                       _popup_redial,
+                                       ctx);
 
        /* TODO: sound to notify user */
 
-       evas_object_show(p);
-
        return;
 done:
        _call_disconnected_done(ctx, reason);
index e6d1003..3f71e33 100644 (file)
@@ -58,20 +58,138 @@ static void _popup_close(void *data, Evas_Object *bt __UNUSED__, void *event __U
        evas_object_del(popup);
 }
 
-void gui_simple_popup(const char *title, const char *message)
+void gui_simple_popup_title_set(Evas_Object *p, const char *title)
+{
+       if (title) {
+               elm_object_part_text_set(p, "elm.text.title", title);
+               elm_object_signal_emit(p, "show,title", "gui");
+       } else {
+               elm_object_part_text_set(p, "elm.text.title", "");
+               elm_object_signal_emit(p, "hide,title", "gui");
+       }
+}
+
+/* HACK: force recalc from an idler to fix elm_entry problem */
+static Eina_Bool _gui_simple_popup_message_reeval(void *data)
+{
+       Evas_Object *en = data;
+       elm_entry_calc_force(en);
+       evas_object_data_del(en, "reeval_timer");
+       return EINA_FALSE;
+}
+
+static void _gui_simple_popup_message_reeval_del(void *data __UNUSED__,
+                                                       Evas *e __UNUSED__,
+                                                       Evas_Object *en,
+                                                       void *einfo __UNUSED__)
+{
+       Ecore_Timer *timer = evas_object_data_del(en, "reeval_timer");
+       if (timer)
+               ecore_timer_del(timer);
+}
+
+void gui_simple_popup_message_set(Evas_Object *p, const char *msg)
+{
+       Evas_Object *en;
+       Ecore_Timer *timer;
+
+       if (!msg) {
+               elm_object_part_content_set(p, "elm.swallow.content", NULL);
+               elm_object_signal_emit(p, "hide,content", "gui");
+               return;
+       }
+
+       en = elm_entry_add(p);
+       elm_object_style_set(en, "dialer-popup");
+       elm_entry_editable_set(en, EINA_FALSE);
+       elm_entry_scrollable_set(en, EINA_TRUE);
+       elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF,
+                                       ELM_SCROLLER_POLICY_AUTO);
+       elm_object_text_set(en, msg);
+       elm_object_part_content_set(p, "elm.swallow.content", en);
+       elm_object_signal_emit(p, "show,content", "gui");
+
+       /* HACK: elm_entry is not evaluating properly and the text is
+        * not centered as it should be. Then we must force a
+        * calculation from an timer.
+        */
+       timer = ecore_timer_add(0.02, _gui_simple_popup_message_reeval, en);
+       evas_object_data_set(en, "reeval_timer", timer);
+       evas_object_event_callback_add(en, EVAS_CALLBACK_DEL,
+                                       _gui_simple_popup_message_reeval_del,
+                                       NULL);
+}
+
+void gui_simple_popup_button_dismiss_set(Evas_Object *p)
+{
+       Evas_Object *bt = elm_button_add(p);
+       elm_object_style_set(bt, "dialer");
+       elm_object_text_set(bt, "Dismiss");
+
+       elm_object_part_content_set(p, "elm.swallow.button1", bt);
+       elm_object_signal_emit(p, "buttons,1", "gui");
+       evas_object_smart_callback_add(bt, "clicked", _popup_close, p);
+}
+
+void gui_simple_popup_buttons_set(Evas_Object *p,
+                                       const char *b1_label,
+                                       const char *b1_class,
+                                       Evas_Smart_Cb b1_cb,
+                                       const char *b2_label,
+                                       const char *b2_class,
+                                       Evas_Smart_Cb b2_cb,
+                                       const void *data)
 {
-       Evas_Object *p = elm_popup_add(win);
        Evas_Object *bt;
+       unsigned int count = 0;
+
+       if (b1_label) {
+               bt = elm_button_add(p);
+               elm_object_style_set(bt, b1_class ? b1_class : "dialer");
+               elm_object_text_set(bt, b1_label);
+               elm_object_part_content_set(p, "elm.swallow.button1", bt);
+               evas_object_smart_callback_add(bt, "clicked", b1_cb, data);
+               count++;
+       }
+
+       if (b2_label) {
+               const char *part;
+               bt = elm_button_add(p);
+               elm_object_style_set(bt, b2_class ? b2_class : "dialer");
+               elm_object_text_set(bt, b2_label);
+
+               if (count == 1)
+                       part = "elm.swallow.button2";
+               else
+                       part = "elm.swallow.button1";
+
+               elm_object_part_content_set(p, part, bt);
+               evas_object_smart_callback_add(bt, "clicked", b2_cb, data);
+               count++;
+       }
+
+       if (count == 2)
+               elm_object_signal_emit(p, "buttons,2", "gui");
+       else if (count == 1)
+               elm_object_signal_emit(p, "buttons,1", "gui");
+       else
+               elm_object_signal_emit(p, "buttons,0", "gui");
+}
+
+Evas_Object *gui_simple_popup(const char *title, const char *message)
+{
+       Evas_Object *p = gui_layout_add(win, "popup");
 
        evas_object_size_hint_weight_set(p, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_object_text_set(p, message);
-       elm_object_part_text_set(p, "title,text", title);
+       elm_win_resize_object_add(win, p);
+
+       gui_simple_popup_title_set(p, title);
+       gui_simple_popup_message_set(p, message);
+       gui_simple_popup_button_dismiss_set(p);
 
-       bt = elm_button_add(p);
-       elm_object_text_set(bt, "Close");
-       elm_object_part_content_set(p, "button1", bt);
-       evas_object_smart_callback_add(bt, "clicked", _popup_close, p);
        evas_object_show(p);
+
+       return p;
 }
 
 void gui_activate(void)
index 22202b0..3281e8a 100644 (file)
@@ -5,7 +5,21 @@
 
 Evas_Object *gui_layout_add(Evas_Object *parent, const char *style);
 
-void gui_simple_popup(const char *title, const char *message);
+Evas_Object *gui_simple_popup(const char *title, const char *message);
+
+void gui_simple_popup_title_set(Evas_Object *p, const char *title);
+void gui_simple_popup_message_set(Evas_Object *p, const char *msg);
+
+void gui_simple_popup_button_dismiss_set(Evas_Object *p);
+void gui_simple_popup_buttons_set(Evas_Object *p,
+                                       const char *b1_label,
+                                       const char *b1_class,
+                                       Evas_Smart_Cb b1_cb,
+                                       const char *b2_label,
+                                       const char *b2_class,
+                                       Evas_Smart_Cb b2_cb,
+                                       const void *data);
+
 
 void gui_activate(void);
 void gui_number_set(const char *number, Eina_Bool auto_dial);
index 5d892d2..7f1388f 100644 (file)
@@ -640,27 +640,21 @@ static void _history_clear_cancel(void *data, Evas_Object *obj __UNUSED__,
 
 static void _history_clear(History *ctx)
 {
-       Evas_Object *p, *bt;
+       Evas_Object *p;
 
        EINA_SAFETY_ON_TRUE_RETURN(ctx->clear_popup != NULL);
 
-       ctx->clear_popup = p = elm_popup_add(ctx->self);
-       evas_object_size_hint_weight_set(p, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_object_part_text_set(p, "title,text", "Clear History");
-       elm_object_text_set(p, "Do you want to clear all history entries?");
-
-       bt = elm_button_add(p);
-       elm_object_text_set(bt, "No");
-       elm_object_part_content_set(p, "button1", bt);
-       evas_object_smart_callback_add(bt, "clicked",
-                                       _history_clear_cancel, ctx);
-
-       bt = elm_button_add(p);
-       elm_object_text_set(bt, "Yes, Clear");
-       elm_object_part_content_set(p, "button2", bt);
-       evas_object_smart_callback_add(bt, "clicked", _history_clear_do, ctx);
-
-       evas_object_show(p);
+       ctx->clear_popup = p = gui_simple_popup("Clear History",
+                               "Do you want to clear all history entries?");
+
+       gui_simple_popup_buttons_set(p,
+                                       "Dismiss",
+                                       "dialer",
+                                       _history_clear_cancel,
+                                       "Yes, Clear",
+                                       "dialer-caution",
+                                       _history_clear_do,
+                                       ctx);
 }
 
 static char *_item_label_get(void *data, Evas_Object *obj __UNUSED__,