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