Task TT-75 Implement "Main page loading UI" view
[profile/tv/apps/web/browser.git] / services / MainUI / MainUI.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef MAINUI_H
18 #define MAINUI_H
19
20 #include <Evas.h>
21 #include <boost/signals2/signal.hpp>
22
23 #include "AbstractUIComponent.h"
24 #include "AbstractService.h"
25 #include "ServiceFactory.h"
26 #include "service_macros.h"
27 #include "services/HistoryService/HistoryItem.h"
28 #include "BookmarkItem.h"
29
30 namespace tizen_browser{
31 namespace base_ui{
32
33 class BROWSER_EXPORT MainUI
34         : public tizen_browser::interfaces::AbstractUIComponent
35         , public tizen_browser::core::AbstractService
36 {
37 public:
38     MainUI();
39     ~MainUI();
40     void show(Evas_Object *main_layout);
41     void hide();
42     virtual std::string getName();
43     void clearHistoryGenlist();
44     void clearBookmarkGengrid();
45     void showHistoryGenlist();
46     void showBookmarkGengrid();
47     void showTopButtons();
48     void showBottomButton();
49     void clearItems();
50
51     void addHistoryItem(std::shared_ptr<tizen_browser::services::HistoryItem>);
52     void addHistoryItems(std::vector<std::shared_ptr<tizen_browser::services::HistoryItem> >);
53     void addBookmarkItem(std::shared_ptr<tizen_browser::services::BookmarkItem>);
54     void addBookmarkItems(std::vector<std::shared_ptr<tizen_browser::services::BookmarkItem> >);
55
56     boost::signals2::signal<void (std::shared_ptr<tizen_browser::services::HistoryItem>)> historyClicked;
57     boost::signals2::signal<void (const std::string & )> mostVisitedClicked;
58     boost::signals2::signal<void (const std::string & )> bookmarkClicked;
59     boost::signals2::signal<void (const std::string & )> bookmarkManagerClicked;
60 private:
61     static Evas_Object* listItemBottomContentGet(void *data, Evas_Object *obj, const char *part);
62     static Evas_Object* listTopItemContentGet(void *data, Evas_Object *obj, const char *part);
63     //static char*        listItemTextGet(void *data, Evas_Object *obj, const char *part);
64
65     static char* _grid_text_get(void *data, Evas_Object *obj, const char *part);
66     static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part);
67     static char* _grid_bookmark_text_get(void *data, Evas_Object *obj, const char *part);
68     static Evas_Object * _grid_bookmark_content_get(void *data, Evas_Object *obj, const char *part);
69     static void _itemSelected(void * data, Evas_Object * obj, void * event_info);
70     static void _item_deleted(void *data, Evas_Object *obj);
71     static void _thumbSelected(void * data, Evas_Object * obj, void * event_info);
72     static void _deleteBookmark(void *data, Evas_Object *obj, void *event_info);
73     void setEmptyGengrid(bool setEmpty);
74
75     static void _mostVisited_clicked(void * data, Evas_Object * obj, void * event_info);
76     static void _bookmark_clicked(void * data, Evas_Object * obj, void * event_info);
77     static void _bookmark_manager_clicked(void * data, Evas_Object * obj, void * event_info);
78 private:
79     Evas_Object *m_genListTop;
80     Evas_Object *m_genListMVBig;
81     Evas_Object *m_genListMVMedium;
82     Evas_Object *m_genListMVSmall;
83     Elm_Genlist_Item_Class *m_itemClassTop;
84     Evas_Object *m_genListBottom;
85     Elm_Genlist_Item_Class *m_itemClassBottom;
86     Evas_Object *m_gengrid;
87     Evas_Object *m_layout;
88     Evas_Object *m_parent;
89     Elm_Gengrid_Item_Class * m_big_item_class;
90     Elm_Gengrid_Item_Class * m_medium_item_class;
91     Elm_Gengrid_Item_Class * m_small_item_class;
92     Elm_Gengrid_Item_Class * m_bookmark_item_class;
93     std::multimap<std::string,Elm_Object_Item*> m_map_history_views;
94     std::map<std::string,Elm_Object_Item*> m_map_bookmark_views;
95     bool m_gengridSetup;
96     std::string edjFilePath;
97     Evas_Object *createNoHistoryLabel();
98
99     static void focusItem(void* data, Evas_Object* obj, void* event_info);
100     static void unFocusItem(void* data, Evas_Object* obj, void* event_info);
101 };
102
103 }
104 }
105
106 #endif // BOOKMARKSUI_H