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 FUiCtrlSplitPanel.cpp
20 * @brief This file contains implementation of SplitPanel class
24 #include <FUiCtrlSplitPanel.h>
25 #include <FBaseSysLog.h>
26 #include "FUiCtrl_SplitPanelImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
31 namespace Tizen { namespace Ui { namespace Controls
34 SplitPanel::SplitPanel(void)
39 SplitPanel::~SplitPanel(void)
45 SplitPanel::Construct(const Tizen::Graphics::Rectangle& rect, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection)
48 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
50 SysAssertf(pSplitPanelImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
52 pSplitPanelImpl = _SplitPanelImpl::CreateSplitPanelImplN(this, rect, splitPanelDividerStyle, splitPanelDividerDirection);
53 SysTryReturnResult(NID_UI_CTRL, pSplitPanelImpl, GetLastResult(), "Propagating.");
55 _pControlImpl = pSplitPanelImpl;
57 r = pSplitPanelImpl->Initialize(rect);
58 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
63 delete pSplitPanelImpl;
70 SplitPanel::Construct(const Tizen::Graphics::FloatRectangle& rect, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection)
73 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
75 SysAssertf(pSplitPanelImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
77 pSplitPanelImpl = _SplitPanelImpl::CreateSplitPanelImplFN(this, rect, splitPanelDividerStyle, splitPanelDividerDirection);
78 SysTryReturnResult(NID_UI_CTRL, pSplitPanelImpl, GetLastResult(), "Propagating.");
80 _pControlImpl = pSplitPanelImpl;
82 r = pSplitPanelImpl->InitializeF(rect);
83 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
88 delete pSplitPanelImpl;
95 SplitPanel::SetPane(Control* pControl, SplitPanelPaneOrder paneOrder)
97 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
98 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
100 if (pControl == null)
102 return pSplitPanelImpl->SetPane(null, paneOrder);
105 _ControlImpl* pImpl = _ControlImpl::GetInstance(*pControl);
106 SysAssertf(pImpl != null, "Parameter pControl is not yet constructed. Construct() should be called before use.");
108 return pSplitPanelImpl->SetPane(pImpl, paneOrder);
112 SplitPanel::GetPane(SplitPanelPaneOrder paneOrder) const
114 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
115 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
117 _ControlImpl* pSplitPaneImpl = pSplitPanelImpl->GetPane(paneOrder);
118 result r = GetLastResult();
119 SysTryReturn(NID_UI_CTRL, pSplitPaneImpl, null, r, "[%s] Propagating.", GetErrorMessage(r));
120 return &(pSplitPaneImpl->GetPublic());
124 SplitPanel::SetDividerPosition(int position)
126 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
127 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
129 return pSplitPanelImpl->SetDividerPosition(position);
133 SplitPanel::SetDividerPosition(float position)
135 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
136 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
138 return pSplitPanelImpl->SetDividerPosition(position);
142 SplitPanel::GetDividerPosition(void) const
144 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
145 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
147 return pSplitPanelImpl->GetDividerPosition();
151 SplitPanel::GetDividerPositionF(void) const
153 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
154 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
156 return pSplitPanelImpl->GetDividerPositionF();
160 SplitPanel::SetMaximumDividerPosition(int position)
162 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
163 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
165 return pSplitPanelImpl->SetMaximumDividerPosition(position);
169 SplitPanel::SetMaximumDividerPosition(float position)
171 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
172 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
174 return pSplitPanelImpl->SetMaximumDividerPosition(position);
178 SplitPanel::GetMaximumDividerPosition(void) const
180 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
181 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
183 return pSplitPanelImpl->GetMaximumDividerPosition();
187 SplitPanel::GetMaximumDividerPositionF(void) const
189 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
190 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
192 return pSplitPanelImpl->GetMaximumDividerPositionF();
196 SplitPanel::SetMinimumDividerPosition(int position)
198 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
199 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
201 return pSplitPanelImpl->SetMinimumDividerPosition(position);
205 SplitPanel::SetMinimumDividerPosition(float position)
207 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
208 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
210 return pSplitPanelImpl->SetMinimumDividerPosition(position);
214 SplitPanel::GetMinimumDividerPosition(void) const
216 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
217 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
219 return pSplitPanelImpl->GetMinimumDividerPosition();
223 SplitPanel::GetMinimumDividerPositionF(void) const
225 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
226 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
228 return pSplitPanelImpl->GetMinimumDividerPositionF();
232 SplitPanel::MaximizePane(SplitPanelPaneOrder paneOrder)
234 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
235 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
237 return pSplitPanelImpl->MaximizePane(paneOrder);
241 SplitPanel::IsPaneMaximized(SplitPanelPaneOrder paneOrder) const
243 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
244 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
246 return pSplitPanelImpl->IsPaneMaximized(paneOrder);
250 SplitPanel::RestorePane(void)
252 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
253 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
255 return pSplitPanelImpl->RestorePane();
259 SplitPanel::AddSplitPanelEventListener(ISplitPanelEventListener& listener)
261 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
262 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
264 return pSplitPanelImpl->AddSplitPanelEventListener(listener);
268 SplitPanel::AddSplitPanelEventListener(ISplitPanelEventListenerF& listener)
270 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
271 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
273 return pSplitPanelImpl->AddSplitPanelEventListener(listener);
277 SplitPanel::RemoveSplitPanelEventListener(ISplitPanelEventListener& listener)
279 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
280 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
282 return pSplitPanelImpl->RemoveSplitPanelEventListener(listener);
286 SplitPanel::RemoveSplitPanelEventListener(ISplitPanelEventListenerF& listener)
288 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
289 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
291 return pSplitPanelImpl->RemoveSplitPanelEventListener(listener);
294 }}} // Tizen::Ui::Controls