2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_progresspopup.htm">ProgressPopup</a>.
51 * @see Tizen::Ui::Window
53 * The following example demonstrates how to use the %ProgressPopup class.
56 // Sample code for ProgressPopupSample.h
59 class ProgressPopupSample
60 : public Tizen::Ui::Controls::Form
61 , public Tizen::Ui::IProgressPopupEventListener
64 ProgressPopupSample(void);
65 virtual ~ProgressPopupSample(void);
67 virtual bool Initialize(void);
68 void ShowProgressPopup(void);
69 virtual result OnInitializing(void);
70 virtual result OnTerminating(void);
71 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
73 //IProgressPopupEventListener
74 virtual void OnProgressPopupCanceled(void);
77 static const int ID_BUTTON_PROGRESSPOPUP = 501;
79 Tizen::Ui::Controls::ProgressPopup* __pProgressPopup;
84 // Sample code for ProgressPopupSample.cpp
85 #include "ProgressPopupSample.h"
87 using namespace Tizen::Ui;
88 using namespace Tizen::Ui::Controls;
89 using namespace Tizen::Graphics;
91 ProgressPopupSample::ProgressPopupSample(void)
92 : __pProgressPopup(null)
96 ProgressPopupSample::~ProgressPopupSample(void)
101 ProgressPopupSample::Initialize(void)
103 Construct(FORM_STYLE_NORMAL);
108 ProgressPopupSample::OnInitializing(void)
110 result r = E_SUCCESS;
112 // Creates an instance of ProgressPopup
113 __pProgressPopup = new (std::nothrow) ProgressPopup();
114 __pProgressPopup->Construct(true,false);
115 __pProgressPopup->SetTitleText(L"ProgressPopup Test");
116 __pProgressPopup->SetText(L"Hello World!!");
117 __pProgressPopup->AddProgressPopupEventListener(*this);
119 // Creates an instance of Button to open the ProgressPopup.
120 Button* pButtonProgressPopup = new Button();
121 pButtonProgressPopup->Construct(Rectangle(10, 10, 250, 60), L"Open ProgressPopup");
122 pButtonProgressPopup->SetActionId(ID_BUTTON_PROGRESSPOPUP);
123 pButtonProgressPopup->AddActionEventListener(*this);
129 ProgressPopupSample::OnTerminating(void)
131 result r = E_SUCCESS;
133 // Deallocates the __pProgressPopup
134 delete __pProgressPopup;
140 ProgressPopupSample::ShowProgressPopup(void)
142 __pProgressPopup->SetShowState(true);
143 __pProgressPopup->Show();
147 ProgressPopupSample::OnActionPerformed(const Control& source, int actionId)
151 case ID_BUTTON_PROGRESSPOPUP:
160 ProgressPopupSample::OnProgressPopupCanceled(void)
162 __pProgressPopup->SetShowState(false);
168 class _OSP_EXPORT_ ProgressPopup
173 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
180 * This destructor overrides Tizen::Base::Object::~Object().
184 virtual ~ProgressPopup(void);
187 * Initializes this instance of %ProgressPopup with the specified parameters.
190 * @return An error code
191 * @param[in] cancelButton Set to @c true if the %ProgressPopup window has a cancel button, @n
193 * @param[in] translucent Set to @c true if the %ProgressPopup window is translucent, @n
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_SYSTEM A system error has occurred. @n
197 This error occurs when the internal resource is not loaded.
198 * @remarks To show a %ProgressPopup window, call Show() or DoModal() after calling the Construct() method. @n
199 * By default, the title area and the body text are not shown. @n
200 * Use SetTitleText() and SetText() to show the title area and the body text.
201 * @remarks If @c transparent is set to true, a progress icon is only shown and a cancel button is not shown. @n
202 * Also, the texts set by SetTitleText() and SetText() are not shown.
203 * @remarks If the specified @c cancelButton is set to true and ProgressPopup is closed by pressing a Cancel Button,
204 * out parameter of DoModal(), modalResult, is @c -1.
206 result Construct(bool cancelButton, bool transparent);
209 * Sets the text of the %ProgressPopup window.
212 * @return An error code
213 * @param[in] text The text to set
214 * @exception E_SUCCESS The method is successful.
215 * @exception E_OUT_OF_MEMORY The memory is insufficient.
216 * @remarks If the %ProgressPopup window is constructed as transparent, the text is not shown.
218 result SetText(const Tizen::Base::String& text);
221 * Gets the text of the %ProgressPopup window.
225 * @return The text of the %ProgressPopup window, @n
226 * else an empty string if an error occurs
228 Tizen::Base::String GetText(void) const;
231 * Adds a listener instance @n
232 * The added listener can listen to events on the given event dispatcher's context when they are fired.
235 * @return An error code
236 * @param[in] listener The event listener to add @n Listener should be allocated at heap, not stack.
237 * @exception E_SUCCESS This method was successful.
238 * @exception E_OBJ_ALREADY_EXIST The listener was already exist.
240 result AddProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
243 * Removes a listener instance. @n
244 * The removed listener cannot listen to events when they are fired.
247 * @return An error code
248 * @param[in] listener The event listener to remove @n
249 * Listener should be referring to previously allocated instance which is passed as an argument to AddProgressPopupEventListener.
250 * @exception E_SUCCESS This method was successful.
251 * @exception E_OBJ_NOT_FOUND The listener was not found.
253 result RemoveProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
256 * Sets the text color of the %ProgressPopup window.
259 * @param[in] color The text color
261 void SetTextColor(const Tizen::Graphics::Color& color);
264 * Gets the text color of the %ProgressPopup window.
267 * @return The color, @n
268 * else RGBA(0, 0, 0, 0) if an error occurs
270 Tizen::Graphics::Color GetTextColor(void) const;
273 friend class _ProgressPopupImpl;
277 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
279 ProgressPopup(const ProgressPopup& rhs);
282 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
284 ProgressPopup& operator =(const ProgressPopup& rhs);
289 }}} // Tizen::Ui::Controls
291 #endif // _FUI_CTRL_PROGRESS_POPUP_H_