summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael BOUCHAUD <michael.bouchaud@gmail.com>2012-06-28 14:26:18 +0000
committerMichael BOUCHAUD <michael.bouchaud@gmail.com>2012-06-28 14:26:18 +0000
commit9c732061a4e6231f8d04bcf138f849a573a9433d (patch)
tree448ac96eef6d2f7d6b08af3c62d1c0d28647c6b8
parent693fa9b33c4b5a1d8ae6db9d4f5c88e29db65fb5 (diff)
ekbd: add theme_set func
SVN revision: 73014
-rw-r--r--src/bin/ekbd_test.c1
-rw-r--r--src/lib/Ekbd.h.in1
-rw-r--r--src/lib/ekbd_layout.c12
-rw-r--r--src/lib/ekbd_private.h1
-rw-r--r--src/lib/ekbd_smart.c14
5 files changed, 23 insertions, 6 deletions
diff --git a/src/bin/ekbd_test.c b/src/bin/ekbd_test.c
index 1cb50c1..40fd83d 100644
--- a/src/bin/ekbd_test.c
+++ b/src/bin/ekbd_test.c
@@ -80,6 +80,7 @@ _keyboard_add()
80 Eina_Iterator *ls; 80 Eina_Iterator *ls;
81 81
82 _kbd = ekbd_object_add(evas_object_evas_get(_win)); 82 _kbd = ekbd_object_add(evas_object_evas_get(_win));
83 ekbd_object_theme_set(_kbd, PACKAGE_DATA_DIR"/themes/default.edj");
83 84
84 len = eina_str_join_len(buf, sizeof(buf), '/', PACKAGE_DATA_DIR, 85 len = eina_str_join_len(buf, sizeof(buf), '/', PACKAGE_DATA_DIR,
85 sizeof(PACKAGE_DATA_DIR) - 1, 86 sizeof(PACKAGE_DATA_DIR) - 1,
diff --git a/src/lib/Ekbd.h.in b/src/lib/Ekbd.h.in
index 01f2e60..1b66ac5 100644
--- a/src/lib/Ekbd.h.in
+++ b/src/lib/Ekbd.h.in
@@ -56,6 +56,7 @@ EAPI void ekbd_object_layout_add(Evas_Object *obj, const char *path)
56EAPI void ekbd_object_layout_clear(Evas_Object *obj); 56EAPI void ekbd_object_layout_clear(Evas_Object *obj);
57EAPI void ekbd_object_layout_select(Evas_Object *obj, Ekbd_Layout *layout); 57EAPI void ekbd_object_layout_select(Evas_Object *obj, Ekbd_Layout *layout);
58EAPI const Eina_List *ekbd_object_layout_get(const Evas_Object *obj); 58EAPI const Eina_List *ekbd_object_layout_get(const Evas_Object *obj);
59EAPI void ekbd_object_theme_set(Evas_Object *obj, const char *path);
59 60
60EAPI const char * ekbd_layout_file_get(const Ekbd_Layout *layout); 61EAPI const char * ekbd_layout_file_get(const Ekbd_Layout *layout);
61EAPI const char * ekbd_layout_path_get(const Ekbd_Layout *layout); 62EAPI const char * ekbd_layout_path_get(const Ekbd_Layout *layout);
diff --git a/src/lib/ekbd_layout.c b/src/lib/ekbd_layout.c
index 3c11e1d..1bb8b5d 100644
--- a/src/lib/ekbd_layout.c
+++ b/src/lib/ekbd_layout.c
@@ -551,7 +551,7 @@ _ekbd_layout_build(Smart_Data *sd)
551 EINA_LIST_FOREACH(sd->layout.keys, l, ky) 551 EINA_LIST_FOREACH(sd->layout.keys, l, ky)
552 { 552 {
553 o = ekbd_layout_theme_obj_new(evas_object_evas_get(sd->layout_obj), 553 o = ekbd_layout_theme_obj_new(evas_object_evas_get(sd->layout_obj),
554 NULL, "ekbd/key/default"); 554 sd->theme, "ekbd/key/default");
555 evas_object_move(o, sd->x + ky->orig_x, sd->y + ky->orig_y); 555 evas_object_move(o, sd->x + ky->orig_x, sd->y + ky->orig_y);
556 evas_object_resize(o, ky->orig_w, ky->orig_h); 556 evas_object_resize(o, ky->orig_w, ky->orig_h);
557 evas_object_clip_set(o, sd->layout_obj); 557 evas_object_clip_set(o, sd->layout_obj);
@@ -659,17 +659,17 @@ _ekbd_layout_tie_build(Smart_Data *sd)
659 Ekbd_Int_Tie *kt; 659 Ekbd_Int_Tie *kt;
660 Ekbd_Int_Key *ky; 660 Ekbd_Int_Key *ky;
661 Evas_Object *o, *ic; 661 Evas_Object *o, *ic;
662 double rw, rh; 662 double rw;//, rh;
663 //Evas_Coord x, y, ex, ey, ew, eh; 663 //Evas_Coord x, y, ex, ey, ew, eh;
664 664
665 kt = sd->down.tie; 665 kt = sd->down.tie;
666 rw = sd->w / (double)sd->layout.w; 666 rw = sd->w / (double)sd->layout.w;
667 rh = sd->h / (double)sd->layout.h; 667 //rh = sd->h / (double)sd->layout.h;
668 668
669 669
670 evas_event_freeze(evas_object_evas_get(sd->layout_obj)); 670 evas_event_freeze(evas_object_evas_get(sd->layout_obj));
671 o = ekbd_layout_theme_obj_new(evas_object_evas_get(sd->layout_obj), 671 o = ekbd_layout_theme_obj_new(evas_object_evas_get(sd->layout_obj),
672 NULL, "ekbd/cover/default"); 672 sd->theme, "ekbd/cover/default");
673 evas_object_move(o, sd->x, sd->y); 673 evas_object_move(o, sd->x, sd->y);
674 evas_object_resize(o, sd->w, sd->h); 674 evas_object_resize(o, sd->w, sd->h);
675 evas_object_show(o); 675 evas_object_show(o);
@@ -677,7 +677,7 @@ _ekbd_layout_tie_build(Smart_Data *sd)
677 evas_object_raise(sd->layout.pressed->obj); 677 evas_object_raise(sd->layout.pressed->obj);
678 678
679 o = ekbd_layout_theme_obj_new(evas_object_evas_get(sd->layout_obj), 679 o = ekbd_layout_theme_obj_new(evas_object_evas_get(sd->layout_obj),
680 NULL, "ekbd/tie/default"); 680 sd->theme, "ekbd/tie/default");
681 evas_object_show(o); 681 evas_object_show(o);
682 kt->base_obj = o; 682 kt->base_obj = o;
683 683
@@ -687,7 +687,7 @@ _ekbd_layout_tie_build(Smart_Data *sd)
687 const char *label, *icon; 687 const char *label, *icon;
688 688
689 o = ekbd_layout_theme_obj_new( 689 o = ekbd_layout_theme_obj_new(
690 evas_object_evas_get(sd->layout_obj), NULL, "ekbd/key/default"); 690 evas_object_evas_get(sd->layout_obj), sd->theme, "ekbd/key/default");
691 ky->obj = o; 691 ky->obj = o;
692 label = ""; 692 label = "";
693 icon = NULL; 693 icon = NULL;
diff --git a/src/lib/ekbd_private.h b/src/lib/ekbd_private.h
index cd915df..05a3649 100644
--- a/src/lib/ekbd_private.h
+++ b/src/lib/ekbd_private.h
@@ -17,6 +17,7 @@ struct _Smart_Data
17{ 17{
18 Eina_List *layouts; 18 Eina_List *layouts;
19 Evas_Coord x, y, w, h; 19 Evas_Coord x, y, w, h;
20 const char *theme;
20 struct { 21 struct {
21 char *directory; 22 char *directory;
22 const char *file; 23 const char *file;
diff --git a/src/lib/ekbd_smart.c b/src/lib/ekbd_smart.c
index 11a4455..f90f457 100644
--- a/src/lib/ekbd_smart.c
+++ b/src/lib/ekbd_smart.c
@@ -98,6 +98,19 @@ ekbd_layout_type_get(const Ekbd_Layout *layout)
98 return EKBD_TYPE_UNKNOWN; 98 return EKBD_TYPE_UNKNOWN;
99} 99}
100 100
101EAPI void
102ekbd_object_theme_set(Evas_Object *obj, const char *path)
103{
104 Smart_Data *sd = evas_object_smart_data_get(obj);
105 if (!sd || !path) return;
106 if (sd->theme)
107 eina_stringshare_replace(&sd->theme, path);
108 else
109 sd->theme = eina_stringshare_add(path);
110 if (sd->layouts)
111 ekbd_object_layout_select(obj, eina_list_data_get(sd->layouts));
112}
113
101 114
102static void 115static void
103_smart_init() 116_smart_init()
@@ -170,6 +183,7 @@ _smart_del(Evas_Object *obj)
170 if (_handler) 183 if (_handler)
171 ecore_event_handler_del(_handler); 184 ecore_event_handler_del(_handler);
172 evas_object_del(sd->layout_obj); 185 evas_object_del(sd->layout_obj);
186 if (sd->theme) eina_stringshare_del(sd->theme);
173 free(sd); 187 free(sd);
174} 188}
175 189