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 FUiCtrl_CustomElement.cpp
20 * @brief This is the implementation file for _CustomElement class.
22 * This file contains the implementation of _CustomElement class.
25 #include <FBaseSysLog.h>
26 #include <FUiCtrlICustomElement.h>
27 #include <FUiCtrlICustomElementF.h>
28 #include "FUi_CoordinateSystemUtils.h"
29 #include "FUiCtrl_CustomElement.h"
31 #ifdef MEMORY_LEAK_CHECK
32 #include "mem_leak_check.h"
35 using namespace Tizen::Graphics;
37 namespace Tizen { namespace Ui { namespace Controls
40 _CustomElement::_CustomElement(int elementId)
43 , __elementId(elementId)
44 , __usingFloatingPoint(false)
48 _CustomElement::~_CustomElement(void)
53 _CustomElement::GetElementId(void) const
59 _CustomElement::DrawElement(Canvas* pCanvas, FloatRectangle& rect, ListViewItemDrawingStatus status)
63 if (__usingFloatingPoint)
67 case LISTVIEW_ITEM_STATUS_NORMAL:
68 result = __pElementF->OnDraw(*pCanvas, rect, LIST_ITEM_DRAWING_STATUS_NORMAL);
71 case LISTVIEW_ITEM_STATUS_PRESSED:
72 result = __pElementF->OnDraw(*pCanvas, rect, LIST_ITEM_DRAWING_STATUS_PRESSED);
75 case LISTVIEW_ITEM_STATUS_HIGHLIGHTED:
76 result = __pElementF->OnDraw(*pCanvas, rect, LIST_ITEM_DRAWING_STATUS_HIGHLIGHTED);
80 result = __pElementF->OnDraw(*pCanvas, rect, LIST_ITEM_DRAWING_STATUS_NORMAL);
88 case LISTVIEW_ITEM_STATUS_NORMAL:
89 result = __pElement->OnDraw(*pCanvas, _CoordinateSystemUtils::ConvertToInteger(rect), LIST_ITEM_DRAWING_STATUS_NORMAL);
92 case LISTVIEW_ITEM_STATUS_PRESSED:
93 result = __pElement->OnDraw(*pCanvas, _CoordinateSystemUtils::ConvertToInteger(rect), LIST_ITEM_DRAWING_STATUS_PRESSED);
96 case LISTVIEW_ITEM_STATUS_HIGHLIGHTED:
97 result = __pElement->OnDraw(*pCanvas, _CoordinateSystemUtils::ConvertToInteger(rect), LIST_ITEM_DRAWING_STATUS_HIGHLIGHTED);
101 result = __pElement->OnDraw(*pCanvas, _CoordinateSystemUtils::ConvertToInteger(rect), LIST_ITEM_DRAWING_STATUS_NORMAL);
110 _CustomElement::SetElement(const ICustomElement& element)
112 __usingFloatingPoint = false;
113 __pElement = const_cast <ICustomElement*>(&element);
117 _CustomElement::SetElement(const ICustomElementF& element)
119 __usingFloatingPoint = true;
120 __pElementF = const_cast <ICustomElementF*>(&element);
123 }}} // Tizen::Ui::Controls