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 FUiCtrlGroupContainer.cpp
20 * @brief This is the implementation file for GroupContainer class.
23 #include <FBaseErrors.h>
24 #include <FBaseSysLog.h>
25 #include <FUiCtrlGroupContainer.h>
26 #include "FUiCtrl_GroupContainerImpl.h"
29 using namespace Tizen::Graphics;
31 namespace Tizen { namespace Ui { namespace Controls
34 GroupContainer::GroupContainer(void)
39 GroupContainer::~GroupContainer(void)
45 GroupContainer::Construct(const Rectangle& rect, int rowCount, int columnCount, int lineWidth)
48 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
49 SysAssertf(pGroupContainerImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
51 pGroupContainerImpl = _GroupContainerImpl::CreateGroupContainerImplN(this, rect, rowCount, columnCount, lineWidth);
54 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
56 pGroupContainerImpl->Initialize();
58 _pControlImpl = pGroupContainerImpl;
64 GroupContainer::Construct(const FloatRectangle& rect, int rowCount, int columnCount, float lineWidth)
67 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
68 SysAssertf(pGroupContainerImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
70 pGroupContainerImpl = _GroupContainerImpl::CreateGroupContainerImplFN(this, rect, rowCount, columnCount, lineWidth);
73 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
75 pGroupContainerImpl->Initialize();
77 _pControlImpl = pGroupContainerImpl;
83 GroupContainer::AddControlAt(Control& control, int rowIndex, int columnIndex)
85 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
86 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
88 return pGroupContainerImpl->AddControlAt(control, rowIndex, columnIndex);
92 GroupContainer::GetControlAt(int rowIndex, int columnIndex) const
94 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
95 SysAssertf(pGroupContainerImpl != null, "Not yet constructed! Construct() should be called before use.");
97 return pGroupContainerImpl->GetControlAt(rowIndex, columnIndex);
101 GroupContainer::GetControlAt(int rowIndex, int columnIndex)
103 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
104 SysAssertf(pGroupContainerImpl != null, "Not yet constructed! Construct() should be called before use.");
106 return pGroupContainerImpl->GetControlAt(rowIndex, columnIndex);
110 GroupContainer::RemoveControlAt(int rowIndex, int columnIndex)
112 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
113 SysAssertf(pGroupContainerImpl != null, "Not yet constructed! Construct() should be called before use.");
115 return pGroupContainerImpl->RemoveControlAt(rowIndex, columnIndex);
119 GroupContainer::SetColumnWidth(int columnIndex, int width)
121 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
122 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
124 return pGroupContainerImpl->SetColumnWidth(columnIndex, width);
128 GroupContainer::SetColumnWidth(int columnIndex, float width)
130 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
131 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
133 return pGroupContainerImpl->SetColumnWidth(columnIndex, width);
137 GroupContainer::GetColumnWidth(int columnIndex) const
139 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
140 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
142 return pGroupContainerImpl->GetColumnWidth(columnIndex);
146 GroupContainer::GetColumnWidthF(int columnIndex) const
148 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
149 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
151 return pGroupContainerImpl->GetColumnWidthF(columnIndex);
155 GroupContainer::SetRowHeight(int rowIndex, int height)
157 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
158 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
160 return pGroupContainerImpl->SetRowHeight(rowIndex, height);
164 GroupContainer::SetRowHeight(int rowIndex, float height)
166 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
167 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
169 return pGroupContainerImpl->SetRowHeight(rowIndex, height);
173 GroupContainer::GetRowHeight(int rowIndex) const
175 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
176 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
178 return pGroupContainerImpl->GetRowHeight(rowIndex);
182 GroupContainer::GetRowHeightF(int rowIndex) const
184 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
185 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
187 return pGroupContainerImpl->GetRowHeightF(rowIndex);
191 GroupContainer::Merge(int rowStartIndex, int columnStartIndex, int rowCount, int columnCount)
193 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
194 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
196 return pGroupContainerImpl->Merge(rowStartIndex, columnStartIndex, rowCount, columnCount);
200 GroupContainer::SetChildResizingEnabled(int rowIndex, int columnIndex, bool enable)
202 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
203 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
205 return pGroupContainerImpl->SetChildResizingEnabled(rowIndex, columnIndex, enable);
209 GroupContainer::SetMargin(int rowIndex, int columnIndex, int leftMargin, int topMargin, int rightMargin, int bottomMargin)
211 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
212 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
214 return pGroupContainerImpl->SetMargin(rowIndex, columnIndex, leftMargin, topMargin, rightMargin, bottomMargin);
218 GroupContainer::SetMargin(int rowIndex, int columnIndex, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
220 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
221 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
223 return pGroupContainerImpl->SetMargin(rowIndex, columnIndex, leftMargin, topMargin, rightMargin, bottomMargin);
227 GroupContainer::Split(int rowIndex, int columnIndex)
229 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
230 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
232 return pGroupContainerImpl->Split(rowIndex, columnIndex);
236 GroupContainer::GetBoundsAt(int rowIndex, int columnIndex) const
238 const _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
239 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
241 return pGroupContainerImpl->GetBoundsAt(rowIndex, columnIndex);
245 GroupContainer::GetBoundsAtF(int rowIndex, int columnIndex) const
247 const _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
248 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
250 return pGroupContainerImpl->GetBoundsAtF(rowIndex, columnIndex);
254 GroupContainer::SetColumnStretchable(int columnIndex, bool stretchable)
256 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
257 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
259 return pGroupContainerImpl->SetColumnStretchable(columnIndex, stretchable);
263 GroupContainer::IsColumnStretchable(int columnIndex) const
265 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
266 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
268 return pGroupContainerImpl->IsColumnStretchable(columnIndex);
272 GroupContainer::SetRowStretchable(int rowIndex, bool stretchable)
274 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
275 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
277 return pGroupContainerImpl->SetRowStretchable(rowIndex, stretchable);
281 GroupContainer::IsRowStretchable(int rowIndex) const
283 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
284 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
286 return pGroupContainerImpl->IsRowStretchable(rowIndex);
291 GroupContainer::GetBackgroundColor(void) const
293 const _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
294 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
296 return pGroupContainerImpl->GetBackgroundColor();
300 GroupContainer::SetBackgroundColor(const Color& color)
302 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
303 SysAssertf(pGroupContainerImpl != null, "Not yet constructed! Construct() should be called before use.");
305 pGroupContainerImpl->SetBackgroundColor(color);
306 result r = GetLastResult();
307 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
311 GroupContainer::GetLineColor(void) const
313 _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
314 SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
316 return pGroupContainerImpl->GetLineColor();
320 GroupContainer::SetLineColor(const Color& color)
322 _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
323 SysAssertf(pGroupContainerImpl != null, "Not yet constructed! Construct() should be called before use.");
325 pGroupContainerImpl->SetLineColor(color);
326 result r = GetLastResult();
327 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Unable to set the line color.");
330 }}} //Tizen::Ui::Controls