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.
18 * @file FUiCtrlFrame.cpp
19 * @brief This is the implementation for the Frame class.
23 #include <FUiCtrlFrame.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_FrameImpl.h"
26 #include "FUiCtrl_FormImpl.h"
28 using namespace Tizen::Graphics;
29 using namespace Tizen::Ui;
30 using namespace Tizen::Ui::Animations;
32 namespace Tizen { namespace Ui { namespace Controls
44 Frame::Construct(void)
46 SysAssertf(_FrameImpl::GetInstance(*this) == null,
47 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
51 _FrameImpl* pImpl = _FrameImpl::CreateFrameImplN(this);
53 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
55 _pControlImpl = pImpl;
61 Frame::Construct(const Rectangle& rect)
63 SysAssertf(_FrameImpl::GetInstance(*this) == null,
64 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
68 _FrameImpl* pImpl = _FrameImpl::CreateFrameImplN(this);
70 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
72 _pControlImpl = pImpl;
74 pImpl->SetFloatingBounds(rect);
80 Frame::Construct(const FloatRectangle& rect)
82 SysAssertf(_FrameImpl::GetInstance(*this) == null,
83 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
87 _FrameImpl* pImpl = _FrameImpl::CreateFrameImplN(this);
89 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
91 _pControlImpl = pImpl;
93 pImpl->SetFloatingBounds(rect);
99 Frame::AddOrientationEventListener(IOrientationEventListener& listener)
101 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
102 SysAssertf(pImpl != null,
103 "Not yet constructed. Construct() should be called before use.");
105 pImpl->AddOrientationEventListener(listener);
109 Frame::AddFrameEventListener(IFrameEventListener& listener)
111 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
112 SysAssertf(pImpl != null,
113 "Not yet constructed. Construct() should be called before use.");
115 pImpl->AddFrameEventListener(listener);
119 Frame::RemoveOrientationEventListener(IOrientationEventListener& listener)
121 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
122 SysAssertf(pImpl != null,
123 "Not yet constructed. Construct() should be called before use.");
125 pImpl->RemoveOrientationEventListener(listener);
129 Frame::RemoveFrameEventListener(IFrameEventListener& listener)
131 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
132 SysAssertf(pImpl != null,
133 "Not yet constructed. Construct() should be called before use.");
135 pImpl->RemoveFrameEventListener(listener);
141 Frame::GetCurrentForm(void) const
143 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
144 SysAssertf(pImpl != null,
145 "Not yet constructed. Construct() should be called before use.");
147 _FormImpl* pFormImpl = pImpl->GetCurrentForm();
148 SysTryReturn(NID_UI_CTRL, pFormImpl, null, E_INVALID_STATE, "[E_INVALID_STATE] The current Form does not exist.");
150 return &pFormImpl->GetPublic();
154 Frame::SetCurrentForm(const Form& form)
156 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
157 SysAssertf(pImpl != null,
158 "Not yet constructed. Construct() should be called before use.");
160 result r = pImpl->SetCurrentForm(*_FormImpl::GetInstance(form));
161 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
167 Frame::SetCurrentForm(Form* pForm)
169 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
170 SysAssertf(pImpl != null,
171 "Not yet constructed. Construct() should be called before use.");
173 result r = pImpl->SetCurrentForm(_FormImpl::GetInstance(*pForm));
174 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
181 Frame::GetBackgroundColor(void) const
183 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
184 SysAssertf(pImpl != null,
185 "Not yet constructed. Construct() should be called before use.");
187 return pImpl->GetBackgroundColor();
191 Frame::SetBackgroundColor(const Color& color)
193 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
194 SysAssertf(pImpl != null,
195 "Not yet constructed. Construct() should be called before use.");
197 pImpl->SetBackgroundColor(color);
201 Frame::SetOrientation(Orientation orientation)
203 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
204 SysAssertf(pImpl != null,
205 "Not yet constructed. Construct() should be called before use.");
207 pImpl->SetOrientation(orientation);
211 Frame::GetOrientation(void) const
213 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
214 SysAssertf(pImpl != null,
215 "Not yet constructed. Construct() should be called before use.");
217 return pImpl->GetOrientation();
221 Frame::GetOrientationStatus(void) const
223 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
224 SysAssertf(pImpl != null,
225 "Not yet constructed. Construct() should be called before use.");
227 return pImpl->GetOrientationStatus();
231 Frame::GetFrameAnimator(void) const
233 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
234 SysAssertf(pImpl != null,
235 "Not yet constructed. Construct() should be called before use.");
237 return pImpl->GetFrameAnimator();
241 Frame::SetShowMode(FrameShowMode mode)
243 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
244 SysAssertf(pImpl != null,
245 "Not yet constructed. Construct() should be called before use.");
247 return pImpl->SetShowMode(mode);
251 Frame::GetShowMode(void) const
253 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
254 SysAssertf(pImpl != null,
255 "Not yet constructed. Construct() should be called before use.");
257 return pImpl->GetShowMode();
260 }}} // Tizen::Ui::Constrols