aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWoochanlee <wc0917.lee@samsung.com>2018-08-21 13:52:28 +0900
committerHermet Park <hermetpark@gmail.com>2018-08-21 13:52:29 +0900
commit739da4f736cec242042ba3a39d8a7c2417d924ab (patch)
tree4b97b79eece027abb0059b066fc005982f122058
parentefl_ui_focus_composition: remove unused variable (diff)
downloadefl-739da4f736cec242042ba3a39d8a7c2417d924ab.tar.gz
efl_ui_spin_button: Addded direction feature.
Summary: The Spin_Button class supports two types(horizontal, vertical). User can use 'efl_ui_direction()' for spin_button. @feature Test Plan: elementary_test-> spin_button sample. Reviewers: Hermet, Jaehyun_Cho Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6680
-rw-r--r--data/elementary/themes/edc/efl/datepicker.edc12
-rw-r--r--data/elementary/themes/edc/efl/spin_button.edc83
-rw-r--r--data/elementary/themes/edc/efl/timepicker.edc15
-rw-r--r--src/bin/elementary/test_ui_spin_button.c1
-rw-r--r--src/lib/elementary/efl_ui_datepicker.c12
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c92
-rw-r--r--src/lib/elementary/efl_ui_spin_button.eo3
-rw-r--r--src/lib/elementary/efl_ui_spin_button_private.h2
-rw-r--r--src/lib/elementary/efl_ui_timepicker.c8
9 files changed, 144 insertions, 84 deletions
diff --git a/data/elementary/themes/edc/efl/datepicker.edc b/data/elementary/themes/edc/efl/datepicker.edc
index e15343af46..31eb20610a 100644
--- a/data/elementary/themes/edc/efl/datepicker.edc
+++ b/data/elementary/themes/edc/efl/datepicker.edc
@@ -331,15 +331,3 @@ group { "efl/datepicker/spin_button";
}
}
}
-
-group { "efl/datepicker/spin_button/text_button";
- inherit: "efl/spin_button/text_button";
-}
-
-group { "efl/datepicker/spin_button/inc_button";
- inherit: "efl/spin_button/inc_button:vertical";
-}
-
-group { "efl/datepicker/spin_button/dec_button";
- inherit: "efl/spin_button/dec_button:vertical";
-}
diff --git a/data/elementary/themes/edc/efl/spin_button.edc b/data/elementary/themes/edc/efl/spin_button.edc
index 4cb7783f1f..417d002154 100644
--- a/data/elementary/themes/edc/efl/spin_button.edc
+++ b/data/elementary/themes/edc/efl/spin_button.edc
@@ -1,4 +1,4 @@
-group { "efl/spin_button";
+group { "efl/spin_button/horizontal";
images.image: "vert_bar_inset.png" COMP;
parts {
rect { "clip";
@@ -53,11 +53,6 @@ group { "efl/spin_button";
scale;
desc { "default";
fixed: 1 0;
- rel1.to: "inset";
- rel1.offset: 1 1;
- rel2.to: "inset";
- rel2.offset: 1 -2;
- rel2.relative: 0.0 1.0;
align: 0.0 0.5;
min: 15 15;
aspect: 1.0 1.0; aspect_preference: VERTICAL;
@@ -67,11 +62,6 @@ group { "efl/spin_button";
scale;
desc { "default";
fixed: 1 0;
- rel1.to: "inset";
- rel1.offset: 1 1;
- rel1.relative: 1.0 0.0;
- rel2.to: "inset";
- rel2.offset: 1 -2;
align: 1.0 0.5;
min: 15 15;
aspect: 1.0 1.0; aspect_preference: VERTICAL;
@@ -160,47 +150,53 @@ group { "efl/spin_button";
}
}
-group { "efl/spin_button:vertical";
- inherit: "efl/spin_button";
+group { "efl/spin_button/vertical";
+ inherit: "efl/spin_button/horizontal";
parts {
+ image { "inset"; nomouse;
+ desc { "default";
+ min: 40 150;
+ }
+ }
swallow { "efl.inc_button";
scale;
desc { "default";
- rel1.to: "inset";
- rel1.offset: 1 1;
- rel1.relative: 1.0 0.0;
- rel2.to: "inset";
- rel2.offset: 1 -2;
- align: 1.0 0.5;
+ rel.to: "inset";
+ align: 0.5 0.0;
+ min: 40 40;
+ max: 40 40;
+ fixed: 1 1;
}
}
- swallow { "efl.text_button";
+ swallow { "efl.dec_button";
scale;
desc { "default";
- vis;
- rel1.to_y: "inset";
- rel1.to_x: "efl.dec_button";
- rel1.relative: 1.0 0.0;
- rel1.offset: 1 1;
- rel2.to_y: "inset";
- rel2.to_x: "efl.inc_button";
- rel2.relative: 0.0 1.0;
- rel2.offset: -2 -2;
- }
- desc { "active";
- inherit: "default";
- hid;
+ rel.to: "inset";
+ align: 0.5 1.0;
+ min: 40 40;
+ max: 40 40;
+ fixed: 1 1;
}
}
- swallow { "efl.dec_button";
+ swallow { "efl.text_button";
scale;
desc { "default";
- rel1.to: "inset";
- rel1.offset: 1 1;
- rel2.to: "inset";
- rel2.offset: 1 -2;
- rel2.relative: 0.0 1.0;
- align: 0.0 0.5;
+ rel.to_x: "inset";
+ rel1 {
+ to_y: "efl.inc_button";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to_y: "efl.dec_button";
+ relative: 1.0 0.0;
+ }
+ min: 0 70;
+ max: -1 70;
+ fixed: 0 1;
+ }
+ desc { "inactive";
+ inherit: "default";
+ hid;
}
}
}
@@ -357,6 +353,7 @@ group { "efl/spin_button/inc_button";
}
group { "efl/spin_button/entry";
+ alias: "efl/spin_button/vertical/entry";
inherit: "efl/text";
}
@@ -386,7 +383,7 @@ group { "efl/spin_button/dec_button";
}
group { "efl/spin_button/text_button";
- alias: "efl/spin_button/text_button:vertical";
+ alias: "efl/spin_button/vertical/text_button";
parts {
part { name: "bg";
type: SPACER;
@@ -462,7 +459,7 @@ group { "efl/spin_button/text_button";
}
}
-group { "efl/spin_button/inc_button:vertical";
+group { "efl/spin_button/vertical/inc_button";
inherit: "efl/spin_button/inc_button";
images.image: "sym_up_light_normal.png" COMP;
images.image: "sym_up_glow_normal.png" COMP;
@@ -487,7 +484,7 @@ group { "efl/spin_button/inc_button:vertical";
}
}
-group { "efl/spin_button/dec_button:vertical";
+group { "efl/spin_button/vertical/dec_button";
inherit: "efl/spin_button/dec_button";
images.image: "sym_down_light_normal.png" COMP;
images.image: "sym_down_glow_normal.png" COMP;
diff --git a/data/elementary/themes/edc/efl/timepicker.edc b/data/elementary/themes/edc/efl/timepicker.edc
index c5a2a6a480..d045e732e4 100644
--- a/data/elementary/themes/edc/efl/timepicker.edc
+++ b/data/elementary/themes/edc/efl/timepicker.edc
@@ -377,21 +377,6 @@ group { "efl/timepicker";
}
}
-group { "efl/timepicker/spin_button";
- inherit: "efl/datepicker/spin_button";
-}
-
-group { "efl/timepicker/spin_button/text_button";
- inherit: "efl/spin_button/text_button";
-}
-
-group { "efl/timepicker/spin_button/inc_button";
- inherit: "efl/spin_button/inc_button:vertical";
-}
-
-group { "efl/timepicker/spin_button/dec_button";
- inherit: "efl/spin_button/dec_button:vertical";
-}
group { "efl/timepicker/button";
inherit: "efl/button";
parts {
diff --git a/src/bin/elementary/test_ui_spin_button.c b/src/bin/elementary/test_ui_spin_button.c
index 095c2a510d..0e008203c5 100644
--- a/src/bin/elementary/test_ui_spin_button.c
+++ b/src/bin/elementary/test_ui_spin_button.c
@@ -57,6 +57,7 @@ test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
efl_ui_range_value_set(efl_added, 1),
efl_ui_spin_button_editable_set(efl_added, EINA_FALSE),
efl_ui_spin_special_value_set(efl_added, array),
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
efl_pack(bx, efl_added));
eina_array_free(array);
diff --git a/src/lib/elementary/efl_ui_datepicker.c b/src/lib/elementary/efl_ui_datepicker.c
index 55f8b1d365..493dbfa674 100644
--- a/src/lib/elementary/efl_ui_datepicker.c
+++ b/src/lib/elementary/efl_ui_datepicker.c
@@ -162,22 +162,22 @@ _fields_init(Eo *obj)
efl_ui_range_min_max_set(efl_added, 1970, 2037),
efl_ui_spin_button_circulate_set(efl_added, EINA_TRUE),
efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
- efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj),
- elm_widget_element_update(obj, efl_added, "spin_button"));
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
+ efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj));
pd->month = efl_add(EFL_UI_SPIN_BUTTON_CLASS, obj,
efl_ui_range_min_max_set(efl_added, 1, 12),
efl_ui_spin_button_circulate_set(efl_added, EINA_TRUE),
efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
- efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj),
- elm_widget_element_update(obj, efl_added, "spin_button"));
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
+ efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj));
pd->day = efl_add(EFL_UI_SPIN_BUTTON_CLASS, obj,
efl_ui_range_min_max_set(efl_added, 1, 31),
efl_ui_spin_button_circulate_set(efl_added, EINA_TRUE),
efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
- efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj),
- elm_widget_element_update(obj, efl_added, "spin_button"));
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
+ efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj));
DATE_GET();
//Using system config?
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
index 6b2bfbeae8..fa21913e75 100644
--- a/src/lib/elementary/efl_ui_spin_button.c
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -735,10 +735,71 @@ _access_spinner_register(Evas_Object *obj, Eina_Bool is_access)
}
}
+static const char *
+_theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len)
+{
+ const char *pos = NULL;
+ const char *temp_str = NULL;
+
+ temp_str = cur_group + len - strlen(search);
+ if (temp_str >= cur_group)
+ {
+ if (!strcmp(temp_str, search))
+ pos = temp_str;
+ }
+
+ return pos;
+}
+
+static char *
+_efl_ui_spin_button_theme_group_get(Evas_Object *obj, Efl_Ui_Spin_Button_Data *sd)
+{
+ const char *pos = NULL;
+ const char *cur_group = elm_widget_theme_element_get(obj);
+ Eina_Strbuf *new_group = eina_strbuf_new();
+ size_t len = 0;
+
+ if (cur_group)
+ {
+ len = strlen(cur_group);
+ pos = _theme_group_modify_pos_get(cur_group, "horizontal", len);
+ if (!pos)
+ pos = _theme_group_modify_pos_get(cur_group, "vertical", len);
+
+ // TODO: change separator when it is decided.
+ // can skip when prev_group == cur_group
+ if (!pos)
+ {
+ eina_strbuf_append(new_group, cur_group);
+ eina_strbuf_append(new_group, "/");
+ }
+ else
+ {
+ eina_strbuf_append_length(new_group, cur_group, pos - cur_group);
+ }
+ }
+
+ if (efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
+ eina_strbuf_append(new_group, "horizontal");
+ else
+ eina_strbuf_append(new_group, "vertical");
+
+ return eina_strbuf_release(new_group);
+}
+
+
EOLIAN static Efl_Ui_Theme_Apply
_efl_ui_spin_button_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
{
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
+ char *group;
+
+ group = _efl_ui_spin_button_theme_group_get(obj, sd);
+ if (group)
+ {
+ elm_widget_theme_element_set(obj, group);
+ free(group);
+ }
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
@@ -766,11 +827,22 @@ _efl_ui_spin_button_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *
EOLIAN static Eo *
_efl_ui_spin_button_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
{
- if (!elm_widget_theme_klass_get(obj))
- elm_widget_theme_klass_set(obj, "spin_button");
- obj = efl_constructor(efl_super(obj, MY_CLASS));
+ char *group;
+ obj = efl_constructor(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj);
+ elm_widget_theme_klass_set(obj, "spin_button");
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
+
+ group = _efl_ui_spin_button_theme_group_get(obj, sd);
+ if (!elm_widget_theme_object_set(obj, wd->resize_obj,
+ elm_widget_theme_klass_get(obj),
+ group,
+ elm_widget_theme_style_get(obj)))
+ CRI("Failed to set layout!");
+
+ free(group);
sd->first_interval = 0.85;
@@ -813,6 +885,20 @@ _efl_ui_spin_button_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
}
EOLIAN static void
+_efl_ui_spin_button_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Spin_Button_Data *sd, Efl_Ui_Dir dir)
+{
+ sd->dir = dir;
+
+ efl_ui_widget_theme_apply(obj);
+}
+
+EOLIAN static Efl_Ui_Dir
+_efl_ui_spin_button_efl_ui_direction_direction_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd)
+{
+ return sd->dir;
+}
+
+EOLIAN static void
_efl_ui_spin_button_efl_ui_range_range_value_set(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double val)
{
efl_ui_range_value_set(efl_super(obj, MY_CLASS), val);
diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo
index 4b0b8be632..0551cb0687 100644
--- a/src/lib/elementary/efl_ui_spin_button.eo
+++ b/src/lib/elementary/efl_ui_spin_button.eo
@@ -1,4 +1,4 @@
-class Efl.Ui.Spin_Button (Efl.Ui.Spin, Efl.Ui.Focus.Composition,
+class Efl.Ui.Spin_Button (Efl.Ui.Spin, Efl.Ui.Focus.Composition, Efl.Ui.Direction,
Efl.Access.Value, Efl.Access.Widget.Action)
{
[[A Button Spin.
@@ -68,6 +68,7 @@ class Efl.Ui.Spin_Button (Efl.Ui.Spin, Efl.Ui.Focus.Composition,
Efl.Ui.Widget.widget_event;
Efl.Ui.Focus.Object.on_focus_update;
Efl.Ui.Range.range_value { set; }
+ Efl.Ui.Direction.direction { get; set; }
Efl.Access.Object.i18n_name { get; }
Efl.Access.Value.value_and_text { get; set; }
Efl.Access.Value.range { get; }
diff --git a/src/lib/elementary/efl_ui_spin_button_private.h b/src/lib/elementary/efl_ui_spin_button_private.h
index 217e9865be..90708c6cb6 100644
--- a/src/lib/elementary/efl_ui_spin_button_private.h
+++ b/src/lib/elementary/efl_ui_spin_button_private.h
@@ -10,6 +10,8 @@ struct _Efl_Ui_Spin_Button_Data
Ecore_Timer *spin_timer; /**< a timer for a repeated spinner value change on mouse down */
Ecore_Timer *longpress_timer; /**< a timer to detect long press. After lonpress timeout,
start continuous change of values until mouse up */
+ Efl_Ui_Dir dir;
+
Eina_Bool entry_visible : 1;
Eina_Bool entry_reactivate : 1;
Eina_Bool editable : 1;
diff --git a/src/lib/elementary/efl_ui_timepicker.c b/src/lib/elementary/efl_ui_timepicker.c
index 3c13f4f89c..dac4170bc2 100644
--- a/src/lib/elementary/efl_ui_timepicker.c
+++ b/src/lib/elementary/efl_ui_timepicker.c
@@ -125,15 +125,15 @@ _fields_init(Eo *obj)
efl_ui_range_min_max_set(efl_added, 1, 12),
efl_ui_spin_button_circulate_set(efl_added, EINA_TRUE),
efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
- efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj),
- elm_widget_element_update(obj, efl_added, "spin_button"));
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
+ efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj));
pd->min = efl_add(EFL_UI_SPIN_BUTTON_CLASS, obj,
efl_ui_range_min_max_set(efl_added, 0, 59),
efl_ui_spin_button_circulate_set(efl_added, EINA_TRUE),
efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
- efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj),
- elm_widget_element_update(obj, efl_added, "spin_button"));
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
+ efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_field_changed_cb, obj));
pd->ampm = efl_add(EFL_UI_BUTTON_CLASS, obj,
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _field_changed_cb, obj),