Merge "[Title] Set divided selection info layout due to rotating issue." into 2.0_beta
[profile/ivi/org.tizen.browser.git] / src / browser-common-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_COMMON_VIEW_H
20 #define BROWSER_COMMON_VIEW_H
21
22 #include "browser-config.h"
23 #include "browser-data-manager.h"
24 #include "browser-utility.h"
25
26 class Browser_Data_Manager;
27 class Browser_Class;
28 class Browser_Window;
29
30 class Browser_Common_View {
31 public:
32         typedef enum _call_type {
33                 VOICE_CALL,
34                 VIDEO_CALL,
35                 CALL_UNKNOWN
36         } call_type;
37
38         Browser_Common_View(void);
39         ~Browser_Common_View(void);
40
41         Eina_Bool init(void);
42
43 #if defined(HORIZONTAL_UI)
44         Eina_Bool is_landscape(void);
45 #endif
46         Browser_Data_Manager *get_data_manager(void) { return m_data_manager; }
47         Browser_Class *get_browser(void) { return m_browser; }
48         void show_msg_popup(const char *msg, int timeout = 3);
49         void show_msg_popup(const char *title, const char *msg, int timeout);
50         void show_notify_popup(const char *msg, int timeout = 0, Eina_Bool has_control_bar = EINA_FALSE);
51         void hide_notify_popup(void);
52         void show_notify_popup_layout(const char *msg, int timeout, Evas_Object *parent);
53         void hide_notify_popup_layout(Evas_Object *parent);
54         Eina_Bool find_word_with_text(const char *text_to_find);
55 protected:
56         Evas_Object *_capture_snapshot(Browser_Window *window, float scale);
57         void _set_navigationbar_title(const char *title);
58         Eina_Bool _has_url_sheme(const char *url);
59         Eina_Bool _show_share_popup(const char *url);
60         Eina_Bool _launch_streaming_player(const char *url, const char *cookie = NULL);
61         Eina_Bool _send_via_message(std::string url, std::string to, Eina_Bool attach_file = EINA_FALSE);
62         Eina_Bool _send_via_email(std::string url, Eina_Bool attach_file = EINA_FALSE);
63         Eina_Bool _share_via_nfc(std::string url);
64         Eina_Bool _add_to_contact(std::string number);
65         Eina_Bool _check_available_sns_account(void);
66         Eina_Bool _post_to_sns(std::string sns_name, std::string url);
67         Eina_Bool _get_available_sns_list(void);
68         static bool __get_sns_list(account_h account, void *data);
69
70         /* Elementary event callback functions */
71         static void __popup_response_cb(void* data, Evas_Object* obj, void* event_info);
72         static void __send_via_email_cb(void *data, Evas_Object *obj, void *event_info);
73         static void __send_via_message_cb(void *data, Evas_Object *obj, void *event_info);
74         static void __share_via_nfc_cb(void *data, Evas_Object *obj, void *event_info);
75         static bool __check_available_sns_account_cb(account_h handle, void *data);
76         static void __post_to_sns_cb(void *data, Evas_Object *obj, void *event_info);
77         static bool __get_post_capability_cb(account_capability_type_e type,
78                                         account_capability_state_e state, void *data);
79
80         /* set focus to edit field idler callback to show ime. */
81         static Eina_Bool __set_focus_editfield_idler_cb(void *edit_field);
82
83         char *_trim(char *str);
84         /* For ug effect. */
85         static void __ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
86         static void __ug_result_cb(ui_gadget_h ug, bundle *result, void *priv);
87         static void __ug_destroy_cb(ui_gadget_h ug, void *priv);
88
89         static Browser_Data_Manager *m_data_manager;
90         static Evas_Object *m_win;
91         static Evas_Object *m_navi_bar;
92         static Evas_Object *m_bg;
93         static Browser_Class *m_browser;
94
95         std::vector<std::string> m_sns_name_list;
96         std::vector<std::string> m_sns_path_list;
97         std::vector<Evas_Object *> m_sns_icon_list;
98 private:
99         Evas_Object *m_popup;
100         Evas_Object *m_selection_info;
101         Evas_Object *m_selection_info_layout;
102         Evas_Object *m_selinfo_layout;
103         Evas_Object *m_share_popup;
104         Evas_Object *m_share_list;
105         Evas_Object *m_call_confirm_popup;
106         std::string m_share_url;
107         std::string m_tel_number;
108         call_type m_call_type;
109         ui_gadget_h m_ug;
110 };
111 #endif /* BROWSER_COMMON_VIEW_H */
112