Toolbar: Add the more panel feature in toolbar. When it is the ELM_TOOLBAR_SHRINK_EXP...
authorjaehwan <jaehwan@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 22 May 2012 05:18:12 +0000 (05:18 +0000)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Fri, 29 Jun 2012 06:14:51 +0000 (15:14 +0900)
The APIs are added for this feature.(elm_toolbar_more_item_get, elm_toolbar_items_max_set/get)

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@71297 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

Conflicts:

ChangeLog

data/themes/widgets/toolbar.edc
src/bin/test_toolbar.c
src/lib/elm_toolbar.c
src/lib/elm_toolbar.h

index 4d1d2f0..e83aaf3 100644 (file)
@@ -131,6 +131,175 @@ group { name: "elm/toolbar/base/default";
    }
 }
 
+group { name: "elm/toolbar/more/default";
+   images {
+      image: "toolbar_separator_h.png" COMP;
+   }
+   parts {
+      part { name: "base";
+         mouse_events: 1;
+         description { state: "default" 0.0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 1.0 0.0;
+            image {
+               normal: "bt_dis_base.png";
+               border: 4 4 4 4;
+            }
+            image.middle: SOLID;
+         }
+         description { state: "open" 0.0;
+            inherit: "default" 0.0;
+            rel2.relative: 1.0 1.0;
+         }
+         description { state: "open2" 0.0;
+            inherit: "default" 0.0;
+            rel2.relative: 1.0 2.0;
+         }
+      }
+      part { name: "clipper";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               to: "base";
+            }
+            rel2 {
+               to: "base";
+            }
+         }
+         description { state: "open" 0.0;
+            inherit: "default" 0.0;
+            rel2.relative: 1.0 1.0;
+         }
+         description { state: "open2" 0.0;
+            inherit: "default" 0.0;
+            rel2.relative: 1.0 0.5;
+         }
+      }
+      part { name: "clipper2";
+         type: RECT;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.5;
+               to: "base";
+            }
+            rel2 {
+               to: "base";
+            }
+         }
+         description { state: "open" 0.0;
+            inherit: "default" 0.0;
+            rel1.relative: 0.0 1.0;
+         }
+         description { state: "open2" 0.0;
+            inherit: "default" 0.0;
+            rel1.relative: 0.0 0.5;
+         }
+      }
+      part { name: "elm.swallow.content";
+         clip_to: "clipper";
+         type: SWALLOW;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1.to: "clipper";
+            rel2.to: "clipper";
+         }
+      }
+      part { name: "elm.swallow.content2";
+         clip_to: "clipper2";
+         type: SWALLOW;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1.to: "clipper2";
+            rel2.to: "clipper2";
+         }
+      }
+      part { name: "separator2";
+         clip_to: "clipper2";
+         description { state: "default" 0.0;
+            min: 2 3;
+            max: 9999 3;
+            fixed: 1 1;
+            rel1 {
+                relative: 0.0 0.0;
+                offset: 0 0;
+                to: "clipper2";
+            }
+            rel2 {
+                relative: 1.0 0.0;
+                offset: -1 3;
+                to: "clipper2";
+            }
+            image {
+               normal: "toolbar_separator_h.png";
+               border: 1 1 1 1;
+            }
+            fill {
+               smooth: 0;
+            }
+         }
+      }
+      part { name: "over2";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+            image {
+               normal: "bt_dis_shine.png";
+               border: 4 4 4 4;
+            }
+         }
+      }
+      part { name: "over1";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+            rel2.relative: 1.0 0.5;
+            image {
+               normal: "bt_dis_hilight.png";
+               border: 4 4 4 0;
+            }
+            color: 255 255 255 128;
+         }
+      }
+   }
+   programs {
+      program { name: "open";
+         signal:  "elm,state,open";
+         source:  "elm";
+         action:  STATE_SET "open" 0.0;
+         target:  "base";
+         target:  "clipper";
+         target:  "clipper2";
+         transition: LINEAR 0.2;
+      }
+      program { name: "open2";
+         signal:  "elm,state,open2";
+         source:  "elm";
+         action:  STATE_SET "open2" 0.0;
+         target:  "base";
+         target:  "clipper";
+         target:  "clipper2";
+         transition: LINEAR 0.2;
+      }
+      program { name: "close";
+         signal:  "elm,state,close";
+         source:  "elm";
+         action:  STATE_SET "default" 0.0;
+         target:  "base";
+         transition: LINEAR 0.2;
+      }
+   }
+}
+
 group { name: "elm/toolbar/item/default";
    images {
       image: "toolbar_sel.png" COMP;
index e9ffdd1..6288bce 100644 (file)
@@ -61,6 +61,23 @@ tb_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
    elm_photo_file_set(data, NULL);
 }
 
+static void
+toolbar_clicked_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   Elm_Object_Item *it = elm_toolbar_more_item_get(obj);
+
+   if (!strcmp(elm_object_item_text_get(it), "Open") && (it == elm_toolbar_selected_item_get(obj)))
+     {
+        elm_toolbar_item_icon_set(it, "arrow_up");
+        elm_object_item_text_set(it, "Close");
+     }
+   else if (!strcmp(elm_object_item_text_get(it), "Close"))
+     {
+        elm_toolbar_item_icon_set(it, "arrow_down");
+        elm_object_item_text_set(it, "Open");
+     }
+}
+
 void
 test_toolbar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
@@ -798,10 +815,9 @@ test_toolbar7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bx, *tb, *ph, *sl, *menu;
+   Evas_Object *win, *bx, *tb, *ph, *sl;
    Evas_Object *ph1, *ph2, *ph3, *ph4;
    Elm_Object_Item *item;
-   Elm_Object_Item *menu_it;
    char buf[PATH_MAX];
 
    win = elm_win_util_standard_add("toolbar8", "Toolbar 8");
@@ -815,6 +831,7 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    tb = elm_toolbar_add(win);
    elm_toolbar_homogeneous_set(tb, EINA_FALSE);
    elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND);
+   elm_toolbar_items_max_set(tb, 9);
    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
@@ -827,33 +844,63 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    elm_object_item_disabled_set(item, EINA_TRUE);
    elm_toolbar_item_priority_set(item, -100);
 
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
    item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
    elm_toolbar_item_priority_set(item, 100);
 
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
    item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
    elm_toolbar_item_priority_set(item, -150);
 
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
    sl = elm_slider_add(win);
    evas_object_size_hint_min_set(sl, 100, 50);
    item = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL);
    elm_object_item_part_content_set(item, "object", sl);
 
+   elm_toolbar_item_priority_set(item, 500);
+
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
    item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
    elm_toolbar_item_priority_set(item, -200);
 
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
+   item = elm_toolbar_item_append(tb, "edit-cut", "Shrink", tb_4, ph4);
+   elm_toolbar_item_priority_set(item, -200);
+
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
+   item = elm_toolbar_item_append(tb, "edit-copy", "Mode", tb_4, ph4);
+   elm_toolbar_item_priority_set(item, -200);
+
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
+   item = elm_toolbar_item_append(tb, "edit-paste", "is set to", tb_4, ph4);
+   elm_toolbar_item_priority_set(item, -200);
+
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
+   item = elm_toolbar_item_append(tb, "edit-delete", "Menu", tb_4, ph4);
+   elm_toolbar_item_priority_set(item, 200);
+
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
+   item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
+   elm_toolbar_item_priority_set(item, 200);
+
+   elm_toolbar_item_separator_set(elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL), EINA_TRUE);
+
    item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
-   elm_toolbar_item_priority_set(item, 0);
+   elm_toolbar_item_priority_set(item, -300);
 
-   item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
-   elm_toolbar_item_menu_set(item, EINA_TRUE);
-   elm_toolbar_item_priority_set(item, -999999);
-   elm_toolbar_menu_parent_set(tb, win);
-   menu = elm_toolbar_item_menu_get(item);
+   elm_object_item_text_set(elm_toolbar_more_item_get(tb), "Open");
 
-   elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
-   menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
-   elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
-   elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4);
+   evas_object_smart_callback_add(tb, "clicked", toolbar_clicked_cb, NULL);
 
    elm_box_pack_end(bx, tb);
    evas_object_show(tb);
@@ -863,7 +910,7 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
    ph = ph1;
-   elm_photo_size_set(ph, 40);
+   elm_photo_size_set(ph, 80);
    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
    elm_photo_file_set(ph, buf);
    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -872,14 +919,14 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_show(ph);
 
    ph = ph2;
-   elm_photo_size_set(ph, 80);
+   elm_photo_size_set(ph, 160);
    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(ph, 0.5, 0.5);
    elm_table_pack(tb, ph, 1, 0, 1, 1);
    evas_object_show(ph);
 
    ph = ph3;
-   elm_photo_size_set(ph, 20);
+   elm_photo_size_set(ph, 40);
    snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
    elm_photo_file_set(ph, buf);
    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -888,7 +935,7 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_show(ph);
 
    ph = ph4;
-   elm_photo_size_set(ph, 60);
+   elm_photo_size_set(ph, 120);
    snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
    elm_photo_file_set(ph, buf);
    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
index e5b1dad..75a2093 100644 (file)
@@ -9,7 +9,7 @@ typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item;
 
 struct _Widget_Data
 {
-   Evas_Object *scr, *bx;
+   Evas_Object *scr, *bx, *more, *bx_more, *bx_more2;
    Evas_Object *menu_parent;
    Eina_Inlist *items;
    Elm_Toolbar_Item *more_item, *selected_item;
@@ -17,6 +17,7 @@ struct _Widget_Data
    Elm_Icon_Lookup_Order lookup_order;
    int icon_size;
    unsigned int item_count;
+   unsigned int item_max;
    double align;
    Elm_Object_Select_Mode select_mode;
    Eina_Bool homogeneous : 1;
@@ -35,6 +36,7 @@ struct _Elm_Toolbar_Item
    Evas_Object *icon;
    Evas_Object *object;
    Evas_Object *o_menu;
+   Evas_Object *in_box;
    Evas_Smart_Cb func;
    struct
      {
@@ -169,17 +171,26 @@ _item_select(Elm_Toolbar_Item *it)
    Widget_Data *wd = elm_widget_data_get(WIDGET(it));
    Evas_Object *obj2;
    Eina_Bool sel;
+   Evas_Coord w, h;
 
    if (!wd) return;
    if (elm_widget_item_disabled_get(it) || (it->separator) || (it->object)) return;
    sel = it->selected;
 
+   evas_object_geometry_get(it->object, NULL, NULL, &w, &h);
+
    if (wd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
      {
         if (sel)
           {
-             if (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) return;
-             _item_unselect(it);
+             if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+               if (wd->more_item == it)
+                 {
+                    edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,close", "elm");
+                    _item_unselect(it);
+                 }
+             if (wd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS)
+               _item_unselect(it);
           }
         else
           {
@@ -189,6 +200,30 @@ _item_select(Elm_Toolbar_Item *it)
 
              it->selected = EINA_TRUE;
              wd->selected_item = it;
+             if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+               {
+                  if (wd->more_item == it)
+                    {
+                       if (!evas_object_box_children_get(wd->bx_more2))
+                         edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,open", "elm");
+                       else
+                         edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,open2", "elm");
+                    }
+                  else
+                    {
+                       if (it->in_box != wd->bx)
+                         {
+                            edje_object_signal_emit(wd->VIEW(more_item), "elm,state,selected", "elm");
+                            elm_widget_signal_emit(wd->more_item->icon, "elm,state,selected", "elm");
+                         }
+                       else
+                         {
+                            edje_object_signal_emit(wd->VIEW(more_item), "elm,state,unselected", "elm");
+                            elm_widget_signal_emit(wd->more_item->icon, "elm,state,unselected", "elm");
+                         }
+                       edje_object_signal_emit(elm_layout_edje_get(wd->more), "elm,state,close", "elm");
+                    }
+               }
              edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
              elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
              _item_show(it);
@@ -537,6 +572,7 @@ _sizing_eval(Evas_Object *obj)
 //        minh = minh + (h - vh);
      }
    evas_object_resize(wd->bx, minw_bx, minh_bx);
+   evas_object_resize(wd->more, w, h);
    evas_object_size_hint_min_set(obj, minw, minh);
    evas_object_size_hint_max_set(obj, -1, -1);
 }
@@ -574,6 +610,9 @@ _toolbar_item_prio_compare_cb(const void *i1, const void *i2)
    if (!eti2) return 1;
    if (!eti1) return -1;
 
+   if (eti2->prio.priority == eti1->prio.priority)
+     return -1;
+
    return eti2->prio.priority - eti1->prio.priority;
 }
 
@@ -612,6 +651,63 @@ _fix_items_visibility(Widget_Data *wd, Evas_Coord *iw, Evas_Coord vw)
 }
 
 static void
+_fix_items_visibility_by_number(Widget_Data *wd, unsigned int *count)
+{
+   Elm_Toolbar_Item *it, *prev, *next, *max = NULL;
+   Eina_List *sorted = NULL;
+   *count = 0;
+
+   EINA_INLIST_FOREACH(wd->items, it)
+     {
+        if (it->separator)
+          {
+             prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
+             it->prio.priority = prev->prio.priority;
+          }
+     }
+
+   EINA_INLIST_FOREACH(wd->items, it)
+     {
+        sorted = eina_list_sorted_insert(sorted,
+                                         _toolbar_item_prio_compare_cb, it);
+     }
+
+   EINA_LIST_FREE(sorted, it)
+     {
+        *count += 1;
+        if(*count <= wd->item_max)
+          {
+             it->prio.visible = EINA_TRUE;
+             it->in_box = wd->bx;
+             if (*count == wd->item_max)
+               max = it;
+          }
+        else
+          {
+             it->prio.visible = EINA_FALSE;
+             if (wd->item_count < (wd->item_max * 2) ||
+                 *count <= (wd->item_count + wd->item_max) / 2)
+               it->in_box = wd->bx_more;
+             else
+               it->in_box = wd->bx_more2;
+
+             if (max)
+               {
+                  max->prio.visible = EINA_FALSE;
+                  max->in_box = wd->bx_more;
+                  next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(max)->next);
+                  if (next && next->separator)
+                    {
+                       next->prio.visible = max->prio.visible;
+                       next->in_box = max->in_box;
+                    }
+                  max = NULL;
+               }
+          }
+     }
+}
+
+static void
 _elm_toolbar_item_menu_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Elm_Toolbar_Item *it = data;
@@ -625,6 +721,7 @@ _resize_job(void *data)
    Widget_Data *wd = elm_widget_data_get(obj);
    Evas_Coord mw, mh, vw = 0, vh = 0, w = 0, h = 0;
    Elm_Toolbar_Item *it;
+   Eina_List *list;
 
    if (!wd) return;
    wd->resize_job = NULL;
@@ -748,12 +845,33 @@ _resize_job(void *data)
      }
    else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
      {
+        unsigned int count;
         if ((vw >= mw) && (vh >= mh))
           evas_object_resize(wd->bx, vw, vh);
         else if (vw < mw)
           evas_object_resize(wd->bx, mw, vh);
         else if (vh < mh)
           evas_object_resize(wd->bx, vw, mh);
+        _fix_items_visibility_by_number(wd, &count);
+
+        evas_object_box_remove_all(wd->bx, EINA_FALSE);
+        evas_object_box_remove_all(wd->bx_more, EINA_FALSE);
+        evas_object_box_remove_all(wd->bx_more2, EINA_FALSE);
+        EINA_INLIST_FOREACH(wd->items, it)
+          {
+             if (it->in_box)
+               {
+                  evas_object_box_append(it->in_box, VIEW(it));
+                  evas_object_show(VIEW(it));
+               }
+          }
+        if (count > wd->item_max)
+          {
+             evas_object_box_append(wd->bx, wd->VIEW(more_item));
+             evas_object_show(wd->VIEW(more_item));
+          }
+        else
+          evas_object_hide(wd->VIEW(more_item));
      }
    else
      {
@@ -775,6 +893,28 @@ _resize_job(void *data)
           }
      }
 
+   // Remove the first or last separator since it is not neccessary
+   list = evas_object_box_children_get(wd->bx_more);
+   EINA_INLIST_FOREACH(wd->items, it)
+     {
+        if (it->separator && ((VIEW(it) == eina_list_data_get(list)) ||
+            (VIEW(it) == eina_list_nth(list, eina_list_count(list)-1))))
+          {
+             evas_object_box_remove(wd->bx_more, VIEW(it));
+             evas_object_hide(VIEW(it));
+          }
+     }
+   list = evas_object_box_children_get(wd->bx_more2);
+   EINA_INLIST_FOREACH(wd->items, it)
+     {
+        if (it->separator && ((VIEW(it) == eina_list_data_get(list)) ||
+            (VIEW(it) == eina_list_nth(list, eina_list_count(list)-1))))
+          {
+             evas_object_box_remove(wd->bx_more2, VIEW(it));
+             evas_object_hide(VIEW(it));
+          }
+     }
+
    _mirrored_set(obj, elm_widget_mirrored_get(obj));
 }
 
@@ -789,11 +929,23 @@ static void
 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Coord x, y, h;
+   evas_object_geometry_get(data, &x, &y, NULL, &h);
+   evas_object_move(wd->more, x, y + h);
    if (!wd->resize_job)
      wd->resize_job = ecore_job_add(_resize_job, data);
 }
 
 static void
+_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Coord x, y, h;
+   evas_object_geometry_get(data, &x, &y, NULL, &h);
+   evas_object_move(wd->more, x, y + h);
+}
+
+static void
 _select_filter(Elm_Toolbar_Item *it, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
 {
    int button;
@@ -1255,6 +1407,7 @@ elm_toolbar_add(Evas_Object *parent)
 
    wd->more_item = NULL;
    wd->selected_item = NULL;
+   wd->item_max = 9999;
    wd->scr = elm_smart_scroller_add(e);
    elm_smart_scroller_widget_set(wd->scr, obj);
    elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", "default");
@@ -1266,7 +1419,6 @@ elm_toolbar_add(Evas_Object *parent)
                                  ELM_SMART_SCROLLER_POLICY_AUTO,
                                  ELM_SMART_SCROLLER_POLICY_OFF);
 
-
    wd->icon_size = _elm_toolbar_icon_size_get(wd);
 
 
@@ -1280,8 +1432,28 @@ elm_toolbar_add(Evas_Object *parent)
    elm_smart_scroller_child_set(wd->scr, wd->bx);
    evas_object_show(wd->bx);
 
+   wd->more = elm_layout_add(obj);
+   elm_layout_theme_set(wd->more, "toolbar", "more", "default");
+   elm_widget_sub_object_add(obj, wd->more);
+   evas_object_show(wd->more);
+
+   wd->bx_more = evas_object_box_add(e);
+   evas_object_size_hint_align_set(wd->bx_more, wd->align, 0.5);
+   evas_object_box_layout_set(wd->bx_more, _layout, obj, NULL);
+   elm_widget_sub_object_add(obj, wd->bx_more);
+   elm_object_part_content_set(wd->more, "elm.swallow.content", wd->bx_more);
+   evas_object_show(wd->bx_more);
+
+   wd->bx_more2 = evas_object_box_add(e);
+   evas_object_size_hint_align_set(wd->bx_more2, wd->align, 0.5);
+   evas_object_box_layout_set(wd->bx_more2, _layout, obj, NULL);
+   elm_widget_sub_object_add(obj, wd->bx_more2);
+   elm_object_part_content_set(wd->more, "elm.swallow.content2", wd->bx_more2);
+   evas_object_show(wd->bx_more2);
+
    elm_toolbar_shrink_mode_set(obj, _elm_config->toolbar_shrink_mode);
    evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj);
+   evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOVE, _move, obj);
    evas_object_event_callback_add(wd->bx, EVAS_CALLBACK_RESIZE, _resize, obj);
    elm_toolbar_icon_order_lookup_set(obj, ELM_ICON_LOOKUP_THEME_FDO);
 
@@ -1502,6 +1674,15 @@ elm_toolbar_selected_item_get(const Evas_Object *obj)
    return (Elm_Object_Item *) wd->selected_item;
 }
 
+EAPI Elm_Object_Item *
+elm_toolbar_more_item_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   return (Elm_Object_Item *) wd->more_item;
+}
+
 EAPI void
 elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon)
 {
@@ -1676,6 +1857,12 @@ elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mod
    else if (shrink_mode == ELM_TOOLBAR_SHRINK_HIDE)
      elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF,
                                    ELM_SMART_SCROLLER_POLICY_OFF);
+   else if (shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+     {
+        elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO,
+                                      ELM_SMART_SCROLLER_POLICY_OFF);
+        wd->more_item = _item_new(obj, "more_menu", "More", NULL, NULL);
+     }
    else
      elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO,
                                    ELM_SMART_SCROLLER_POLICY_OFF);
@@ -2055,6 +2242,24 @@ elm_toolbar_items_count(const Evas_Object *obj)
 }
 
 EAPI void
+elm_toolbar_items_max_set(Evas_Object *obj, unsigned int max)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   wd->item_max = max;
+}
+
+EAPI unsigned int
+elm_toolbar_items_max_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) 0;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return 0;
+   return wd->item_max;
+}
+
+EAPI void
 elm_toolbar_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
index 6b01030..3d912c6 100644 (file)
@@ -438,6 +438,19 @@ EAPI void                         elm_toolbar_item_selected_set(Elm_Object_Item
 EAPI Elm_Object_Item             *elm_toolbar_selected_item_get(const Evas_Object *obj);
 
 /**
+ * Get the more item.
+ *
+ * @param obj The toolbar object.
+ * @return The toolbar more item.
+ *
+ * The more item can be changed with function
+ * elm_object_item_text_set() and elm_object_item_content_set.
+ *
+ * @ingroup Toolbar
+ */
+EAPI Elm_Object_Item             *elm_toolbar_more_item_get(const Evas_Object *obj);
+
+/**
  * Set the icon associated with @p item.
  *
  * @param it The toolbar item.
@@ -831,7 +844,6 @@ EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_next(Elm_Object_Item *i
  */
 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_prev(Elm_Object_Item *it);
 
-
 /**
  * Change a toolbar's orientation
  * @param obj The toolbar object
@@ -859,6 +871,31 @@ EAPI Eina_Bool                    elm_toolbar_horizontal_get(const Evas_Object *
 EAPI unsigned int                 elm_toolbar_items_count(const Evas_Object *obj);
 
 /**
+ * Set the max number of visible items in a toolbar
+ * @param obj The toolbar object
+ * @param max The max number of visible items
+ *
+ * When it is the ELM_TOOLBAR_SHRINK_EXPAND mode, the items are shown only up to max number.
+ * The other items are located in more panel. The more panel can be shown when the more item is clicked.
+ *
+ * @see elm_toolbar_items_max_get()
+ *
+ * @ingroup Toolbar
+ */
+EAPI void                         elm_toolbar_items_max_set(Evas_Object *obj, unsigned int max);
+
+/**
+ * Get the max number of visible items in a toolbar
+ * @param obj The toolbar object
+ * @return The max number of items in @p obj toolbar
+ *
+ * @see elm_toolbar_items_max_set()
+ *
+ * @ingroup Toolbar
+ */
+EAPI unsigned int                 elm_toolbar_items_max_get(const Evas_Object *obj);
+
+/**
  * Set the toolbar select mode.
  *
  * @param obj The toolbar object