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 FUiCtrlProgress.cpp
20 * @brief This is the implementation file for Progress class.
23 #include <FUiCtrlProgress.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_ProgressImpl.h"
27 using namespace Tizen::Graphics;
29 namespace Tizen { namespace Ui { namespace Controls
32 Progress::Progress(void)
36 Progress::~Progress(void)
41 Progress::Construct(const Rectangle& rect, int minValue, int maxValue)
45 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
46 SysAssertf((pProgressImpl == null), "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
48 pProgressImpl = _ProgressImpl::CreateProgressImplN(this, rect);
50 SysTryReturn(NID_UI_CTRL, pProgressImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
52 _pControlImpl = pProgressImpl;
54 r = pProgressImpl->SetRange(minValue, maxValue);
55 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
57 r = pProgressImpl->SetValue(minValue);
58 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
72 Progress::Construct(const FloatRectangle& rect, int minValue, int maxValue)
76 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
77 SysAssertf((pProgressImpl == null), "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
79 pProgressImpl = _ProgressImpl::CreateProgressImplFN(this, rect);
81 SysTryReturn(NID_UI_CTRL, pProgressImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
83 _pControlImpl = pProgressImpl;
85 r = pProgressImpl->SetRange(minValue, maxValue);
86 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
88 r = pProgressImpl->SetValue(minValue);
89 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
103 Progress::SetValue(int value)
105 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
106 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
108 result r = pProgressImpl->SetValue(value);
109 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
115 Progress::SetRange(int minValue, int maxValue)
117 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
118 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
120 return pProgressImpl->SetRange(minValue, maxValue);
124 Progress::GetValue(void) const
126 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
127 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
129 return pProgressImpl->GetValue();
133 Progress::GetRange(int& minValue, int& maxValue) const
135 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
136 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
138 result r = pProgressImpl->GetRange(minValue, maxValue);
139 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
145 Progress::GetPercentComplete(void) const
147 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
148 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
150 return pProgressImpl->GetPercentComplete();
154 Progress::SetBarColor(const Color& color)
156 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
157 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
159 return pProgressImpl->SetBarColor(color);
163 Progress::GetBarColor(void) const
165 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
166 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
168 return pProgressImpl->GetBarColor();
172 Progress::SetBarBackgroundColor(const Color& color)
174 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
175 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
177 result r = pProgressImpl->SetBarBackgroundColor(color);
178 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
184 Progress::GetBarBackgroundColor(void) const
186 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
187 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
189 return pProgressImpl->GetBarBackgroundColor();
191 }}} // Tizen::Ui::Controls