Fixed privilege for web-history.admin
[profile/tv/apps/web/browser.git] / services / BookmarksUI / BookmarksUI.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 BOOKMARKSUI_H
18 #define BOOKMARKSUI_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 "BookmarkItem.h"
28
29 namespace tizen_browser{
30 namespace base_ui{
31
32 class BROWSER_EXPORT BookmarksUI
33         : public tizen_browser::interfaces::AbstractUIComponent
34         , public tizen_browser::core::AbstractService
35 {
36 public:
37     BookmarksUI();
38     ~BookmarksUI();
39     void init(Evas_Object *main_layout);
40     Evas_Object *getContent();
41     virtual std::string getName();
42     void addBookmarkItem(std::shared_ptr<tizen_browser::services::BookmarkItem>);
43     void addBookmarkItems(std::vector<std::shared_ptr<tizen_browser::services::BookmarkItem> >);
44     void removeBookmarkItem(const std::string& uri);
45     void deleteAllItems();
46     std::shared_ptr<tizen_browser::services::BookmarkItem> getSelectedBookmarkItem();
47
48
49     boost::signals2::signal<void (std::shared_ptr<tizen_browser::services::BookmarkItem>)> bookmarkClicked;
50     boost::signals2::signal<void (std::shared_ptr<tizen_browser::services::BookmarkItem>)> bookmarkDeleteClicked;
51 private:
52     static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part);
53     static void _itemSelected(void * data, Evas_Object * obj, void * event_info);
54     static void _item_deleted(void *data, Evas_Object *obj);
55     static void _thumbSelected(void * data, Evas_Object * obj, void * event_info);
56     static void _deleteBookmark(void *data, Evas_Object *obj, void *event_info);
57     void setEmptyGengrid(bool setEmpty);
58
59 private:
60     Evas_Object *m_gengrid;
61     Evas_Object *m_parent;
62     Elm_Gengrid_Item_Class * m_item_class;
63     std::map<std::string,Elm_Object_Item*> m_map_bookmark_views;
64     bool m_gengridSetup;
65     Evas_Object *createNoBookmarksLabel();
66
67     static void focusItem(void* data, Evas_Object* obj, void* event_info);
68     static void unFocusItem(void* data, Evas_Object* obj, void* event_info);
69 };
70
71
72 }
73 }
74
75 #endif // BOOKMARKSUI_H