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.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://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         // IActionEventListener
62         void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
63
64         //IKeypadActionEventListener
65         void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction);
66         void OnKeypadClosed(Tizen::Ui::Control& source);
67         void OnKeypadOpened(Tizen::Ui::Control& source);
68         void OnKeypadWillOpen(Tizen::Ui::Control& source);
69         void OnKeypadBoundsChanged(Tizen::Ui::Control &source);
70
71         void OnFocusGained(const Tizen::Ui::Control& source);
72         void OnFocusLost(const Tizen::Ui::Control& source);
73
74         virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
75         virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source){}
76
77         virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state);
78
79         /**
80          * @brief        Initializes this instance of Addressbar with the specified parameters.
81          */
82         result Initialize(const Tizen::Graphics::Rectangle& rect);
83
84         /**
85          * @brief        Gets the current addressbar Mode.
86          */
87         //AddressBarMode GetAddressbarMode(void);
88
89         /**
90          * brief         To remove the Http from the Url editfield
91          */
92         Tizen::Graphics::Bitmap* GetLockedImageN(void);
93
94         /**
95          * @brief        Gets the current progress value  Addressbar control in percentage
96          */
97         int GetProgress(void);
98
99         /**
100          * @brief        Gets the currently displayed Url for the Addressbar control.
101          */
102         Tizen::Base::String GetUrl(void);
103
104         /**
105          * @brief        Event when orientationChanged
106          */
107         void OrientationChanged(int& width);
108
109         /**
110          * brief         To remove the Http from the Url editfield
111          */
112         Tizen::Base::String RemoveHttpTextFromDisplayURL(void);
113
114         /**
115          * @brief        Save the text of address bar
116          */
117         void SaveAddressbarEditText();
118
119         /**
120          * @brief        Sets the specified Url for the Addressbar control.
121          *
122          */
123         void SetUrl(const Tizen::Base::String& url);
124
125         /**
126          * @brief        ReSets the Guide Text for the Addressbar control.
127          *
128          */
129         void ResetGuideText(void);
130
131
132         /**
133          * @brief        Sets the event listener for the Addressbar control.
134          *
135          */
136         void SetAddressbarEventListener(IAddressbarEventListener* pListener);
137
138         /**
139          * @brief        Sets the current addressbar Mode.
140          */
141         //void SetAddressbarMode(AddressBarMode addMode);
142
143         /**
144          * brief         Sets the backward Button enable or disable as per the input parameter isEnabled.
145          */
146         void SetBackButtonEnabled(bool isEnabled);
147
148         /**
149          * @brief        Sets the favicon bitmap.
150          */
151         void SetFaviconBitmap(const Tizen::Graphics::Bitmap& favicon);
152
153         /**
154          * @brief        Sets the Forward Button enable or disable as per the input parameter isEnabled.
155          */
156         void SetForwardButtonEnabled(bool isEnabled);
157
158         /**
159          * @brief        Updates the favicon bitmap/image depending on browsing mode.
160          */
161         void UpdateFaviconBitmap(bool isPrivateOn);
162
163         /**
164          * @brief        Updates the progressbar Value.
165          */
166         void UpdateProgress(const int percentage);
167
168         void SetAddressbarURLFocus();
169
170         Tizen::Base::String GetAddressbarURL();
171   private:
172         /**
173          * @brief        Updates the progressbar Value.
174          */
175         void UpdateProgressBitmap(void);
176
177         //Action IDs
178         static const int IDA_REFRESH_BTN_CLICKED;
179         static const int IDA_READER_BTN_CLICKED;
180         static const int IDA_STOP_BTN_CLICKED;
181         static const int IDA_GO_BACK;
182         static const int IDA_GO_FORWARD;
183         static const int IDA_CANCEL;
184         static const int IDA_CLEAR_URL;
185
186   private:
187         //AddressBarMode __currentAddMode;
188         Tizen::Base::String __displayUrl;
189         Tizen::Base::String __editTextUrl;
190
191         bool __isLoadingData;
192         bool __isLoadingCompleted;
193         bool __isClipboardOpen;
194         bool __isKeyboardConnected;
195         bool __isCancelledClicked;
196         int __progressPercentage;
197
198         Tizen::Ui::Controls::Label* __pAddressbarBg;
199         Tizen::Ui::Controls::Panel* __pBgPanel;
200         //Tizen::Ui::Controls::Button* __pCancelBtn;
201         Tizen::Ui::Controls::Button* __pClearBtn;
202         Tizen::Graphics::Bitmap* __pFavIcon;
203         Tizen::Ui::Controls::Label* __pFaviconLabel;
204         //Tizen::Ui::Controls::Button* __pGoBackBtn;
205 //      Tizen::Ui::Controls::Button* __pGoForwardBtn;
206         Tizen::Ui::Controls::Label* __pLabelPrivateOn;
207         IAddressbarEventListener* __pListener;
208         Tizen::Ui::Controls::Label* __pPrivateIconLabel;
209         Tizen::Ui::Controls::Label* __pProgressbarLabel;
210 //      Tizen::Ui::Controls::Button* __pReaderBtn;
211 //      Tizen::Ui::Controls::Button* __pRefreshBtn;
212         Tizen::Ui::Controls::Button* __pStopBtn;
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   };
219
220 #endif /* _INT_ADDRESSBAR_H_ */