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