Fixed Nabi Issues
[apps/osp/Internet.git] / inc / IntAddressbar.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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://floralicense.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 //!Internet
18 /*@file:    IntAddressbar
19  *@brief:       This class defines common behaviour of Addressbar control.
20  *
21  */
22
23 #ifndef _INT_ADDRESSBAR_H_
24 #define _INT_ADDRESSBAR_H_
25
26 #include <FApp.h>
27 #include <FGraphics.h>
28 #include <FUi.h>
29 #include <FSystem.h>
30 #include "IntIAddressbarEventListener.h"
31
32 /*enum AddressBarMode
33 {
34         ADDRESSBAR_MODE_INVALID = -1,
35         ADDRESSBAR_MODE_READER = 0,
36         ADDRESSBAR_MODE_LOADING,
37         ADDRESSBAR_MODE_LOADING_COMPLETE,
38         ADDRESSBAR_MODE_EDIT,
39 };*/
40
41 class Addressbar
42 : public Tizen::Ui::Controls::Panel
43   , public Tizen::System::IDeviceEventListener
44   , public Tizen::Ui::IActionEventListener
45   , public Tizen::Ui::IKeypadEventListener
46   , public Tizen::Ui::IFocusEventListener
47   , public Tizen::Ui::ITextEventListener
48
49   {
50   public:
51         /**
52          * @brief        This is the default constructor for this class.
53          */
54         Addressbar(void);
55
56         /**
57          * @brief        This is the default destructor for this class.
58          */
59         virtual ~Addressbar(void);
60
61         virtual result OnTerminating(void);
62
63         // IActionEventListener
64         void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
65
66         //IKeypadActionEventListener
67         void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction);
68         void OnKeypadClosed(Tizen::Ui::Control& source);
69         void OnKeypadOpened(Tizen::Ui::Control& source);
70         void OnKeypadWillOpen(Tizen::Ui::Control& source);
71         void OnKeypadBoundsChanged(Tizen::Ui::Control &source);
72
73         void OnFocusGained(const Tizen::Ui::Control& source);
74         void OnFocusLost(const Tizen::Ui::Control& source);
75
76         virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
77         virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source){}
78
79         virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state);
80
81         /**
82          * @brief        Initializes this instance of Addressbar with the specified parameters.
83          */
84         result Initialize(const Tizen::Graphics::Rectangle& rect);
85
86         /**
87          * @brief        Gets the current addressbar Mode.
88          */
89         //AddressBarMode GetAddressbarMode(void);
90
91         /**
92          * brief         To remove the Http from the Url editfield
93          */
94         Tizen::Graphics::Bitmap* GetLockedImageN(void);
95
96         /**
97          * @brief        Gets the current progress value  Addressbar control in percentage
98          */
99         int GetProgress(void);
100
101         /**
102          * @brief        Gets the currently displayed Url for the Addressbar control.
103          */
104         Tizen::Base::String GetUrl(void);
105
106         /**
107          * @brief        Event when orientationChanged
108          */
109         void OrientationChanged(int& width);
110
111         /**
112          * brief         To remove the Http from the Url editfield
113          */
114         Tizen::Base::String RemoveHttpTextFromDisplayURL(void);
115
116         /**
117          * @brief        Save the text of address bar
118          */
119         void SaveAddressbarEditText();
120
121         /**
122          * @brief        Sets the specified Url for the Addressbar control.
123          *
124          */
125         void SetUrl(const Tizen::Base::String& url);
126
127         /**
128          * @brief        ReSets the Guide Text for the Addressbar control.
129          *
130          */
131         void ResetGuideText(void);
132
133
134         /**
135          * @brief        Sets the event listener for the Addressbar control.
136          *
137          */
138         void SetAddressbarEventListener(IAddressbarEventListener* pListener);
139
140         /**
141          * @brief        Sets the current addressbar Mode.
142          */
143         //void SetAddressbarMode(AddressBarMode addMode);
144
145         /**
146          * brief         Sets the backward Button enable or disable as per the input parameter isEnabled.
147          */
148         void SetBackButtonEnabled(bool isEnabled);
149
150         /**
151          * @brief        Sets the favicon bitmap.
152          */
153         void SetFaviconBitmap(const Tizen::Graphics::Bitmap& favicon);
154
155         /**
156          * @brief        Sets the Forward Button enable or disable as per the input parameter isEnabled.
157          */
158         void SetForwardButtonEnabled(bool isEnabled);
159
160         /**
161          * @brief        Updates the favicon bitmap/image depending on browsing mode.
162          */
163         void UpdateFaviconBitmap(bool isPrivateOn);
164
165         /**
166          * @brief        Updates the progressbar Value.
167          */
168         void UpdateProgress(const int percentage);
169
170         void SetAddressbarURLFocus();
171
172         Tizen::Base::String GetAddressbarURL();
173
174         bool HasCurrentFocus(void);
175         void HideKeypad(void);
176         void OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs);
177   private:
178         /**
179          * @brief        Updates the progressbar Value.
180          */
181         void UpdateProgressBitmap(void);
182
183         //Action IDs
184         static const int IDA_REFRESH_BTN_CLICKED;
185         static const int IDA_READER_BTN_CLICKED;
186         static const int IDA_STOP_BTN_CLICKED;
187         static const int IDA_GO_BACK;
188         static const int IDA_GO_FORWARD;
189         static const int IDA_CANCEL;
190         static const int IDA_CLEAR_URL;
191
192   private:
193
194         Tizen::Base::String __displayUrl;
195         Tizen::Base::String __editTextUrl;
196
197         bool __isLoadingData;
198         bool __isLoadingCompleted;
199         bool __isClipboardOpen;
200         bool __isKeyboardConnected;
201         bool __isKeyPadOpened;
202         int __progressPercentage;
203
204         Tizen::Ui::Controls::Label* __pAddressbarBg;
205         Tizen::Ui::Controls::Panel* __pBgPanel;
206         Tizen::Ui::Controls::Button* __pClearBtn;
207         Tizen::Graphics::Bitmap* __pFavIcon;
208         Tizen::Ui::Controls::Label* __pFaviconLabel;
209         Tizen::Ui::Controls::Label* __pLabelPrivateOn;
210         IAddressbarEventListener* __pListener;
211         Tizen::Ui::Controls::Label* __pPrivateIconLabel;
212         Tizen::Ui::Controls::Label* __pProgressbarLabel;
213         Tizen::Ui::Controls::Label* __pSearchLabel;
214         Tizen::Ui::Controls::EditField* __pAddressbarUrlField;
215         Tizen::Ui::Controls::Label* __pToolBarLabel;
216         Tizen::Ui::Controls::Label* __pAddressbarURLLabel;
217         Tizen::Ui::Controls::Button* __pAddressBackBtn;
218         bool __isAppBackGround;
219   };
220
221 #endif /* _INT_ADDRESSBAR_H_ */