aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2017-11-25 18:19:47 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2017-11-25 18:19:47 +0900
commit7837195d752a49176d236b840309992317941d9f (patch)
tree4fe5d051dfcc2e450c1e96cb46b15f96b16ec39c
parentefl_ui_toolbar: remove focus_state_apply because there is no scroller interface (diff)
downloadefl-devs/woohyun/efl_ui_toolbar.tar.gz
efl_ui_toolbar: code cleaningdevs/woohyun/efl_ui_toolbar
-rw-r--r--src/lib/elementary/efl_ui_toolbar.c152
-rw-r--r--src/lib/elementary/efl_ui_toolbar.eo27
-rw-r--r--src/lib/elementary/efl_ui_toolbar_item.eo1
-rw-r--r--src/lib/elementary/efl_ui_toolbar_private.h1
4 files changed, 36 insertions, 145 deletions
diff --git a/src/lib/elementary/efl_ui_toolbar.c b/src/lib/elementary/efl_ui_toolbar.c
index e041aee186..541b30badb 100644
--- a/src/lib/elementary/efl_ui_toolbar.c
+++ b/src/lib/elementary/efl_ui_toolbar.c
@@ -67,14 +67,6 @@ _item_unselect(Efl_Ui_Toolbar_Item_Data *item)
}
static void
-_item_mirrored_set(Evas_Object *obj EINA_UNUSED,
- Efl_Ui_Toolbar_Item_Data *it,
- Eina_Bool mirrored)
-{
- efl_ui_mirrored_set(VIEW(it), mirrored);
-}
-
-static void
_mirrored_set(Evas_Object *obj,
Eina_Bool mirrored)
{
@@ -83,7 +75,7 @@ _mirrored_set(Evas_Object *obj,
EFL_UI_TOOLBAR_DATA_GET(obj, sd);
EINA_INLIST_FOREACH(sd->items, it)
- _item_mirrored_set(obj, it, mirrored);
+ efl_ui_mirrored_set(VIEW(it), mirrored);
}
static void
@@ -94,9 +86,7 @@ _efl_ui_toolbar_item_focused(Elm_Object_Item *eo_it)
EFL_UI_TOOLBAR_DATA_GET(obj, sd);
const char *focus_raise;
- if ((!sd) || (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
- (eo_it == sd->focused_item))
- return;
+ if (!sd || (eo_it == sd->focused_item)) return;
sd->focused_item = eo_it;
@@ -123,11 +113,9 @@ _efl_ui_toolbar_item_unfocused(Elm_Object_Item *eo_it)
Evas_Object *obj = WIDGET(it);
EFL_UI_TOOLBAR_DATA_GET(obj, sd);
- if ((!sd) || !sd->focused_item ||
- (eo_it != sd->focused_item))
- return;
- if (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
+ if ((!sd) || !sd->focused_item || (eo_it != sd->focused_item))
return;
+
if (elm_widget_focus_highlight_enabled_get(obj))
{
EFL_UI_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it);
@@ -256,13 +244,6 @@ _resizing_eval_item(Efl_Ui_Toolbar_Item_Data *it)
}
EOLIAN static void
-_efl_ui_toolbar_item_elm_widget_item_disabled_set(Eo *eo_id, Efl_Ui_Toolbar_Item_Data *sd, Eina_Bool disabled)
-{
- elm_wdg_item_disabled_set(efl_super(eo_id, EFL_UI_TOOLBAR_ITEM_CLASS), disabled);
- efl_ui_focus_composition_dirty(WIDGET(sd));
-}
-
-EOLIAN static void
_efl_ui_toolbar_item_elm_widget_item_disable(Eo *eo_toolbar, Efl_Ui_Toolbar_Item_Data *toolbar_it)
{
const char* emission;
@@ -309,50 +290,30 @@ end:
static void
_item_select(Efl_Ui_Toolbar_Item_Data *it)
{
- Evas_Object *obj;
- Eina_Bool sel;
-
EFL_UI_TOOLBAR_DATA_GET(WIDGET(it), sd);
if (elm_wdg_item_disabled_get(EO_OBJ(it)) || (it->object))
return;
- sel = it->selected;
-
- if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_NONE) &&
- (sd->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
+ if (!it->selected)
{
- if (sel)
- {
- if (sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS)
- _item_unselect(it);
- }
- else
- {
- Elm_Object_Item *eo_it2 =
- efl_ui_menu_selected_item_get(WIDGET(it));
- EFL_UI_TOOLBAR_ITEM_DATA_GET(eo_it2, it2);
- _item_unselect(it2);
-
- it->selected = EINA_TRUE;
- sd->selected_item = EO_OBJ(it);
+ Elm_Object_Item *eo_it2 =
+ efl_ui_menu_selected_item_get(WIDGET(it));
+ EFL_UI_TOOLBAR_ITEM_DATA_GET(eo_it2, it2);
+ _item_unselect(it2);
- elm_layout_signal_emit(VIEW(it), "elm,state,selected", "elm");
- if (it->icon)
- elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
- }
- }
+ it->selected = EINA_TRUE;
+ sd->selected_item = EO_OBJ(it);
- obj = WIDGET(it);
+ elm_layout_signal_emit(VIEW(it), "elm,state,selected", "elm");
+ if (it->icon)
+ elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
- if ((!sel) || (sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS))
- {
if (it->func) it->func((void *)(WIDGET_ITEM_DATA_GET(EO_OBJ(it))), WIDGET(it), EO_OBJ(it));
+ efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_SELECTED, EO_OBJ(it));
+ if (_elm_config->atspi_mode)
+ efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_SELECTED, EINA_TRUE);
}
-
- efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SELECTED, EO_OBJ(it));
- if (_elm_config->atspi_mode)
- efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_SELECTED, EINA_TRUE);
}
/* Send order signals when item is added/deleted.
@@ -489,7 +450,7 @@ _item_theme_hook(Evas_Object *obj,
style = elm_widget_style_get(obj);
- _item_mirrored_set(obj, it, efl_ui_mirrored_get(obj));
+ efl_ui_mirrored_set(VIEW(it), efl_ui_mirrored_get(obj));
edje_object_scale_set(elm_layout_edje_get(view), scale);
if (!it->object)
@@ -869,29 +830,12 @@ _access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
EOLIAN static void
_efl_ui_toolbar_item_efl_object_destructor(Eo *eo_item, Efl_Ui_Toolbar_Item_Data *item)
{
- Efl_Ui_Toolbar_Item_Data *next = NULL;
- Evas_Object *obj;
-
EFL_UI_TOOLBAR_DATA_GET(WIDGET(item), sd);
- obj = WIDGET(item);
-
-
- if (!sd->delete_me)
- next = EFL_UI_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(item));
sd->item_count--;
- if (!sd->delete_me)
- {
- if (!next) next = EFL_UI_TOOLBAR_ITEM_FROM_INLIST(sd->items);
- if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) &&
- item->selected && next) _item_select(next);
- }
-
- efl_ui_focus_composition_dirty(WIDGET(item));
-
_item_del(item);
- efl_ui_widget_theme_apply(obj);
+ efl_ui_widget_theme_apply(WIDGET(item));
efl_destructor(efl_super(eo_item, EFL_UI_TOOLBAR_ITEM_CLASS));
}
@@ -902,11 +846,9 @@ _access_activate_cb(void *data EINA_UNUSED,
Elm_Object_Item *item)
{
EFL_UI_TOOLBAR_ITEM_DATA_GET(item, it);
- EFL_UI_TOOLBAR_DATA_GET(WIDGET(it), sd);
-
if (elm_wdg_item_disabled_get(item)) return;
- if (it->selected && (sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS))
+ if (it->selected)
{
_elm_access_say(E_("Unselected"));
_item_unselect(it);
@@ -1031,11 +973,9 @@ _item_new(Evas_Object *obj,
edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
- if ((!sd->items) && (sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS))
- _item_select(it);
+ if (!sd->items) _item_select(it);
- if (_elm_config->atspi_mode)
- efl_access_added(eo_it);
+ if (_elm_config->atspi_mode) efl_access_added(eo_it);
return it;
}
@@ -1151,12 +1091,6 @@ _efl_ui_toolbar_efl_gfx_size_set(Eo *obj, Efl_Ui_Toolbar_Data *sd EINA_UNUSED, E
efl_gfx_size_set(efl_super(obj, MY_CLASS), sz);
}
-EOLIAN static void
-_efl_ui_toolbar_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Toolbar_Data *sd EINA_UNUSED, Evas_Object *member)
-{
- efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
-}
-
static Eina_Bool _efl_ui_toolbar_smart_focus_next_enable = EINA_FALSE;
static void
@@ -1560,28 +1494,6 @@ _efl_ui_toolbar_items_count(const Eo *obj EINA_UNUSED, Efl_Ui_Toolbar_Data *sd)
return sd->item_count;
}
-EOLIAN static void
-_efl_ui_toolbar_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_Toolbar_Data *sd, Elm_Object_Select_Mode mode)
-{
- if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
- return;
-
- if (sd->select_mode == mode) return;
- sd->select_mode = mode;
-
- if ((mode == ELM_OBJECT_SELECT_MODE_ALWAYS) &&
- (sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) &&
- sd->items)
- _item_select(EFL_UI_TOOLBAR_ITEM_FROM_INLIST(sd->items));
-
-}
-
-EOLIAN static Elm_Object_Select_Mode
-_efl_ui_toolbar_select_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Toolbar_Data *sd)
-{
- return sd->select_mode;
-}
-
EOLIAN static const char*
_efl_ui_toolbar_item_efl_access_name_get(Eo *eo_item, Efl_Ui_Toolbar_Item_Data *item)
{
@@ -1727,17 +1639,15 @@ EOLIAN Eina_Bool
_efl_ui_toolbar_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_Toolbar_Data *pd, int child_index)
{
Efl_Ui_Toolbar_Item_Data *item;
- if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
- {
- EINA_INLIST_FOREACH(pd->items, item)
- {
- if (child_index-- == 0)
- {
- efl_ui_item_selected_set(EO_OBJ(item), EINA_FALSE);
- return EINA_TRUE;
- }
- }
- }
+
+ EINA_INLIST_FOREACH(pd->items, item)
+ {
+ if (child_index-- == 0)
+ {
+ efl_ui_item_selected_set(EO_OBJ(item), EINA_FALSE);
+ return EINA_TRUE;
+ }
+ }
return EINA_FALSE;
}
diff --git a/src/lib/elementary/efl_ui_toolbar.eo b/src/lib/elementary/efl_ui_toolbar.eo
index 970d581d8e..26980a3486 100644
--- a/src/lib/elementary/efl_ui_toolbar.eo
+++ b/src/lib/elementary/efl_ui_toolbar.eo
@@ -4,28 +4,12 @@ class Efl.Ui.Toolbar (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Efl.Ui.Direction,
Efl.Access.Widget.Action, Efl.Access.Selection,
Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Menu)
{
- [[Toolbar widget class]]
+ [[Toolbar widget
+
+ A toolbar displays a list of items inside.
+ Among them, only one can be selected at a time.
+ ]]
methods {
- @property select_mode {
- [[Control the toolbar select mode.
-
- elm_toolbar_select_mode_set() changes item select mode in the toolbar widget.
- - #ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and
- callback when first becoming selected. Any further clicks will
- do nothing, unless you set always select mode.
- - #ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected,
- every click will make the selected callbacks be called.
- - #ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items
- entirely and they will neither appear selected nor call selected
- callback functions.]]
- set {
- }
- get {
- }
- values {
- mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode If getting mode fails, it returns #ELM_OBJECT_SELECT_MODE_MAX]]
- }
- }
item_insert_before {
[[Insert a new item into the toolbar object before item $before.
@@ -172,7 +156,6 @@ class Efl.Ui.Toolbar (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Efl.Ui.Direction,
Efl.Gfx.position { set; }
Efl.Gfx.size { set; }
Efl.Canvas.Group.group_calculate;
- Efl.Canvas.Group.group_member_add;
Elm.Widget.on_access_update;
Elm.Widget.theme_apply;
Elm.Widget.on_focus_update;
diff --git a/src/lib/elementary/efl_ui_toolbar_item.eo b/src/lib/elementary/efl_ui_toolbar_item.eo
index e2a3abb061..0e016b3234 100644
--- a/src/lib/elementary/efl_ui_toolbar_item.eo
+++ b/src/lib/elementary/efl_ui_toolbar_item.eo
@@ -65,7 +65,6 @@ class Efl.Ui.Toolbar.Item(Elm.Widget.Item, Efl.Ui.Item, Efl.Ui.Focus.Object)
Efl.Object.constructor;
Efl.Object.destructor;
Elm.Widget.Item.disable;
- Elm.Widget.Item.disabled { set; }
Elm.Widget.Item.focus { get; set; }
Elm.Widget.Item.signal_emit;
Elm.Widget.Item.part_text { get; set; }
diff --git a/src/lib/elementary/efl_ui_toolbar_private.h b/src/lib/elementary/efl_ui_toolbar_private.h
index e45157ff20..30809f75aa 100644
--- a/src/lib/elementary/efl_ui_toolbar_private.h
+++ b/src/lib/elementary/efl_ui_toolbar_private.h
@@ -32,7 +32,6 @@ struct _Efl_Ui_Toolbar_Data
Elm_Object_Item *focused_item; /**< a focused item by keypad arrow or mouse. This is set to NULL if widget looses focus. */
Elm_Object_Item *last_focused_item; /**< This records the last focused item when widget looses focus. This is required to set the focus on last focused item when widgets gets focus. */
unsigned int item_count;
- Elm_Object_Select_Mode select_mode;
Efl_Ui_Dir dir;
Eina_Bool delete_me : 1;