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_
28 #include <FUiCtrlPopup.h>
30 namespace Tizen { namespace Ui
32 class IProgressPopupEventListener;
36 namespace Tizen { namespace Ui { namespace Controls
40 * @class ProgressPopup
41 * @brief This class defines the common behavior of a %ProgressPopup control.
45 * The %ProgressPopup class displays processing animation to show processing status.
46 * It can contain a title, body text and cancel button.
48 * @see Tizen::Ui::Window
50 * The following example demonstrates how to use the %ProgressPopup class.
53 // Sample code for ProgressPopupSample.h
56 class ProgressPopupSample
57 : public Tizen::Ui::Controls::Form
58 , public Tizen::Ui::IProgressPopupEventListener
61 ProgressPopupSample(void);
62 virtual ~ProgressPopupSample(void);
64 virtual bool Initialize(void);
65 void ShowProgressPopup(void);
66 virtual result OnInitializing(void);
67 virtual result OnTerminating(void);
68 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
70 //IProgressPopupEventListener
71 virtual void OnProgressPopupCanceled(void);
74 static const int ID_BUTTON_PROGRESSPOPUP = 501;
75 static const int ID_BUTTON_CLOSE_PROGRESSPOPUP = 502;
77 Tizen::Ui::Controls::ProgressPopup* __pProgressPopup;
82 // Sample code for ProgressPopupSample.cpp
83 #include "ProgressPopupSample.h"
85 using namespace Tizen::Ui;
86 using namespace Tizen::Ui::Controls;
87 using namespace Tizen::Graphics;
89 ProgressPopupSample::ProgressPopupSample(void)
90 : __pProgressPopup(null)
94 ProgressPopupSample::~ProgressPopupSample(void)
99 ProgressPopupSample::Initialize(void)
101 Construct(FORM_STYLE_NORMAL);
106 ProgressPopupSample::OnInitializing(void)
108 result r = E_SUCCESS;
110 // Creates an instance of ProgressPopup
111 __pProgressPopup = new (std::nothrow) ProgressPopup();
112 __pProgressPopup->Construct(true,false);
113 __pProgressPopup->SetTitleText(L"ProgressPopup Test");
114 __pProgressPopup->SetText(L"Hello World!!");
115 __pProgressPopup->AddProgressPopupEventListener(*this);
117 // Creates an instance of Button to open the ProgressPopup
118 Button* pButtonProgressPopup = new Button();
119 pButtonProgressPopup->Construct(Rectangle(10, 10, 250, 60), L"Open ProgressPopup");
120 pButtonProgressPopup->SetActionId(ID_BUTTON_PROGRESSPOPUP);
121 pButtonProgressPopup->AddActionEventListener(*this);
127 ProgressPopupSample::OnTerminating(void)
129 result r = E_SUCCESS;
131 // Deallocates the __pProgressPopup
132 delete __pProgressPopup;
138 ProgressPopupSample::ShowProgressPopup(void)
140 __pProgressPopup->SetShowState(true);
141 __pProgressPopup->Show();
145 ProgressPopupSample::OnActionPerformed(const Control& source, int actionId)
149 case ID_BUTTON_PROGRESSPOPUP:
158 ProgressPopupSample::OnProgressPopupCanceled(void)
160 __pProgressPopup->SetShowState(false);
166 class _OSP_EXPORT_ ProgressPopup
171 * 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.
178 * This destructor overrides Tizen::Base::Object::~Object().
182 virtual ~ProgressPopup(void);
185 * Initializes this instance of %ProgressPopup with the specified parameters.
188 * @return An error code
189 * @param[in] cancelButton Set to @c true if the %ProgressPopup window has a cancel button, @n
191 * @param[in] translucent Set to @c true if the %ProgressPopup window is translucent, @n
193 * @exception E_SUCCESS The method is successful.
194 * @exception E_SYSTEM A system error has occurred. @n
195 * This error occurs when the internal resource is not loaded.
196 * @remarks To show a %ProgressPopup window, call Show() or DoModal() after calling the Construct() method. @n
197 * By default, the title area and the body text are not shown. @n
198 * Use SetTitleText() and SetText() to show the title area and the body text.
199 * @remarks If cancelButton is set to true and ProgressPopup is closed by pressing a Cancel Button,
200 * out parameter of DoModal(), modalResult, is -1.
202 result Construct(bool cancelButton, bool translucent);
205 * Sets the text of the %ProgressPopup window.
208 * @return An error code
209 * @param[in] text The text to be set
210 * @exception E_SUCCESS The method is successful.
211 * @exception E_OUT_OF_MEMORY The memory is insufficient.
213 result SetText(const Tizen::Base::String& text);
216 * Gets the text of the %ProgressPopup window.
220 * @return The text of the %ProgressPopup window, @n
221 * else an empty string if an error occurs
223 Tizen::Base::String GetText(void) const;
226 * Adds a listener instance @n
227 * The added listener can listen to events on the given event dispatcher's context when they are fired.
230 * @return An error code
231 * @param[in] listener The event listener to be added. Listener should be allocated at heap, not stack.
232 * @exception E_SUCCESS This method was successful.
233 * @exception E_OBJ_ALREADY_EXIST The listener was already exist.
235 result AddProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
238 * Removes a listener instance. @n
239 * The removed listener cannot listen to events when they are fired.
242 * @return An error code
243 * @param[in] listener The event listener to be removed. @n
244 * Listener should be referring to previously allocated instance which is passed as an argument to AddProgressPopupEventListener.
245 * @exception E_SUCCESS This method was successful.
246 * @exception E_OBJ_NOT_FOUND The listener was not found.
248 result RemoveProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener);
251 * Sets the text color of the %ProgressPopup window.
254 * @param[in] color The text color
256 void SetTextColor(const Tizen::Graphics::Color& color);
259 * Gets the text color of the %ProgressPopup window.
262 * @return The color, @n
263 * else RGBA(0, 0, 0, 0) if an error occurs
265 Tizen::Graphics::Color GetTextColor(void) const;
268 friend class _ProgressPopupImpl;
272 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
274 ProgressPopup(const ProgressPopup& rhs);
277 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
279 ProgressPopup& operator =(const ProgressPopup& rhs);
284 }}} // Tizen::Ui::Controls
286 #endif // _FUI_CTRL_PROGRESS_POPUP_H_