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 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::AddOrientationEventListener(IOrientationEventListener& listener)
82 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
83 SysAssertf(pImpl != null,
84 "Not yet constructed. Construct() should be called before use.");
86 pImpl->AddOrientationEventListener(listener);
90 Frame::AddFrameEventListener(IFrameEventListener& listener)
92 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
93 SysAssertf(pImpl != null,
94 "Not yet constructed. Construct() should be called before use.");
96 pImpl->AddFrameEventListener(listener);
100 Frame::RemoveOrientationEventListener(IOrientationEventListener& listener)
102 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
103 SysAssertf(pImpl != null,
104 "Not yet constructed. Construct() should be called before use.");
106 pImpl->RemoveOrientationEventListener(listener);
110 Frame::RemoveFrameEventListener(IFrameEventListener& listener)
112 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
113 SysAssertf(pImpl != null,
114 "Not yet constructed. Construct() should be called before use.");
116 pImpl->RemoveFrameEventListener(listener);
122 Frame::GetCurrentForm(void) const
124 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
125 SysAssertf(pImpl != null,
126 "Not yet constructed. Construct() should be called before use.");
128 _FormImpl* pFormImpl = pImpl->GetCurrentForm();
129 SysTryReturn(NID_UI_CTRL, pFormImpl, null, E_INVALID_STATE, "[E_INVALID_STATE] The current Form does not exist.");
131 return &pFormImpl->GetPublic();
135 Frame::SetCurrentForm(const Form& form)
137 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
138 SysAssertf(pImpl != null,
139 "Not yet constructed. Construct() should be called before use.");
141 result r = pImpl->SetCurrentForm(*_FormImpl::GetInstance(form));
142 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
148 Frame::GetBackgroundColor(void) const
150 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
151 SysAssertf(pImpl != null,
152 "Not yet constructed. Construct() should be called before use.");
154 return pImpl->GetBackgroundColor();
158 Frame::SetBackgroundColor(const Color& color)
160 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
161 SysAssertf(pImpl != null,
162 "Not yet constructed. Construct() should be called before use.");
164 pImpl->SetBackgroundColor(color);
168 Frame::SetOrientation(Orientation orientation)
170 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
171 SysAssertf(pImpl != null,
172 "Not yet constructed. Construct() should be called before use.");
174 pImpl->SetOrientation(orientation);
178 Frame::GetOrientation(void) const
180 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
181 SysAssertf(pImpl != null,
182 "Not yet constructed. Construct() should be called before use.");
184 return pImpl->GetOrientation();
188 Frame::GetOrientationStatus(void) const
190 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
191 SysAssertf(pImpl != null,
192 "Not yet constructed. Construct() should be called before use.");
194 return pImpl->GetOrientationStatus();
198 Frame::GetFrameAnimator(void) const
200 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
201 SysAssertf(pImpl != null,
202 "Not yet constructed. Construct() should be called before use.");
204 return pImpl->GetFrameAnimator();
208 Frame::SetShowMode(FrameShowMode mode)
210 _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
211 SysAssertf(pImpl != null,
212 "Not yet constructed. Construct() should be called before use.");
214 return pImpl->SetShowMode(mode);
218 Frame::GetShowMode(void) const
220 const _FrameImpl* pImpl = _FrameImpl::GetInstance(*this);
221 SysAssertf(pImpl != null,
222 "Not yet constructed. Construct() should be called before use.");
224 return pImpl->GetShowMode();
227 }}} // Tizen::Ui::Constrols