Remove unneeded genlist from top buttons. 59/45959/7 new_ui
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Mon, 17 Aug 2015 13:03:27 +0000 (15:03 +0200)
committerJanusz Majnert <j.majnert@samsung.com>
Mon, 17 Aug 2015 13:44:54 +0000 (06:44 -0700)
[Issue#] https://bugs.tizen.org/jira/browse/TT-73
[Problem] Uneeded genlist caused scrolling of top buttons.
[Cause] N/A
[Solution] Removed genlist.
[Verify] Check if buttons "Most visited" and "Bookmarks" work.

Change-Id: I044d8502be38d55fe7ce9b44c1674f3cf155922c
Signed-off-by: Maciej Skrzypkowski <m.skrzypkows@samsung.com>
services/MainUI/MainUI.cpp
services/MainUI/MainUI.h
services/MainUI/edc/MainUI.edc

index 173e306..c6feff8 100644 (file)
@@ -53,10 +53,15 @@ struct ItemData{
 };
 
 MainUI::MainUI()
-    : m_gengrid(nullptr)
-    , m_genListTop(nullptr)
+    : m_parent(nullptr)
+    , m_layout(nullptr)
+    , m_layoutTop(nullptr)
+    , m_gengrid(nullptr)
+    , m_genListLeft(nullptr)
+    , m_genListCenter(nullptr)
+    , m_genListRight(nullptr)
     , m_genListBottom(nullptr)
-    , m_parent(nullptr)
+    , m_itemClassBottom(nullptr)
     , m_big_item_class(nullptr)
     , m_small_item_class(nullptr)
     , m_bookmark_item_class(nullptr)
@@ -164,49 +169,25 @@ void MainUI::show(Evas_Object* parent)
 void MainUI::showTopButtons()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-    elm_theme_extension_add(nullptr, edjFilePath.c_str());
-    m_genListTop = elm_genlist_add(m_layout);
-    elm_object_part_content_set(m_layout, "elm.swallow.genlistTop", m_genListTop);
-    elm_genlist_homogeneous_set(m_genListTop, EINA_FALSE);
-    elm_genlist_multi_select_set(m_genListTop, EINA_FALSE);
-    elm_genlist_select_mode_set(m_genListTop, ELM_OBJECT_SELECT_MODE_ALWAYS);
-    elm_genlist_mode_set(m_genListTop, ELM_LIST_LIMIT);
-    //elm_genlist_decorate_mode_set(m_genListTop, EINA_TRUE);
-    evas_object_size_hint_weight_set(m_genListTop, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
-    /*evas_object_smart_callback_add(m_genList, "item,focused", focusItem, this);
-    evas_object_smart_callback_add(m_genList, "item,unfocused", unFocusItem, nullptr);*/
+    m_layoutTop = elm_layout_add(m_layout);
 
-    m_itemClassTop = elm_genlist_item_class_new();
-    m_itemClassTop->item_style = "top_button_item";
-    m_itemClassTop->func.text_get = nullptr; // &listTopItemTextGet;
-    m_itemClassTop->func.content_get = &listTopItemContentGet;
-    m_itemClassTop->func.state_get = 0;
-    m_itemClassTop->func.del = 0;
+    elm_layout_file_set(m_layoutTop, edjFilePath.c_str(), "top_button_item");
+    evas_object_size_hint_weight_set(m_layoutTop, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(m_layoutTop, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    evas_object_show(m_layoutTop);
 
-    ItemData * id = new ItemData;
-    id->mainUI = this;
-    Elm_Object_Item* elmItem = elm_genlist_item_append(m_genListTop,            //genlist
-                                                       m_itemClassTop,          //item Class
-                                                      id,
-                                                      nullptr,                    //parent item
-                                                      ELM_GENLIST_ITEM_NONE,//item type
-                                                      nullptr,
-                                                      nullptr                  //data passed to above function
-                                                     );
-    id->e_item = elmItem;
-    ItemData * id2 = new ItemData;
-    id2->mainUI = this;
-    Elm_Object_Item* elmItem2 = elm_genlist_item_append(m_genListTop,            //genlist
-                                                       m_itemClassTop,          //item Class
-                                                      id2,
-                                                      nullptr,                    //parent item
-                                                      ELM_GENLIST_ITEM_NONE,//item type
-                                                      nullptr,
-                                                      nullptr                  //data passed to above function
-                                                     );
-    id2->e_item = elmItem2;
-    BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+    Evas_Object *mvButton = elm_button_add(m_layoutTop);
+    elm_object_style_set(mvButton, "invisible_button");
+    evas_object_smart_callback_add(mvButton, "clicked", tizen_browser::base_ui::MainUI::_mostVisited_clicked, this);
+    elm_layout_content_set(m_layoutTop, "mostvisited_click", mvButton);
+
+    Evas_Object *bmButton = elm_button_add(m_layoutTop);
+    elm_object_style_set(bmButton, "invisible_button");
+    evas_object_smart_callback_add(bmButton, "clicked", tizen_browser::base_ui::MainUI::_bookmark_clicked, this);
+    elm_layout_content_set(m_layoutTop, "bookmark_click", bmButton);
+
+    elm_object_part_content_set(m_layout, "elm.swallow.genlistTop", m_layoutTop);
 }
 
 void MainUI::showBottomButton()
@@ -244,38 +225,18 @@ void MainUI::showBottomButton()
     id->e_item = elmItem;
 }
 
-Evas_Object* MainUI::listTopItemContentGet(void* data, Evas_Object* obj, const char* part)
-{
-        BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-        if(!strcmp(part, "mostvisited_click"))
-        {
-                Evas_Object *mvButton = elm_button_add(obj);
-                elm_object_style_set(mvButton, "invisible_button");
-                evas_object_smart_callback_add(mvButton, "clicked", tizen_browser::base_ui::MainUI::_mostVisited_clicked, data);
-                return mvButton;
-        }
-        else if(!strcmp(part, "bookmark_click"))
-        {
-               Evas_Object *bmButton = elm_button_add(obj);
-                elm_object_style_set(bmButton, "invisible_button");
-                evas_object_smart_callback_add(bmButton, "clicked", tizen_browser::base_ui::MainUI::_bookmark_clicked, data);
-               return bmButton;
-       }
-        return nullptr;
-}
-
 void MainUI::_mostVisited_clicked(void * data, Evas_Object * /* obj */, void * event_info)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-       ItemData* itemData = reinterpret_cast<ItemData *>(data);
-       itemData->mainUI->mostVisitedClicked(std::string());
+    MainUI* mainUI = reinterpret_cast<MainUI *>(data);
+    mainUI->mostVisitedClicked(std::string());
 }
 
 void MainUI::_bookmark_clicked(void * data, Evas_Object * /* obj */, void * event_info)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-       ItemData* itemData = reinterpret_cast<ItemData *>(data);
-       itemData->mainUI->bookmarkClicked(std::string());
+    MainUI* mainUI = reinterpret_cast<MainUI *>(data);
+    mainUI->bookmarkClicked(std::string());
 }
 
 void MainUI::_bookmark_manager_clicked(void * data, Evas_Object * /* obj */, void * event_info)
@@ -501,7 +462,6 @@ void MainUI::clearItems()
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     clearHistoryGenlist();
     clearBookmarkGengrid();
-    elm_genlist_clear(m_genListTop);
     elm_genlist_clear(m_genListBottom);
 }
 
index bd77d53..c62a301 100644 (file)
@@ -76,16 +76,15 @@ private:
     static void _bookmark_clicked(void * data, Evas_Object * obj, void * event_info);
     static void _bookmark_manager_clicked(void * data, Evas_Object * obj, void * event_info);
 private:
-    Evas_Object *m_genListTop;
+    Evas_Object *m_parent;
+    Evas_Object *m_layout;
+    Evas_Object *m_layoutTop;
+    Evas_Object *m_gengrid;
     Evas_Object *m_genListLeft;
     Evas_Object *m_genListCenter;
     Evas_Object *m_genListRight;
-    Elm_Genlist_Item_Class *m_itemClassTop;
     Evas_Object *m_genListBottom;
     Elm_Genlist_Item_Class *m_itemClassBottom;
-    Evas_Object *m_gengrid;
-    Evas_Object *m_layout;
-    Evas_Object *m_parent;
     Elm_Gengrid_Item_Class * m_big_item_class;
     Elm_Gengrid_Item_Class * m_small_item_class;
     Elm_Gengrid_Item_Class * m_bookmark_item_class;
index f094d4e..a81e52a 100644 (file)
@@ -967,7 +967,7 @@ group { name: "elm/gengrid/item/grid_item/default";
        }
 }
 
-group { name: "elm/genlist/item/top_button_item/default";
+group { name: "top_button_item";
         min: 1920 181;
         max: 1920 181;
         data.item: "texts" "mostvisited_text bookmark_text";
@@ -1045,8 +1045,6 @@ group { name: "elm/genlist/item/top_button_item/default";
                     visible: 1;
                     align: 0 0;
                     fixed: 1 1;
-                    min: 348 64;
-                    max: 348 64;
                     rel1 { relative: 0.0 0.0; to: "mostvisited_button";}
                     rel2 { relative: 1.0 1.0; to: "mostvisited_button";}
                     color_class: transparent;
@@ -1062,8 +1060,6 @@ group { name: "elm/genlist/item/top_button_item/default";
                     visible: 1;
                     align: 0 0;
                     fixed: 1 1;
-                    min: 348 64;
-                    max: 348 64;
                     rel1 { relative: 0.0 0.0; to: "mostvisited_button";}
                     rel2 { relative: 1.0 1.0; to: "mostvisited_button";}
                 }
@@ -1125,8 +1121,6 @@ group { name: "elm/genlist/item/top_button_item/default";
                     visible: 1;
                     align: 0 0;
                     fixed: 1 1;
-                    min: 348 64;
-                    max: 348 64;
                     rel1 { relative: 0.0 0.0; to: "bookmark_button";}
                     rel2 { relative: 1.0 1.0; to: "bookmark_button";}
                     color_class: transparent;
@@ -1142,10 +1136,8 @@ group { name: "elm/genlist/item/top_button_item/default";
                     visible: 1;
                     align: 0 0;
                     fixed: 1 1;
-                    min: 348 64;
-                    max: 348 64;
-                    rel1 { relative: 0.0 0.0; to: "bookmark_over";}
-                    rel2 { relative: 1.0 1.0; to: "bookmark_over";}
+                    rel1 { relative: 0.0 0.0; to: "bookmark_button";}
+                    rel2 { relative: 1.0 1.0; to: "bookmark_button";}
                     color_class: transparent;
                 }
             }