[Title] Set separator between list items.
[profile/ivi/org.tizen.browser.git] / src / browser-history / browser-history-layout.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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
18
19 #ifndef BROWSER_HISTORY_LAYOUT_H
20 #define BROWSER_HISTORY_LAYOUT_H
21
22 #include "browser-common-view.h"
23 #include "browser-config.h"
24 #include "browser-history-db.h"
25 #include "browser-bookmark-view.h"
26
27 class Date {
28 public:
29         int year;
30         int month;
31         int day;
32
33         Date();
34         Date(Date &date);
35         void operator=(Date &date);
36         bool operator==(Date &date);
37         bool operator!=(Date &date);
38 };
39
40 class Browser_History_Layout : public Browser_Common_View {
41         friend class Browser_Bookmark_View;
42 public:
43         Browser_History_Layout(void);
44         ~Browser_History_Layout(void);
45
46         Eina_Bool init(void);
47         Evas_Object *get_main_layout(void) { return m_sub_main_history_layout; }
48 protected:
49         void _set_edit_mode(Eina_Bool edit_mode);
50
51 private:
52         typedef struct _history_date_param {
53                 Date date;
54                 Browser_History_Layout *history_layout;
55         } history_date_param;
56
57         Eina_Bool _create_main_layout(void);
58         Evas_Object *_create_history_genlist(void);
59         void _reload_history_genlist(void);
60         void _show_selection_info(void);
61         void _delete_selected_history(void);
62         Evas_Object *_show_delete_confirm_popup(void);
63         void _delete_history_item_by_slide_button(Browser_History_DB::history_item *item);
64         void _show_select_processing_popup(void);
65         void _show_delete_processing_popup(void);
66         void _enable_searchbar_layout(Eina_Bool enable);
67         Eina_Bool _show_searched_history(const char *search_text);
68         void _delete_date_only_label_genlist_item(void);
69
70         /* elementary event callback functions. */
71 #if defined(GENLIST_SWEEP)
72         static void __sweep_left_genlist_cb(void *data, Evas_Object *obj, void *event_info);
73         static void __sweep_right_genlist_cb(void *data, Evas_Object *obj, void *event_info);
74         static void __sweep_cancel_genlist_cb(void *data, Evas_Object *obj, void *event_info);
75 #endif
76         static void __history_item_clicked_cb(void *data, Evas_Object *obj, void *eventInfo);
77         static void __edit_mode_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
78         static void __edit_mode_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
79         static void __slide_add_to_bookmark_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
80         static void __slide_share_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
81         static void __slide_delete_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
82         static void __delete_confirm_response_by_edit_mode_cb(void *data, Evas_Object *obj, void *event_info);
83         static void __delete_confirm_response_by_slide_button_cb(void *data, Evas_Object *obj, void *event_info);
84         static void __cancel_confirm_response_by_slide_button_cb(void *data, Evas_Object *obj, void *event_info);
85         static void __select_processing_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
86         static void __delete_processing_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
87         static void __search_delay_changed_cb(void *data, Evas_Object *obj, void *event_info);
88
89         static void __bookmark_on_off_icon_clicked_cb(void* data, Evas* evas, Evas_Object* obj, void* ev);
90
91         /* evas object event callback functions */
92         static void __edit_mode_select_all_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
93
94         /* genlist callback functions. */
95         static char *__genlist_label_get_cb(void *data, Evas_Object *obj, const char *part);
96         static char *__genlist_date_label_get_cb(void *data, Evas_Object *obj, const char *part);
97         static Evas_Object *__genlist_icon_get_cb(void *data, Evas_Object *obj, const char *part);
98
99         /* ecore timer callback functions */
100         static Eina_Bool __select_processing_popup_timer_cb(void *data);
101         static Eina_Bool __delete_processing_popup_timer_cb(void *data);
102
103         history_date_param m_date_param;
104         Elm_Genlist_Item_Class m_history_genlist_item_class;
105         Elm_Genlist_Item_Class m_history_group_title_class;
106
107         Elm_Object_Item *m_current_sweep_item;
108
109         Evas_Object *m_sub_main_history_layout;
110         Evas_Object *m_searchbar_layout;
111         Evas_Object *m_searchbar;
112         Evas_Object *m_history_genlist;
113         Evas_Object *m_searched_history_genlist;
114         Evas_Object *m_no_content_search_result;
115         Evas_Object *m_content_box;
116         Evas_Object *m_edit_mode_select_all_layout;
117         Evas_Object *m_edit_mode_select_all_check_button;
118         Evas_Object *m_no_history_label;
119
120         vector<Browser_History_DB::history_item *> m_history_list;
121         vector<char *> m_history_date_label_list;
122         vector<Browser_History_DB::history_item *> m_searched_history_item_list;
123         vector<char *> m_searched_history_date_label_list;
124         Date m_last_date;
125
126         /* For select all processing popup. */
127         Evas_Object *m_processing_progress_bar;
128         Ecore_Timer *m_processing_popup_timer;
129         Elm_Object_Item *m_processed_it;
130         int m_processed_count;
131         Evas_Object *m_processing_popup;
132         Evas_Object *m_processing_popup_layout;
133         Eina_Bool m_select_all_check_value;
134         int m_total_item_count;
135
136         Evas_Object *m_delete_confirm_popup;
137         Eina_Bool m_is_bookmark_on_off_icon_clicked;
138 };
139 #endif /* BROWSER_HISTORY_LAYOUT_H */
140