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 FUiCtrlCustomListItemFormat.cpp
20 * @brief This file contains implementation of CustomListItemFormat class
23 #include <FGrpBitmap.h>
24 #include <FGrpRectangle.h>
25 #include <FUiCtrlCustomListItemFormat.h>
26 #include <FBaseSysLog.h>
27 #include "FUiCtrl_CustomListItemFormatImpl.h"
29 using namespace Tizen::Graphics;
31 namespace Tizen { namespace Ui { namespace Controls
34 CustomListItemFormat::CustomListItemFormat(void)
35 :__pCustomListItemFormatImpl(null)
39 CustomListItemFormat::~CustomListItemFormat(void)
41 delete __pCustomListItemFormatImpl;
42 __pCustomListItemFormatImpl = null;
46 CustomListItemFormat::Construct(void)
48 SysAssertf((__pCustomListItemFormatImpl == null),
49 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
51 __pCustomListItemFormatImpl = _CustomListItemFormatImpl::CreateInstanceN();
52 result r = GetLastResult();
53 SysTryReturn(NID_UI_CTRL, __pCustomListItemFormatImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
59 CustomListItemFormat::AddElement(int elementId, const Rectangle& rect)
61 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
63 SysTryReturnResult(NID_UI_CTRL, (rect.width > 0 && rect.height >0), E_INVALID_ARG, "The width and height should be greater than 0.");
65 result r = __pCustomListItemFormatImpl->AddElement(elementId, rect);
66 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] A System error occurred.", GetErrorMessage(r));
73 CustomListItemFormat::AddElement(int elementId, const Rectangle& rect, int textSize)
75 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
77 SysTryReturnResult(NID_UI_CTRL, (rect.width > 0 && rect.height >0), E_INVALID_ARG, "The width and height should be greater than 0.");
79 result r = __pCustomListItemFormatImpl->AddElement(elementId, rect, textSize);
80 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] A System error occurred.", GetErrorMessage(r));
86 CustomListItemFormat::AddElement(int elementId, const Rectangle& rect, int textSize, const Color& normalTextColor, const Color& focusedTextColor)
88 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
90 SysTryReturnResult(NID_UI_CTRL, (rect.width > 0 && rect.height >0), E_INVALID_ARG, "The width and height should be greater than 0.");
92 result r = __pCustomListItemFormatImpl->AddElement(elementId, rect, textSize, normalTextColor, focusedTextColor);
93 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] A System error occurred.", GetErrorMessage(r));
99 CustomListItemFormat::AddElement(int elementId, const Rectangle& rect, int textSize, const Color& normalTextColor, const Color& focusedTextColor, const Color& highlightedTextColor)
101 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
103 SysTryReturnResult(NID_UI_CTRL, (rect.width > 0 && rect.height >0), E_INVALID_ARG, "The width and height should be greater than 0.");
105 result r = __pCustomListItemFormatImpl->AddElement(elementId, rect, textSize, normalTextColor, focusedTextColor, highlightedTextColor);
106 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] A System error occurred.", GetErrorMessage(r));
112 CustomListItemFormat::GetElement(int elementId) const
114 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
115 SetLastResult(E_SUCCESS);
116 return __pCustomListItemFormatImpl->GetElement(elementId);
120 CustomListItemFormat::GetFirstElementId(void) const
122 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
123 SetLastResult(E_SUCCESS);
124 return __pCustomListItemFormatImpl->GetFirstElementId();
128 CustomListItemFormat::GetNextElementId(int elementId) const
130 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
131 SetLastResult(E_SUCCESS);
132 return __pCustomListItemFormatImpl->GetNextElementId(elementId);
136 CustomListItemFormat::GetFirstEnabledElementId(void) const
138 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
139 SetLastResult(E_SUCCESS);
140 return __pCustomListItemFormatImpl->GetFirstEnabledElementId();
144 CustomListItemFormat::GetNextEnabledElementId(int elementId) const
146 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
147 SetLastResult(E_SUCCESS);
148 return __pCustomListItemFormatImpl->GetNextEnabledElementId(elementId);
152 CustomListItemFormat::GetPreviousEnabledElementId(int elementId) const
154 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
155 SetLastResult(E_SUCCESS);
156 return __pCustomListItemFormatImpl->GetPreviousEnabledElementId(elementId);
160 CustomListItemFormat::SetElementEventEnabled(int elementId, bool enable)
162 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
163 SetLastResult(E_SUCCESS);
164 __pCustomListItemFormatImpl->SetElementEventEnabled(elementId, enable);
168 CustomListItemFormat::IsElementEventEnabled(int elementId)
170 SysAssertf((__pCustomListItemFormatImpl != null), "Not yet constructed. Construct() should be called before use.");
171 SetLastResult(E_SUCCESS);
172 return __pCustomListItemFormatImpl->IsElementEventEnabled(elementId);
175 }}} //Tizen::Ui::Controls