Tizen 2.0 Release
[profile/ivi/osp-web.git] / inc / FWebCtrlWebSetting.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebCtrlWebSetting.h
20  * @brief               This is the header file for the %WebSetting class.
21  *
22  * This header file contains the declarations of the %WebSetting class for a %Web control.
23  */
24 #ifndef _FWEB_CTRL_WEB_SETTING_H_
25 #define _FWEB_CTRL_WEB_SETTING_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FUiCtrlInputTypes.h>
30
31 namespace Tizen { namespace Web { namespace Controls
32 {
33 class _WebSettingImpl;
34 }}} // Tizen::Web::Control
35
36 namespace Tizen { namespace Web { namespace Controls
37 {
38
39 /**
40  * @enum CacheMode
41  *
42  * Defines the types of cache mode.
43  *
44  * @since         2.0
45  */
46 enum CacheMode
47 {
48         WEB_CACHE_VALIDATED,        /**< The use of cache data only when the cache data is valid */
49         WEB_CACHE_IGNORE            /**< The retrieval of data from a network resource without using cache data */
50 };
51
52 /**
53  * @enum CertificateErrorHandlingMode
54  *
55  * Defines the types of certification error handling mode.
56  *
57  * @since         2.0
58  */
59 enum CertificateErrorHandlingMode
60 {
61         WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM,            /**< The web certificate error handling mode: The confirm popup is displayed to get the user confirmation */
62         WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL,                 /**< The web certificate error handling mode: The confirm popup is not displayed and the request is canceled */
63         WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE                    /**< The web certificate error handling mode: The confirm popup is not displayed and the request proceeds */
64 };
65
66 /**
67  * @class               WebSetting
68  * @brief               This class holds the setting values for a %Web control.
69  *
70  * @since               2.0
71  *
72  * The %WebSetting class holds the setting values, which configure the behavior of a %Web control. An application can, for example, enable or disable JavaScript and image auto loading.
73  */
74 class _OSP_EXPORT_ WebSetting
75         : public Tizen::Base::Object
76 {
77 public:
78         /**
79          * This is the default constructor for this class.
80          *
81          * @since               2.0
82          */
83         WebSetting(void);
84
85         /**
86          * Copying of objects using this copy constructor is allowed.
87          * This is the copy constructor for the %WebSetting class. @n
88          * It creates an instance of %WebSetting with the values of the specified instance.
89          *
90          * @since               2.0
91          *
92          * @param[in] setting An instance of %WebSetting
93          */
94         WebSetting(const WebSetting& setting);
95
96         /**
97          * This destructor overrides Tizen::Base::Object::~Object().
98          *
99          * @since               2.0
100          */
101         virtual ~WebSetting(void);
102
103         /**
104         * Sets a cache control strategy for a %Web control.
105         *
106         * @since                                2.0
107         *
108         * @param[in]            mode            A cache mode
109         */
110         void SetCacheControl(CacheMode mode);
111
112         /**
113          * Sets the font size of the content.
114          *
115          * @since               2.0
116          *
117          * @param[in]   fontSize            The font size
118          */
119         void SetFontSize(int fontSize);
120
121         /**
122          * Sets the text encoding for the content of a %Web control.
123          *
124          * @since               2.0
125          *
126          * @param[in]   encoding                The text encoding
127          */
128         void SetDefaultTextEncoding(const Tizen::Base::String& encoding);
129
130         /**
131          * Enables or disables the use of JavaScript.
132          *
133          * @since               2.0
134          *
135          * @param[in]   enable      Set to @c true if the %Web control uses JavaScript, @n
136          *                                                      else @c false
137          */
138         void SetJavascriptEnabled(bool enable);
139
140         /**
141          * Decides if a %Web control loads images included in the content.
142          *
143          * @since               2.0
144          *
145          * @param[in]   enable      Set to @c true if the %Web control must load images included in the content, @n
146          *                                                      else @c false
147          */
148         void SetAutoImageLoadEnabled(bool enable);
149
150         /**
151          * Sets the input style of the keypad, which is displayed for the <input> or <textarea> tag.
152          *
153          * @since               2.0
154          *
155          * @param[in]   inputStyle      The input style of keypad
156          * @remarks             If an application sets the input style to INPUT_STYLE_OVERLAY, the application must implement IWebKeypadEventListener to rearrange the layout of the current Form.
157          *
158          */
159         void SetInputStyle(Tizen::Ui::Controls::InputStyle inputStyle);
160
161         /**
162          * Gets the value of the cache control strategy for a %Web control.
163          *
164          * @since               2.0
165          *
166          * @return              A cache mode
167          */
168         CacheMode GetCacheControl(void) const;
169
170         /**
171          * Gets the font size of the content.
172          *
173          * @since               2.0
174          *
175          * @return              The size of the font
176          */
177         int GetFontSize(void) const;
178
179         /**
180          * Gets the text encoding of the content of a %Web control.
181          *
182          * @since               2.0
183          *
184          * @return              The text encoding
185          */
186         Tizen::Base::String GetDefaultTextEncoding(void) const;
187
188         /**
189          * Checks whether a %Web control uses JavaScript. @n
190          * Returns @c true if JavaScript is enabled.
191          *
192          * @since               2.0
193          *
194          * @return              @c true if JavaScript is enabled and used by a %Web control, @n
195          *              else @c false
196          */
197         bool IsJavascriptEnabled(void) const;
198
199         /**
200          * Checks whether a %Web control loads images included in the content automatically. @n
201          * Returns @c true if auto image loading is enabled.
202          *
203          * @since               2.0
204          *
205          * @return              @c true if auto image loading is enabled, @n
206          *               else @c false
207          */
208         bool IsAutoImageLoadEnabled(void) const;
209
210         /**
211          * Gets the input style of the keypad, which is displayed for the <input> or <textarea> tag.
212          *
213          * @since               2.0
214          *
215          * @return              The input style of keypad @n
216          *                              The default value of the input style is INPUT_STYLE_FULLSCREEN.
217          */
218         Tizen::Ui::Controls::InputStyle GetInputStyle(void) const;
219
220         /**
221         * Sets a certificate error handling mode for a %Web control.
222         *
223         * @since                2.0
224         *
225         * @param[in]    mode    A certificate error handling mode
226         */
227         void SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode);
228
229         /**
230         * Gets the value of the certificate error handling mode for a %Web control.
231         *
232         * @since                2.0
233         *
234         * @return               A certificate error handling mode
235         */
236         CertificateErrorHandlingMode GetCertificateErrorHandlingMode(void) const;
237
238         /**
239          * Sets a user agent for a %Web control.
240          *
241          * @since 2.0
242          *
243          * @param[in]   agent   The user agent
244          */
245         void SetUserAgent(const Tizen::Base::String& agent);
246
247         /**
248          * Gets a value of user agent for a %Web control.
249          *
250          * @since 2.0
251          *
252          * @return              The value of user agent
253          */
254         Tizen::Base::String GetUserAgent(void) const;
255
256         /**
257          * Decides if a %Web control loads the resized contents to fit width automatically.
258          *
259          * @since 2.0
260          *
261          * @param[in]   enable  Set to @c true if the %Web control should load contents to fit width, @n
262          *                                      else @c false
263          */
264         void SetAutoFittingEnabled(bool enable);
265
266         /**
267          * Checks whether a %Web control loads the resize contents to fit width. Returns true if auto fitting is enabled.
268          *
269          * @since 2.0
270          *
271          * @return      @c true if auto fitting is enabled, @n
272          *                      else @c false
273          */
274         bool IsAutoFittingEnabled(void) const;
275
276         /**
277          * Decides if a %Web control allows JavaScript to open new window.
278          *
279          * @since 2.0
280          *
281          * @param[in]   enable  Set to @c true if the %Web control should allow JavaScript to open new window, @n
282          *                                      else @c false
283          */
284         void SetJavaScriptPopupEnabled(bool enable);
285
286         /**
287          * Checks whether a %Web control allows JavaScript to open new window. Returns true if opening new window by JavaScript is enabled.
288          *
289          * @since 2.0
290          *
291          * @return      @c true if opening new window by JavaScript is enabled, @n
292          *                      else @c false
293          */
294         bool IsJavaScriptPopupEnabled(void) const;
295
296         /**
297          * Decides if a %Web control supports html5 geolocation feature.
298          *
299          * @since 2.0
300          *
301          * @param[in]   enable  Set to @c true if the %Web control should support html5 geolocation feature, @n
302          *                                      else @c false
303          */
304         void SetGeolocationEnabled(bool enable);
305
306         /**
307          * Checks whether a %Web control supports html5 geolocation feature. Returns true if html5 geolocation feature is enabled.
308          *
309          * @since 2.0
310          *
311          * @return      @c true if html5 geolocation feature is enabled, @n
312          *                      else @c false
313          */
314         bool IsGeolocationEnabled(void) const;
315
316         /**
317          * Gets the hash value of the current instance.
318          *
319          * @since               2.0
320          *
321          * @return              The hash value of the current instance
322          */
323         virtual int GetHashCode(void) const;
324
325         /**
326          * Compares two instances of the %WebSetting class.
327          *
328          * @since               2.0
329          *
330          * @return              @c true if the two instances match, @n
331          *                              else @c false
332          * @param[in]   obj             The object to compare with the current instance
333          * @remarks             This method returns @c true if and only if the two instances contain the same elements.
334          * @see                 Tizen::Object::Equals()
335          */
336         virtual bool Equals(const Object& obj) const;
337
338         /**
339          * Copying of objects using this copy assignment operator is allowed. 
340          *
341          * @since 2.0
342          *
343          * @param[in]   setting                 The instance of the %WebSetting class to assign from
344          */
345         WebSetting& operator =(const WebSetting& setting);
346
347 private:
348         _WebSettingImpl* __pWebSettingImpl;
349
350         friend class _WebSettingImpl;
351 }; // WebSetting
352
353 }}} // Tizen::Web::Control
354 #endif // _FWEB_CTRL_WEB_SETTING_H_