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.
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::SetPane(Control* pControl, SplitPanelPaneOrder paneOrder)
72 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
73 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
75 return pSplitPanelImpl->SetPane(const_cast <_ControlImpl*>(_ControlImpl::GetInstance(*pControl)), paneOrder);
79 SplitPanel::GetPane(SplitPanelPaneOrder paneOrder) const
81 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
82 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
84 _ControlImpl* pSplitPaneImpl = pSplitPanelImpl->GetPane(paneOrder);
85 result r = GetLastResult();
86 SysTryReturn(NID_UI_CTRL, pSplitPaneImpl, null, r, "[%s] Propagating.", GetErrorMessage(r));
87 return &(pSplitPaneImpl->GetPublic());
91 SplitPanel::SetDividerPosition(int position)
93 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
94 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
96 return pSplitPanelImpl->SetDividerPosition(position);
100 SplitPanel::GetDividerPosition(void) const
102 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
103 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
105 return pSplitPanelImpl->GetDividerPosition();
109 SplitPanel::SetMaximumDividerPosition(int position)
111 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
112 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
114 return pSplitPanelImpl->SetMaximumDividerPosition(position);
118 SplitPanel::GetMaximumDividerPosition(void) const
120 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
121 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
123 return pSplitPanelImpl->GetMaximumDividerPosition();
127 SplitPanel::SetMinimumDividerPosition(int position)
129 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
130 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
132 return pSplitPanelImpl->SetMinimumDividerPosition(position);
136 SplitPanel::GetMinimumDividerPosition(void) const
138 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
139 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
141 return pSplitPanelImpl->GetMinimumDividerPosition();
145 SplitPanel::MaximizePane(SplitPanelPaneOrder paneOrder)
147 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
148 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
150 return pSplitPanelImpl->MaximizePane(paneOrder);
154 SplitPanel::IsPaneMaximized(SplitPanelPaneOrder paneOrder) const
156 const _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
157 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
159 return pSplitPanelImpl->IsPaneMaximized(paneOrder);
163 SplitPanel::RestorePane(void)
165 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
166 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
168 return pSplitPanelImpl->RestorePane();
172 SplitPanel::AddSplitPanelEventListener(ISplitPanelEventListener& listener)
174 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
175 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
177 return pSplitPanelImpl->AddSplitPanelEventListener(listener);
181 SplitPanel::RemoveSplitPanelEventListener(ISplitPanelEventListener& listener)
183 _SplitPanelImpl* pSplitPanelImpl = _SplitPanelImpl::GetInstance(*this);
184 SysAssertf(pSplitPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
186 return pSplitPanelImpl->RemoveSplitPanelEventListener(listener);
189 }}} // Tizen::Ui::Controls