Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrlProgressPopup.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                FUiCtrlProgressPopup.cpp
20  * @brief       This file contains implementation of ProgressPopup class
21  */
22
23 #include <FUiCtrlProgressPopup.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_ProgressPopupImpl.h"
26
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::App;
31
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36
37 ProgressPopup::ProgressPopup(void)
38 {
39         //empty statement
40 }
41
42 ProgressPopup::~ProgressPopup(void)
43 {
44         //empty statement
45 }
46
47 result
48 ProgressPopup::Construct(bool cancelButton, bool transparent)
49 {
50         result r = E_SUCCESS;
51
52         _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
53         SysAssertf(pProgressPopupImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
54
55         pProgressPopupImpl = _ProgressPopupImpl::CreateProgressPopupImplN(this);
56         r = GetLastResult();
57         SysTryReturn(NID_UI_CTRL, pProgressPopupImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
58
59         //Set _ProgressPopupImpl
60         _pControlImpl = pProgressPopupImpl;
61
62         r = pProgressPopupImpl->Initialize(cancelButton, transparent);
63         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
64
65         return r;
66
67 CATCH:
68         delete pProgressPopupImpl;
69
70         _pControlImpl = null;
71
72         return r;
73 }
74
75 result
76 ProgressPopup::AddProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener)
77 {
78         _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
79         SysAssertf(pProgressPopupImpl != null, "Not-yet constructed. Construct() should be called before use.");
80
81         result r = pProgressPopupImpl->AddProgressPopupEventListener(listener);
82         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
83
84         return r;
85 }
86
87 result
88 ProgressPopup::RemoveProgressPopupEventListener(Tizen::Ui::IProgressPopupEventListener& listener)
89 {
90         _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
91         SysAssertf(pProgressPopupImpl != null, "Not-yet constructed. Construct() should be called before use.");
92
93         result r = pProgressPopupImpl->RemoveProgressPopupEventListener(listener);
94         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
95
96         return r;
97 }
98
99 result
100 ProgressPopup::SetText(const String& text)
101 {
102         _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
103         SysAssertf(pProgressPopupImpl != null, "Not-yet constructed. Construct() should be called before use.");
104
105         result r = pProgressPopupImpl->SetText(text);
106         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
107
108         return r;
109 }
110
111 String
112 ProgressPopup::GetText(void) const
113 {
114         const _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
115         SysAssertf(pProgressPopupImpl != null, "Not-yet constructed. Construct() should be called before use.");
116
117         return pProgressPopupImpl->GetText();
118 }
119
120 void
121 ProgressPopup::SetTextColor(const Color& color)
122 {
123         _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
124         SysAssertf(pProgressPopupImpl != null, "Not-yet constructed. Construct() should be called before use.");
125
126         pProgressPopupImpl->SetTextColor(color);
127 }
128
129 Color
130 ProgressPopup::GetTextColor(void) const
131 {
132         const _ProgressPopupImpl* pProgressPopupImpl = _ProgressPopupImpl::GetInstance(*this);
133         SysAssertf(pProgressPopupImpl != null, "Not-yet constructed. Construct() should be called before use.");
134
135         return pProgressPopupImpl->GetTextColor();
136 }
137
138
139 }}} // Tizen::Ui::Controls
140