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