Updating Winset4.4 ux to popup, progress popup.
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_ProgressPopup.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
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.
16 //
17
18 /**
19  * @file                FUiCtrl_ProgressPopup.cpp
20  * @brief       This is the implementation file for the _ProgressPopup class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FBaseErrorDefine.h>
25 #include <FGrp_BitmapImpl.h>
26 #include <FSys_SettingInfoImpl.h>
27 #include <FUiCtrlButton.h>
28 #include <FUiCtrlForm.h>
29 #include "FUi_AccessibilityContainer.h"
30 #include "FUi_AccessibilityElement.h"
31 #include "FUi_CoordinateSystemUtils.h"
32 #include "FUi_EcoreEvas.h"
33 #include "FUi_EcoreEvasMgr.h"
34 #include "FUi_ResourceManager.h"
35 #include "FUiCtrl_ButtonImpl.h"
36 #include "FUiCtrl_Button.h"
37 #include "FUiCtrl_Form.h"
38 #include "FUiCtrl_Frame.h"
39 #include "FUiCtrl_ProgressPopup.h"
40 #include "FUiCtrl_ProgressPopupPresenter.h"
41 #include "FUiCtrl_Indicator.h"
42
43
44 using namespace Tizen::Graphics;
45 using namespace Tizen::Ui;
46 using namespace Tizen::Ui::Animations;
47 using namespace Tizen::Base;
48 using namespace Tizen::System;
49
50 namespace Tizen { namespace Ui { namespace Controls
51 {
52
53
54 _ProgressPopup::_ProgressPopup(void)
55         : __pProgressPopupPresenter(null)
56         , __pProgressPopupEvent(null)
57         , __pButton(null)
58         , __pComposedButtonBitmap(null)
59         , __pButtonEffectBitmap(null)
60         , __text(L"")
61         , __textColor(Color(0xFFFFFFFF))
62         , __animationRect(0.0f, 0.0f, 0.0f, 0.0f)
63         , __textState(false)
64         , __buttonState(false)
65         , __isTransparent(false)
66 {
67         // empty statement
68 }
69
70 _ProgressPopup::~_ProgressPopup(void)
71 {
72         delete __pProgressPopupPresenter;
73         __pProgressPopupPresenter = null;
74
75         if (__pProgressPopupEvent != null)
76         {
77                 delete __pProgressPopupEvent;
78                 __pProgressPopupEvent = null;
79         }
80
81         delete _pBgBitmap;
82         _pBgBitmap = null;
83
84         delete _pComposedBgBitmap;
85         _pComposedBgBitmap = null;
86
87         delete _pOutlineBitmap;
88         _pOutlineBitmap = null;
89
90         delete __pComposedButtonBitmap;
91         __pComposedButtonBitmap = null;
92
93         delete __pButtonEffectBitmap;
94         __pButtonEffectBitmap = null;
95
96         delete _pComposedTitleBitmap;
97         _pComposedTitleBitmap = null;
98
99         delete _pTitleEffectBitmap;
100         _pTitleEffectBitmap = null;
101
102         delete __pButton;
103         __pButton = null;
104
105         _SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
106 }
107
108 _ProgressPopup*
109 _ProgressPopup::CreateProgressPopupN(void)
110 {
111         _ProgressPopup* pProgressPopup = new (std::nothrow) _ProgressPopup();
112         SysTryReturn(NID_UI_CTRL, pProgressPopup != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
113
114         result r = pProgressPopup->CreateRootVisualElement(_WINDOW_TYPE_SUB);
115         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
116
117         // for taking touch event
118         pProgressPopup->AcquireHandle();
119         return pProgressPopup;
120
121 CATCH:
122         delete pProgressPopup;
123
124         return null;
125 }
126
127 result
128 _ProgressPopup::Initialize(bool cancelButton, bool transparent, const FloatRectangle& animationRect)
129 {
130         result r = E_SUCCESS;
131
132         _AccessibilityContainer* pContainer = null;
133
134         Bitmap* buttonBgBitmap = null;
135         Bitmap* titleBgBitmap = null;
136         Color titleBgColor(0x00000000);
137         Color buttonBgColor(0x00000000);
138
139         __animationRect = animationRect;
140         __buttonState = cancelButton;
141         __isTransparent = transparent;
142
143         _ProgressPopupPresenter* pPresenter = new (std::nothrow) _ProgressPopupPresenter();
144         SysTryReturn(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
145
146         SetPresenter(*pPresenter);
147
148         r = pPresenter->Initialize(*this, cancelButton, transparent, animationRect);
149         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
150
151         GET_COLOR_CONFIG(POPUP::TITLE_TEXT_NORMAL, _titleTextColor);
152         GET_COLOR_CONFIG(MESSAGEBOX::TEXT_NORMAL, __textColor);
153         GET_COLOR_CONFIG(MESSAGEBOX::BG_TITLE, titleBgColor);
154         GET_COLOR_CONFIG(MESSAGEBOX::BG_BUTTON, buttonBgColor);
155
156         GET_BITMAP_CONFIG_N(POPUP::BG_OUTLINE_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, _pOutlineBitmap);
157         r = GetLastResult();
158         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
159
160         Color bgColor;
161         GET_COLOR_CONFIG(POPUP::BG_NORMAL, bgColor);
162
163         GET_BITMAP_CONFIG_N(POPUP::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, _pBgBitmap);
164         r = GetLastResult();
165         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
166
167         _pComposedBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*_pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
168         r = GetLastResult();
169         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
170
171         if (cancelButton)
172         {
173                 GET_BITMAP_CONFIG_N(MESSAGEBOX::BG_BUTTON_AREA, BITMAP_PIXEL_FORMAT_ARGB8888, buttonBgBitmap);
174                 r = GetLastResult();
175                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
176
177                 __pComposedButtonBitmap = _BitmapImpl::GetColorReplacedBitmapN(*buttonBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonBgColor);
178                 r = GetLastResult();
179                 SysTryCatch(NID_UI_CTRL, (__pComposedButtonBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
180
181                 GET_BITMAP_CONFIG_N(MESSAGEBOX::BG_BUTTON_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pButtonEffectBitmap);
182                 r = GetLastResult();
183                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
184         }
185
186         GET_BITMAP_CONFIG_N(MESSAGEBOX::BG_TITLE_AREA, BITMAP_PIXEL_FORMAT_ARGB8888, titleBgBitmap);
187         r = GetLastResult();
188         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
189
190         _pComposedTitleBitmap = _BitmapImpl::GetColorReplacedBitmapN(*titleBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), titleBgColor);
191         r = GetLastResult();
192         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
193
194         GET_BITMAP_CONFIG_N(MESSAGEBOX::BG_TITLE_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, _pTitleEffectBitmap);
195         r = GetLastResult();
196         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
197
198         // for clearing canvas
199         if (GetVisualElement() != null)
200         {
201                 GetVisualElement()->SetSurfaceOpaque(false);
202         }
203
204         SetDimmingEnabled(true);
205
206         if (__buttonState && !__isTransparent)
207         {
208                 __pButton = new (std::nothrow) Button();
209                 SysTryCatch(NID_UI_CTRL, __pButton != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
210
211                 r = __pButton->Construct(pPresenter->GetButtonBounds());
212                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
213
214                 SetButtonText();
215
216                 _ControlImpl* pImpl = _ControlImpl::GetInstance(*__pButton);
217                 r = AttachChild(pImpl->GetCore());
218                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
219
220                 _Button* pButtonCore = dynamic_cast <_Button*>(&pImpl->GetCore());
221                 SysTryCatch(NID_UI_CTRL, pButtonCore != null, , r, "[%s] Propagating.", GetErrorMessage(r));
222
223                 pButtonCore->SetActionId(ID_PROGRESS_POPUP_CANCEL_BUTTON);
224                 pButtonCore->AddActionEventListener(*this);
225         }
226
227         pContainer = GetAccessibilityContainer();
228         if(pContainer != null)
229         {
230                 pContainer->Activate(true);
231         }
232
233         r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
234         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
235
236         if (buttonBgBitmap != null)
237         {
238                 delete buttonBgBitmap;
239                 buttonBgBitmap = null;
240         }
241
242         delete titleBgBitmap;
243         titleBgBitmap = null;
244
245         return r;
246
247 CATCH:
248
249         delete titleBgBitmap;
250         titleBgBitmap = null;
251
252         delete _pBgBitmap;
253         _pBgBitmap = null;
254
255         delete _pOutlineBitmap;
256         _pOutlineBitmap = null;
257
258         delete _pComposedBgBitmap;
259         _pComposedBgBitmap = null;
260
261         if (buttonBgBitmap != null)
262         {
263                 delete buttonBgBitmap;
264                 buttonBgBitmap = null;
265         }
266
267         if (__pComposedButtonBitmap != null)
268         {
269                 delete __pComposedButtonBitmap;
270                 __pComposedButtonBitmap = null;
271         }
272
273         if (__pButtonEffectBitmap != null)
274         {
275                 delete __pButtonEffectBitmap;
276                 __pButtonEffectBitmap = null;
277         }
278
279         delete _pComposedTitleBitmap;
280         _pComposedTitleBitmap = null;
281
282         delete _pTitleEffectBitmap;
283         _pTitleEffectBitmap = null;
284
285         delete __pButton;
286         __pButton = null;
287
288         return r;
289 }
290
291 result
292 _ProgressPopup::SetPresenter(const _ProgressPopupPresenter& ProgressPopupPresenter)
293 {
294         __pProgressPopupPresenter = const_cast <_ProgressPopupPresenter*>(&ProgressPopupPresenter);
295
296         return E_SUCCESS;
297 }
298
299 _PopupPresenter*
300 _ProgressPopup::GetPresenter(void)
301 {
302         return static_cast <_PopupPresenter*>(__pProgressPopupPresenter);
303 }
304
305 result
306 _ProgressPopup::DoModal(int& modalResult)
307 {
308         result r = E_SUCCESS;
309
310         r = __pProgressPopupPresenter->DoModal(modalResult);
311         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
312
313         return r;
314 }
315
316 result
317 _ProgressPopup::AddProgressPopupEventListener(const Tizen::Ui::Controls::_IProgressPopupEventListener& listener)
318 {
319         result r = E_SUCCESS;
320
321         if (__pProgressPopupEvent == null)
322         {
323                 __pProgressPopupEvent = _ProgressPopupEvent::CreateInstanceN(*this);
324                 r = GetLastResult();
325                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
326         }
327
328         r = __pProgressPopupEvent->AddListener(listener);
329         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
330
331         return r;
332 }
333
334 result
335 _ProgressPopup::SetTitleText(const String& title)
336 {
337         result r = E_SUCCESS;
338
339         _titleText = title;
340         _titleState = true;
341
342         __pProgressPopupPresenter->SetTitleTextObject();
343
344         r = GetLastResult();
345         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
346
347         if (_pTitleTextAccessibilityElement != null)
348         {
349                 _pTitleTextAccessibilityElement->SetLabel(title);
350         }
351
352         return r;
353 CATCH:
354         _titleText = L"";
355         _titleState = false;
356
357         return r;
358 }
359
360 result
361 _ProgressPopup::SetText(const String& text)
362 {
363         result r = E_SUCCESS;
364
365         __text = text;
366         __textState = true;
367
368         __pProgressPopupPresenter->SetTextObject();
369
370         r = GetLastResult();
371         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
372
373         return r;
374 CATCH:
375         __text = L"";
376         __textState = false;
377
378         return r;
379 }
380
381 result
382 _ProgressPopup::UpdateBounds(void)
383 {
384         result r = E_SUCCESS;
385
386         // create button with new position
387         if (HasButton())
388         {
389                 _ControlImpl* pImpl = null;
390                 _Button* pButtonCore = null;
391
392                 if (__pButton != null)
393                 {
394                         pImpl = _ControlImpl::GetInstance(*__pButton);
395                         r = DetachChild(pImpl->GetCore());
396                         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
397
398                         delete __pButton;
399                         __pButton = null;
400                 }
401
402                 __pButton = new (std::nothrow) Button();
403                 SysTryReturn(NID_UI_CTRL, __pButton != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
404
405                 r = __pButton->Construct(__pProgressPopupPresenter->GetButtonBounds());
406                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
407
408                 SetButtonText();
409
410                 pImpl = _ControlImpl::GetInstance(*__pButton);
411                 r = AttachChild(pImpl->GetCore());
412                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
413
414                 pButtonCore = dynamic_cast <_Button*>(&pImpl->GetCore());
415                 r = GetLastResult();
416                 SysTryCatch(NID_UI_CTRL, pButtonCore != null, , r, "[%s] Propagating.", GetErrorMessage(r));
417
418                 pButtonCore->SetActionId(ID_PROGRESS_POPUP_CANCEL_BUTTON);
419                 pButtonCore->AddActionEventListener(*this);
420         }
421
422         // update total height -> GetTotalHeight (called by Impl)
423         // update process-animation rect position -> GetAnimationRect (called by UpdateProcessAnimationVE)
424         // update process-animation VE
425 //      r = __pProgressPopupPresenter->UpdateProcessAnimationVE();
426 //      SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
427
428         return r;
429
430 CATCH:
431         delete __pButton;
432         __pButton = null;
433
434         return r;
435 }
436
437 String
438 _ProgressPopup::GetText(void) const
439 {
440         return __text;
441 }
442
443 Bitmap*
444 _ProgressPopup::GetButtonBackgroundBitmap(void)
445 {
446     return __pComposedButtonBitmap;
447 }
448
449 Bitmap*
450 _ProgressPopup::GetButtonBackgroundEffectBitmap(void)
451 {
452     return __pButtonEffectBitmap;
453 }
454
455 float
456 _ProgressPopup::GetTotalHeight(void) const
457 {
458         float transTopMargin = 0.0f;
459         float transBottomMargin = 0.0f;
460         float titleHeight = 0.0f;
461         float animationTopMargin = 0.0f;
462         float animationWidth = 0.0f;
463         float textTopGap = 0.0f;
464         float textBottomGap = 0.0f;
465         float bottomHeight = 0.0f;
466         float minHeight = 0.0f;
467
468         _ControlOrientation orientation;
469
470         orientation = GetOrientation();
471
472         GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_TOP_MARGIN, orientation, transTopMargin);
473         GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_BOTTOM_MARGIN, orientation, transBottomMargin);
474         GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_WIDTH, orientation, animationWidth);
475         GET_SHAPE_CONFIG(POPUP::PROCESS_TEXT_TOP_MARGIN, orientation, textTopGap);
476         GET_SHAPE_CONFIG(POPUP::PROCESS_TEXT_BOTTOM_MARGIN, orientation, textBottomGap);
477
478         GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, bottomHeight);
479         GET_SHAPE_CONFIG(MESSAGEBOX::MIN_HEIGHT, orientation, minHeight);
480
481
482         if (HasTitle())
483         {
484                 GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, orientation, titleHeight);
485                 GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_WITH_TITLE_TOP_MARGIN, orientation, animationTopMargin);
486         }
487         else
488         {
489                 GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_NO_TITLE_TOP_MARGIN, orientation, animationTopMargin);
490         }
491
492         if (!HasText())
493         {
494                 textTopGap = 0.0f;
495                 textBottomGap = textBottomGap * 1.5f;
496         }
497
498         if (!HasButton())
499         {
500                 bottomHeight = 0.0f;
501         }
502
503
504         float totalH = titleHeight
505                         + animationTopMargin
506                         + animationWidth
507                         + textTopGap
508                         + textBottomGap
509                         + bottomHeight
510                         + __pProgressPopupPresenter->GetBodyTextObjHeight();
511
512
513         if (minHeight > totalH)
514         {
515                 totalH = minHeight;
516         }
517
518         totalH = totalH + transTopMargin + transBottomMargin;
519
520         return totalH;
521 }
522
523 result
524 _ProgressPopup::SetTextColor(const Color& color)
525 {
526         __textColor = color;
527
528         return E_SUCCESS;
529 }
530
531 Color
532 _ProgressPopup::GetTextColor() const
533 {
534         return __textColor;
535 }
536
537 FloatRectangle
538 _ProgressPopup::GetAnimationRect(void) const
539 {
540         FloatRectangle animationBounds;
541
542         float defaultWidth = 0.0f;
543         float titleHeight = 0.0f;
544         float animationWidth = 0.0f;
545         float animationTopMargin = 0.0f;
546         float transTopMargin = 0.0f;
547
548         _ControlOrientation orientation;
549
550         orientation = GetOrientation();
551
552         GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, defaultWidth);
553
554         GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_WIDTH, orientation, animationWidth);
555         GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_TOP_MARGIN, orientation, transTopMargin);
556
557         if (HasTitle())
558         {
559                 GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, orientation, titleHeight);
560                 GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_WITH_TITLE_TOP_MARGIN, orientation, animationTopMargin);
561         }
562         else if (HasText() || HasButton())
563         {
564                 GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_NO_TITLE_TOP_MARGIN, orientation, animationTopMargin);
565         }
566         else
567         {
568                 GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_NO_TITLE_TOP_MARGIN, orientation, animationTopMargin);
569         }
570
571         animationBounds = FloatRectangle((defaultWidth - animationWidth) / 2.0f,
572                                                                         titleHeight + animationTopMargin + transTopMargin,
573                                                                         animationWidth, animationWidth);
574
575         return animationBounds;
576 }
577
578 bool
579 _ProgressPopup::HasText(void) const
580 {
581         return __textState;
582 }
583
584 bool
585 _ProgressPopup::HasButton(void) const
586 {
587         return (__buttonState && !__isTransparent);
588 }
589
590 bool
591 _ProgressPopup::IsTransparent(void) const
592 {
593         return __isTransparent;
594 }
595
596 void
597 _ProgressPopup::FireProgressPopupEvent(void)
598 {
599         if (__pProgressPopupEvent != null)
600         {
601                 Tizen::Base::Runtime::IEventArg* pEventArg = _ProgressPopupEvent::CreateProgressPopupEventArgN();
602                 result r = GetLastResult();
603                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
604
605                 __pProgressPopupEvent->Fire(*pEventArg);
606         }
607 }
608
609 void
610 _ProgressPopup::OnDraw(void)
611 {
612         __pProgressPopupPresenter->Draw();
613         if(unlikely((_AccessibilityManager::IsActivated())))
614         {
615                 _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
616         }
617 }
618
619 void
620 _ProgressPopup::OnFontChanged(Font * pFont)
621 {
622         __pProgressPopupPresenter->OnFontChanged(pFont);
623 }
624
625 void
626 _ProgressPopup::OnFontInfoRequested(unsigned long& style, float& size)
627 {
628         __pProgressPopupPresenter->OnFontInfoRequested(style, size);
629 }
630
631 void
632 _ProgressPopup::OnActionPerformed(const Tizen::Ui::_Control& source, int actionId)
633 {
634         switch (actionId)
635         {
636         case ID_PROGRESS_POPUP_CANCEL_BUTTON:
637                 {
638                         FireProgressPopupEvent();
639                         _Popup::SetReturnValue(POPUP_RESULT_CANCEL);
640                         break;
641                 }
642
643         default:
644                 break;
645         }
646 }
647
648 void
649 _ProgressPopup::OnBoundsChanged(void)
650 {
651         SetClientBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
652
653         if ((HasTitle() == true) && (_pTitleTextAccessibilityElement != null))
654         {
655                 _pTitleTextAccessibilityElement->SetBounds(__pProgressPopupPresenter->GetTitleTextBounds());
656         }
657
658         return;
659 }
660
661 void
662 _ProgressPopup::OnVisibleStateChanged(void)
663 {
664         _Window::OnVisibleStateChanged();
665 }
666
667 void
668 _ProgressPopup::OnActivated(void)
669 {
670         __pProgressPopupPresenter->PlayProcessAnimation();
671
672
673         if (GetVisibleState() && !__isTransparent)
674         {
675                 SetTouchCapture(false, false);
676         }
677
678         bool showstate = false;
679         bool opacity = false;
680
681         _Control* pOwner = GetOwner();
682         if (pOwner == null)
683         {
684                 _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
685                 SysTryReturnVoidResult(NID_UI_CTRL, pFrame != null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed.");
686
687                 _Form* pForm = pFrame->GetCurrentForm();
688                 if (pForm != null)
689                 {
690                         SetOwner(pForm);
691
692                         showstate = pForm->IsIndicatorVisible();
693                         opacity = pForm->IsIndicatorTranslucent();
694                 }
695                 else
696                 {
697                         SetOwner(pFrame);
698                 }
699         }
700         else
701         {
702                 _Form* pForm = dynamic_cast<_Form*>(pOwner);
703                 if (pForm != null)
704                 {
705                         showstate = pForm->IsIndicatorVisible();
706                         opacity = pForm->IsIndicatorTranslucent();
707                 }
708
709                 pOwner->LockInputEvent();
710         }
711
712         _Indicator* pIndicator = GetIndicator();
713         if (pIndicator)
714         {
715                 pIndicator->AddIndicatorObject(this, GetRootWindow());
716
717                 float indicatorwidth = 0.0f;
718                 float indicatorheight = 0.0f;
719
720                 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
721                 {
722                         indicatorwidth = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF().width;
723                         GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
724                 }
725                 else
726                 {
727                         indicatorwidth = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF().height;
728                         GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetOrientation(), indicatorheight);
729                 }
730
731                 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, indicatorwidth, indicatorheight));
732                 pIndicator->SetIndicatorShowState(showstate);
733                 if (opacity)
734                 {
735                         pIndicator->SetIndicatorOpacity(_INDICATOR_OPACITY_TRANSLUCENT);
736                 }
737                 else
738                 {
739                         pIndicator->SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
740                 }
741         }
742
743
744         if (__isTransparent)
745         {
746                 _DimmingLayer* pDimmingLayer = GetDimmingLayer();
747
748                 if (pDimmingLayer != null)
749                 {
750                         pDimmingLayer->SetOpacity(0.0f);
751                 }
752         }
753
754         _Window::OnActivated();
755 }
756
757 void
758 _ProgressPopup::OnDeactivated(void)
759 {
760         __pProgressPopupPresenter->StopProcessAnimation();
761
762         _Popup::OnDeactivated();
763 }
764
765 void
766 _ProgressPopup::InitializeAccessibilityElement(void)
767 {
768         result r = E_SUCCESS;
769
770         _Popup::InitializeAccessibilityElement();
771
772         if (_pTitleTextAccessibilityElement != null)
773         {
774                 _pTitleTextAccessibilityElement->SetName(L"ProgressPopupTitleText");
775         }
776
777         __pProgressPopupPresenter->InitializeAccessibilityElement();
778         r = GetLastResult();
779         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
780
781         if (HasButton() == true)
782         {
783
784                 SetCancelButtonAccessibilityElement();
785         }
786         return;
787 }
788
789 void
790 _ProgressPopup::SetCancelButtonAccessibilityElement(void)
791 {
792         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
793
794         if (pContainer != null)
795         {
796                 _ControlImpl* pImpl = null;
797                 _Button* pButtonCore = null;
798
799                 pImpl = _ControlImpl::GetInstance(*__pButton);
800
801                 pButtonCore = dynamic_cast<_Button*>(&pImpl->GetCore());
802                 result r = GetLastResult();
803                 SysTryReturnVoidResult(NID_UI_CTRL, pButtonCore != null, r, "[%s] Propagating.", GetErrorMessage(r));
804
805                 _AccessibilityContainer* pButtonContainer = pButtonCore->GetAccessibilityContainer();
806
807                 if (pButtonContainer != null)
808                 {
809                         _AccessibilityElement* pButtonElement = pButtonContainer->GetChildElement(L"ButtonText");
810                         if (pButtonElement != null)
811                         {
812                                 pButtonElement->SetName(L"ProgressPopupButton1");
813                         }
814
815                         // Add Container
816                         pContainer->AddChildContainer(*pButtonContainer);
817                 }
818         }
819 }
820 void
821 _ProgressPopup::OnChangeLayout(_ControlOrientation orientation)
822 {
823         _Window::OnChangeLayout(orientation);
824
825         result r = E_SUCCESS;
826
827         r = __pProgressPopupPresenter->OnChangeLayout(orientation);
828         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
829
830         if (HasButton())
831         {
832                 r = __pButton->SetBounds(__pProgressPopupPresenter->GetButtonBounds());
833                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
834         }
835 }
836
837 bool
838 _ProgressPopup::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
839 {
840         if (&source != this)
841         {
842                 return false;
843         }
844
845         return __pProgressPopupPresenter->OnTouchPressed(source, touchinfo);
846 }
847
848 bool
849 _ProgressPopup::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
850 {
851         if (&source != this)
852         {
853                 return false;
854         }
855
856         return __pProgressPopupPresenter->OnTouchMoved(source, touchinfo);
857 }
858
859 bool
860 _ProgressPopup::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
861 {
862         if (&source != this)
863         {
864                 return false;
865         }
866
867         return __pProgressPopupPresenter->OnTouchReleased(source, touchinfo);
868 }
869
870 void
871 _ProgressPopup::OnSettingChanged(String& key)
872 {
873         const wchar_t* LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
874
875         if ((key == LOCALE_LANGUAGE) && (__pButton != null))
876         {
877                 SetButtonText();
878         }
879 }
880
881 void
882 _ProgressPopup::SetButtonText(void)
883 {
884         String buttonText;
885
886         GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, buttonText);
887
888         __pButton->SetText(buttonText);
889 }
890
891 }}} // Tizen::Ui::Controls
892