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.
18 * @file FUiCtrlProgress.cpp
19 * @brief This is the implementation file for Progress class.
22 #include <FUiCtrlProgress.h>
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_ProgressImpl.h"
26 using namespace Tizen::Graphics;
28 namespace Tizen { namespace Ui { namespace Controls
31 Progress::Progress(void)
35 Progress::~Progress(void)
40 Progress::Construct(const Rectangle& rect, int minValue, int maxValue)
44 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
45 SysAssertf((pProgressImpl == null), "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
47 pProgressImpl = _ProgressImpl::CreateProgressImplN(this, rect);
49 SysTryReturn(NID_UI_CTRL, pProgressImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
51 _pControlImpl = pProgressImpl;
53 r = pProgressImpl->SetRange(minValue, maxValue);
54 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
56 r = pProgressImpl->SetValue(minValue);
57 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
71 Progress::SetValue(int value)
73 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
74 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
76 result r = pProgressImpl->SetValue(value);
77 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
83 Progress::SetRange(int minValue, int maxValue)
85 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
86 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
88 return pProgressImpl->SetRange(minValue, maxValue);
92 Progress::GetValue(void) const
94 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
95 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
97 return pProgressImpl->GetValue();
101 Progress::GetRange(int& minValue, int& maxValue) const
103 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
104 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
106 result r = pProgressImpl->GetRange(minValue, maxValue);
107 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
113 Progress::GetPercentComplete(void) const
115 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
116 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
118 return pProgressImpl->GetPercentComplete();
122 Progress::SetBarColor(const Color& color)
124 _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
125 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
127 return pProgressImpl->SetBarColor(color);
131 Progress::GetBarColor(void) const
133 const _ProgressImpl* pProgressImpl = _ProgressImpl::GetInstance(*this);
134 SysAssertf(pProgressImpl != null, "Not yet constructed. Construct() should be called before use.");
136 return pProgressImpl->GetBarColor();
139 }}} // Tizen::Ui::Controls