Merge "[Title] Set divided selection info layout due to rotating issue." into 2.0_beta
[profile/ivi/org.tizen.browser.git] / src / browser-bookmark / browser-add-to-bookmark-view.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_ADD_TO_BOOKMARK_VIEW_H
20 #define BROWSER_ADD_TO_BOOKMARK_VIEW_H
21
22 #include "browser-common-view.h"
23 #include "browser-config.h"
24
25 class Browser_Add_To_Bookmark_View : public Browser_Common_View {
26 public:
27         Browser_Add_To_Bookmark_View(string title, string url,
28                         Eina_Bool is_edit_mode = EINA_FALSE, int current_folder_id = BROWSER_BOOKMARK_MAIN_FOLDER_ID);
29         ~Browser_Add_To_Bookmark_View(void);
30
31         Eina_Bool init(void);
32
33         void return_to_add_to_bookmark_view(int changed_folder_id);
34 private:
35         typedef enum _field_type{
36                 TITLE_EDIT_FIELD        = 0,
37                 URL_EDIT_FIELD,
38                 UNKOWN_FIELD
39         } field_type;
40
41         typedef struct _genlist_item_param {
42                 field_type type;
43                 Browser_Add_To_Bookmark_View *add_to_bookmark_view;
44         } genlist_item_param;
45
46         Eina_Bool _create_main_layout(void);
47         Evas_Object *_create_content_genlist(void);
48         Eina_Bool _save_bookmark_item(const char *title, const char *url);
49         Eina_Bool _modify_bookmark_item(const char *title, const char *url);
50
51         void _done_button_clicked(const char *title, const char* url);
52
53         /* genlist data callback functions */
54         static char *__genlist_label_get_cb(void *data, Evas_Object *obj, const char *part);
55         static Evas_Object *__genlist_icon_get_cb(void *data, Evas_Object *obj, const char *part);
56
57         /* elementary event callback functions */
58         static void __cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
59         static void __done_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
60         static void _select_folder_clicked_cb(void *data, Evas_Object *obj, void *event_info);
61         static void __title_entry_changed_cb(void *data, Evas_Object *obj, void *event_info);
62         static void __naviframe_pop_finished_cb(void *data , Evas_Object *obj, void *event_info);
63
64         Elm_Genlist_Item_Class m_edit_field_item_class;
65         Elm_Genlist_Item_Class m_seperator_item_class;
66         Elm_Genlist_Item_Class m_folder_item_class;
67         genlist_item_param m_title_param;
68         genlist_item_param m_url_param;
69
70         Evas_Object *m_genlist;
71         Evas_Object *m_conformant;
72         Evas_Object *m_title_cancel_button;
73         Evas_Object *m_title_done_button;
74         Evas_Object *m_title_edit_field;
75         Evas_Object *m_url_edit_field;
76
77         string m_title;
78         string m_url;
79         Eina_Bool m_is_edit_mode;
80         int m_folder_id_to_save;
81         int m_current_folder_id;
82
83         Elm_Object_Item* m_navi_it;
84
85         std::string m_input_title;
86         std::string m_input_url;
87 };
88 #endif /* BROWSER_ADD_TO_BOOKMARK_VIEW_H */
89