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
63 , public Tizen::Ui::IActionEventListener
66 ProgressPopupSample(void);
67 virtual ~ProgressPopupSample(void);
69 virtual bool Initialize(void);
70 void ShowProgressPopup(void);
71 virtual result OnInitializing(void);
72 virtual result OnTerminating(void);
73 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
75 //IProgressPopupEventListener
76 virtual void OnProgressPopupCanceled(void);
79 static const int ID_BUTTON_PROGRESSPOPUP = 501;
81 Tizen::Ui::Controls::ProgressPopup* __pProgressPopup;
86 // Sample code for ProgressPopupSample.cpp
87 #include "ProgressPopupSample.h"
89 using namespace Tizen::Ui;
90 using namespace Tizen::Ui::Controls;
91 using namespace Tizen::Graphics;
93 ProgressPopupSample::ProgressPopupSample(void)
94 : __pProgressPopup(null)
98 ProgressPopupSample::~ProgressPopupSample(void)
103 ProgressPopupSample::Initialize(void)
105 Construct(FORM_STYLE_NORMAL);
110 ProgressPopupSample::OnInitializing(void)
112 result r = E_SUCCESS;
114 // Creates an instance of ProgressPopup
115 __pProgressPopup = new (std::nothrow) ProgressPopup();
116 __pProgressPopup->Construct(true,false);
117 __pProgressPopup->SetTitleText(L"ProgressPopup Test");
118 __pProgressPopup->SetText(L"Hello World!!");
119 __pProgressPopup->AddProgressPopupEventListener(*this);
121 // Creates an instance of Button to open the ProgressPopup.
122 Button* pButtonProgressPopup = new Button();
123 pButtonProgressPopup->Construct(Rectangle(50, 50, 350, 100), L"Open ProgressPopup");
124 pButtonProgressPopup->SetActionId(ID_BUTTON_PROGRESSPOPUP);
125 pButtonProgressPopup->AddActionEventListener(*this);
126 AddControl(pButtonProgressPopup);
132 ProgressPopupSample::OnTerminating(void)
134 result r = E_SUCCESS;
136 // Deallocates the __pProgressPopup
137 delete __pProgressPopup;
143 ProgressPopupSample::ShowProgressPopup(void)
145 __pProgressPopup->SetShowState(true);
146 __pProgressPopup->Show();
150 ProgressPopupSample::OnActionPerformed(const Control& source, int actionId)
154 case ID_BUTTON_PROGRESSPOPUP:
163 ProgressPopupSample::OnProgressPopupCanceled(void)
165 __pProgressPopup->SetShowState(false);
171 class _OSP_EXPORT_ ProgressPopup
176 * The object is not fully constructed after this constructor is called. @n
177 * For full construction, the ProgressPopup::Construct() method must be called right after calling this constructor.
184 * This destructor overrides Tizen::Base::Object::~Object().
188 virtual ~ProgressPopup(void);
191 * Initializes this instance of %ProgressPopup with the specified parameters.
194 * @return An error code
195 * @param[in] cancelButton Set to @c true if the %ProgressPopup window has a cancel button, @n
197 * @param[in] transparent Set to @c true if the %ProgressPopup window is translucent, @n
199 * @exception E_SUCCESS The method is successful.
200 * @exception E_SYSTEM A system error has occurred. @n
201 This error occurs when the internal resource is not loaded.
203 * - To show a %ProgressPopup window, call Show() or DoModal() after calling this method.
204 * - By default, the title area and the body text are not shown. @n
205 * Use SetTitleText() and SetText() to show the title area and the body text.
206 * - If @c transparent is set to true, a progress icon is only shown and a cancel button is not shown. @n
207 * Also, the texts set by %SetTitleText() and %SetText() are not shown.
208 * - If the specified @c cancelButton is set to true and ProgressPopup is closed by pressing a Cancel Button,
209 * out parameter of %DoModal(), modalResult, is @c -1.
211 result Construct(bool cancelButton, bool transparent);
214 * Sets the text of the %ProgressPopup window.
217 * @return An error code
218 * @param[in] text The text to set
219 * @exception E_SUCCESS The method is successful.
220 * @exception E_OUT_OF_MEMORY The memory is insufficient.
221 * @remarks If the %ProgressPopup window is constructed as transparent, the text is not shown.
223 result SetText(const Tizen::Base::String& text);
226 * Gets the text of the %ProgressPopup window.
230 * @return The text of the %ProgressPopup window, @n
231 * else an empty string if an error occurs
233 Tizen::Base::String GetText(void) const;
236 * Adds a listener instance @n
237 * The added listener can listen to events on the given event dispatcher's context when they are fired.
240 * @return An error code
241 * @param[in] listener The event listener to add @n Listener should be allocated at heap, not stack.
242 * @exception E_SUCCESS This method was successful.
243 * @exception E_OBJ_ALREADY_EXIST The listener was already exist.
244 * @see RemoveProgressPopupEventListener()
246 result AddProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
249 * Removes a listener instance. @n
250 * The removed listener cannot listen to events when they are fired.
253 * @return An error code
254 * @param[in] listener The event listener to remove @n
255 * The listener should be referring to previously allocated instance which is passed as an argument to
256 * AddProgressPopupEventListener().
257 * @exception E_SUCCESS This method was successful.
258 * @exception E_OBJ_NOT_FOUND The listener was not found.
260 result RemoveProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
263 * Sets the text color of the %ProgressPopup window.
266 * @param[in] color The text color
268 void SetTextColor(const Tizen::Graphics::Color& color);
271 * Gets the text color of the %ProgressPopup window.
274 * @return The color, @n
275 * else RGBA(0, 0, 0, 0) if an error occurs
277 Tizen::Graphics::Color GetTextColor(void) const;
280 friend class _ProgressPopupImpl;
284 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
286 ProgressPopup(const ProgressPopup& rhs);
289 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
291 ProgressPopup& operator =(const ProgressPopup& rhs);
296 }}} // Tizen::Ui::Controls
298 #endif // _FUI_CTRL_PROGRESS_POPUP_H_