2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrlProgressPopup.h
20 * @brief This is the header file for the %ProgressPopup class.
22 * This header file contains the declarations of the %ProgressPopup class.
25 #ifndef _FUI_CTRL_PROGRESS_POPUP_H_
26 #define _FUI_CTRL_PROGRESS_POPUP_H_
29 #include <FUiCtrlPopup.h>
32 namespace Tizen { namespace Ui
34 class IProgressPopupEventListener;
38 namespace Tizen { namespace Ui { namespace Controls
41 * @class ProgressPopup
42 * @brief This class defines the common behavior of a %ProgressPopup control.
46 * The %ProgressPopup class displays processing animation to show processing status.
47 * It can contain a title, body text and cancel button.
49 * For more information on the class features,
50 * see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_progresspopup.htm">ProgressPopup</a>.
52 * @see Tizen::Ui::Window
54 * The following example demonstrates how to use the %ProgressPopup class.
57 // Sample code for ProgressPopupSample.h
60 class ProgressPopupSample
61 : public Tizen::Ui::Controls::Form
62 , public Tizen::Ui::IProgressPopupEventListener
65 ProgressPopupSample(void);
66 virtual ~ProgressPopupSample(void);
68 virtual bool Initialize(void);
69 void ShowProgressPopup(void);
70 virtual result OnInitializing(void);
71 virtual result OnTerminating(void);
72 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
74 //IProgressPopupEventListener
75 virtual void OnProgressPopupCanceled(void);
78 static const int ID_BUTTON_PROGRESSPOPUP = 501;
80 Tizen::Ui::Controls::ProgressPopup* __pProgressPopup;
85 // Sample code for ProgressPopupSample.cpp
86 #include "ProgressPopupSample.h"
88 using namespace Tizen::Ui;
89 using namespace Tizen::Ui::Controls;
90 using namespace Tizen::Graphics;
92 ProgressPopupSample::ProgressPopupSample(void)
93 : __pProgressPopup(null)
97 ProgressPopupSample::~ProgressPopupSample(void)
102 ProgressPopupSample::Initialize(void)
104 Construct(FORM_STYLE_NORMAL);
109 ProgressPopupSample::OnInitializing(void)
111 result r = E_SUCCESS;
113 // Creates an instance of ProgressPopup
114 __pProgressPopup = new (std::nothrow) ProgressPopup();
115 __pProgressPopup->Construct(true,false);
116 __pProgressPopup->SetTitleText(L"ProgressPopup Test");
117 __pProgressPopup->SetText(L"Hello World!!");
118 __pProgressPopup->AddProgressPopupEventListener(*this);
120 // Creates an instance of Button to open the ProgressPopup.
121 Button* pButtonProgressPopup = new Button();
122 pButtonProgressPopup->Construct(Rectangle(10, 10, 250, 60), L"Open ProgressPopup");
123 pButtonProgressPopup->SetActionId(ID_BUTTON_PROGRESSPOPUP);
124 pButtonProgressPopup->AddActionEventListener(*this);
130 ProgressPopupSample::OnTerminating(void)
132 result r = E_SUCCESS;
134 // Deallocates the __pProgressPopup
135 delete __pProgressPopup;
141 ProgressPopupSample::ShowProgressPopup(void)
143 __pProgressPopup->SetShowState(true);
144 __pProgressPopup->Show();
148 ProgressPopupSample::OnActionPerformed(const Control& source, int actionId)
152 case ID_BUTTON_PROGRESSPOPUP:
161 ProgressPopupSample::OnProgressPopupCanceled(void)
163 __pProgressPopup->SetShowState(false);
169 class _OSP_EXPORT_ ProgressPopup
174 * The object is not fully constructed after this constructor is called. @n
175 * For full construction, the ProgressPopup::Construct() method must be called right after calling this constructor.
182 * This destructor overrides Tizen::Base::Object::~Object().
186 virtual ~ProgressPopup(void);
189 * Initializes this instance of %ProgressPopup with the specified parameters.
192 * @return An error code
193 * @param[in] cancelButton Set to @c true if the %ProgressPopup window has a cancel button, @n
195 * @param[in] transparent Set to @c true if the %ProgressPopup window is translucent, @n
197 * @exception E_SUCCESS The method is successful.
198 * @exception E_SYSTEM A system error has occurred. @n
199 This error occurs when the internal resource is not loaded.
201 * - To show a %ProgressPopup window, call Show() or DoModal() after calling this method.
202 * - By default, the title area and the body text are not shown. @n
203 * Use SetTitleText() and SetText() to show the title area and the body text.
204 * - If @c transparent is set to true, a progress icon is only shown and a cancel button is not shown. @n
205 * Also, the texts set by %SetTitleText() and %SetText() are not shown.
206 * - If the specified @c cancelButton is set to true and ProgressPopup is closed by pressing a Cancel Button,
207 * out parameter of %DoModal(), modalResult, is @c -1.
209 result Construct(bool cancelButton, bool transparent);
212 * Sets the text of the %ProgressPopup window.
215 * @return An error code
216 * @param[in] text The text to set
217 * @exception E_SUCCESS The method is successful.
218 * @exception E_OUT_OF_MEMORY The memory is insufficient.
219 * @remarks If the %ProgressPopup window is constructed as transparent, the text is not shown.
221 result SetText(const Tizen::Base::String& text);
224 * Gets the text of the %ProgressPopup window.
228 * @return The text of the %ProgressPopup window, @n
229 * else an empty string if an error occurs
231 Tizen::Base::String GetText(void) const;
234 * Adds a listener instance @n
235 * The added listener can listen to events on the given event dispatcher's context when they are fired.
238 * @return An error code
239 * @param[in] listener The event listener to add @n Listener should be allocated at heap, not stack.
240 * @exception E_SUCCESS This method was successful.
241 * @exception E_OBJ_ALREADY_EXIST The listener was already exist.
242 * @see RemoveProgressPopupEventListener()
244 result AddProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
247 * Removes a listener instance. @n
248 * The removed listener cannot listen to events when they are fired.
251 * @return An error code
252 * @param[in] listener The event listener to remove @n
253 * The listener should be referring to previously allocated instance which is passed as an argument to
254 * AddProgressPopupEventListener().
255 * @exception E_SUCCESS This method was successful.
256 * @exception E_OBJ_NOT_FOUND The listener was not found.
258 result RemoveProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
261 * Sets the text color of the %ProgressPopup window.
264 * @param[in] color The text color
266 void SetTextColor(const Tizen::Graphics::Color& color);
269 * Gets the text color of the %ProgressPopup window.
272 * @return The color, @n
273 * else RGBA(0, 0, 0, 0) if an error occurs
275 Tizen::Graphics::Color GetTextColor(void) const;
278 friend class _ProgressPopupImpl;
282 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
284 ProgressPopup(const ProgressPopup& rhs);
287 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
289 ProgressPopup& operator =(const ProgressPopup& rhs);
294 }}} // Tizen::Ui::Controls
296 #endif // _FUI_CTRL_PROGRESS_POPUP_H_