Toolbar: Add auto selected item feature for navigation style. 30/66230/1
authorYoungbok Shin <youngb.shin@samsung.com>
Mon, 18 Apr 2016 04:11:35 +0000 (13:11 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Mon, 18 Apr 2016 04:13:55 +0000 (13:13 +0900)
Auto selected item is selected by its order.

@tizen_feature

Change-Id: I0ee577f1c93f9314210881b3fe84a37b954e59b9

src/lib/elm_toolbar.c
src/lib/elm_widget_toolbar.h

index f506557d1a4ee2f4ea1de35f1b9f0d24b9762929..19e81913198954077ea153e3cf8087cd0429e5a1 100644 (file)
@@ -151,18 +151,42 @@ _item_menu_destroy(Elm_Toolbar_Item_Data *item)
 static void
 _item_unselect(Elm_Toolbar_Item_Data *item)
 {
+   /* TIZEN_ONLY(20160418): Add auto selected item feature for navigation style.
    if ((!item) || (!item->selected)) return;
+   */
+   Eina_Bool selected;
+
+   if (!item) return;
+
+   selected = item->selected;
+   /* END */
 
    ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
 
    item->selected = EINA_FALSE;
+   /* TIZEN_ONLY(20160418): Add auto selected item feature for navigation style.
    sd->selected_item = NULL;
+   */
+   if (sd->selected_item == EO_OBJ(item))
+     sd->selected_item = NULL;
+   if (sd->auto_selected_last_item == EO_OBJ(item))
+     sd->auto_selected_last_item = NULL;
+   /* END */
    elm_layout_signal_emit(VIEW(item), "elm,state,unselected", "elm");
    if (item->icon)
      elm_widget_signal_emit(item->icon, "elm,state,unselected", "elm");
+   /* TIZEN_ONLY(20160418): Add auto selected item feature for navigation style.
    eo_do(WIDGET(item), eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_UNSELECTED, EO_OBJ(item)));
    if (_elm_config->atspi_mode)
     elm_interface_atspi_accessible_state_changed_signal_emit(EO_OBJ(item), ELM_ATSPI_STATE_SELECTED, EINA_FALSE);
+   */
+   if (selected)
+     {
+        eo_do(WIDGET(item), eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_UNSELECTED, EO_OBJ(item)));
+        if (_elm_config->atspi_mode)
+          elm_interface_atspi_accessible_state_changed_signal_emit(EO_OBJ(item), ELM_ATSPI_STATE_SELECTED, EINA_FALSE);
+     }
+   /* END */
 }
 
 static void
@@ -1106,6 +1130,13 @@ _item_select(Elm_Toolbar_Item_Data *it)
              Elm_Object_Item *eo_it2 = elm_toolbar_selected_item_get(WIDGET(it));
              ELM_TOOLBAR_ITEM_DATA_GET(eo_it2, it2);
              _item_unselect(it2);
+             /* TIZEN_ONLY(20160418): Add auto selected item feature for navigation style. */
+             if (sd->auto_selected_last_item)
+               {
+                  ELM_TOOLBAR_ITEM_DATA_GET(sd->auto_selected_last_item, it3);
+                  _item_unselect(it3);
+               }
+             /* END */
 
              it->selected = EINA_TRUE;
              sd->selected_item = EO_OBJ(it);
@@ -1261,6 +1292,22 @@ _elm_toolbar_item_order_signal_emit(Elm_Toolbar_Data *sd,
           }
      }
 
+   /* TIZEN_ONLY(20160418): Add auto selected item feature for navigation style. */
+   if ((sd->selected_item != EO_OBJ(last_it)) &&
+       (sd->auto_selected_last_item != EO_OBJ(last_it)))
+     {
+        if (sd->auto_selected_last_item &&
+            sd->auto_selected_last_item != sd->selected_item)
+          {
+             ELM_TOOLBAR_ITEM_DATA_GET(sd->auto_selected_last_item, it2);
+
+             _item_unselect(it2);
+          }
+
+        sd->auto_selected_last_item = EO_OBJ(last_it);
+     }
+   /* END */
+
    eina_list_free(list);
 }
 
index e9438fb615f5f2e51142f63c92fa87acb4e12391..35dfc0e0d625a98816cbbabaacd0998f238c5ebe 100644 (file)
@@ -35,6 +35,9 @@ struct _Elm_Toolbar_Data
    Eina_Inlist                          *items;
    Elm_Toolbar_Item_Data                *more_item;
    Elm_Object_Item                      *selected_item; /**< a selected item by mouse click, return key, api, and etc. */
+   /* TIZEN_ONLY(20160418): Add auto selected item feature for navigation style. */
+   Elm_Object_Item                      *auto_selected_last_item; /**< a automatically selected item by its order. */
+   /* END */
    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. */
    Elm_Toolbar_Item_Data                *reorder_empty, *reorder_item;