[Title] Initial upload the browser for tizen 2.0
[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_searchbar_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_delete_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
81         static void __delete_confirm_response_by_edit_mode_cb(void *data, Evas_Object *obj, void *event_info);
82         static void __delete_confirm_response_by_slide_button_cb(void *data, Evas_Object *obj, void *event_info);
83         static void __cancel_confirm_response_by_slide_button_cb(void *data, Evas_Object *obj, void *event_info);
84         static void __select_processing_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
85         static void __delete_processing_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
86         static void __search_delay_changed_cb(void *data, Evas_Object *obj, void *event_info);
87
88         static void __bookmark_on_off_icon_clicked_cb(void* data, Evas* evas, Evas_Object* obj, void* ev);
89
90         /* evas object event callback functions */
91         static void __edit_mode_select_all_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
92
93         /* genlist callback functions. */
94         static char *__genlist_label_get_cb(void *data, Evas_Object *obj, const char *part);
95         static char *__genlist_date_label_get_cb(void *data, Evas_Object *obj, const char *part);
96         static Evas_Object *__genlist_icon_get_cb(void *data, Evas_Object *obj, const char *part);
97
98         /* ecore timer callback functions */
99         static Eina_Bool __select_processing_popup_timer_cb(void *data);
100         static Eina_Bool __delete_processing_popup_timer_cb(void *data);
101
102         history_date_param m_date_param;
103         Elm_Genlist_Item_Class m_history_genlist_item_class;
104         Elm_Genlist_Item_Class m_history_group_title_class;
105
106         Elm_Object_Item *m_current_sweep_item;
107
108         Evas_Object *m_searchbar_layout;
109         Evas_Object *m_searchbar;
110         Evas_Object *m_history_genlist;
111         Evas_Object *m_searched_history_genlist;
112         Evas_Object *m_no_content_search_result;
113         Evas_Object *m_content_box;
114         Evas_Object *m_edit_mode_select_all_layout;
115         Evas_Object *m_edit_mode_select_all_check_button;
116         Evas_Object *m_no_history_label;
117
118         vector<Browser_History_DB::history_item *> m_history_list;
119         vector<char *> m_history_date_label_list;
120         vector<Browser_History_DB::history_item *> m_searched_history_item_list;
121         vector<char *> m_searched_history_date_label_list;
122         Date m_last_date;
123
124         /* For select all processing popup. */
125         Evas_Object *m_processing_progress_bar;
126         Ecore_Timer *m_processing_popup_timer;
127         Elm_Object_Item *m_processed_it;
128         int m_processed_count;
129         Evas_Object *m_processing_popup;
130         Evas_Object *m_processing_popup_layout;
131         Eina_Bool m_select_all_check_value;
132         int m_total_item_count;
133
134         Evas_Object *m_delete_confirm_popup;
135         Eina_Bool m_is_bookmark_on_off_icon_clicked;
136 };
137 #endif /* BROWSER_HISTORY_LAYOUT_H */
138