Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / controls / FUiCtrl_ListItemCommon.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19  * @file        FUiCtrl_ListItemCommon.cpp
20  * @brief       This is the implementation file for _ListItemCommon class.
21  *
22  * This file contains the implementation of _ListItemCommon class.
23  */
24
25
26 #include <FBaseSysLog.h>
27 #include "FUiCtrl_ListItemCommon.h"
28
29 #ifdef MEMORY_LEAK_CHECK
30 #include "mem_leak_check.h"
31 #endif
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 _ListItemCommon::_ListItemCommon(void)
37         : __pAppInfo(null)
38         , __refCount(1)
39         , __itemHeight(0)
40         , __checkedState(false)
41         , __enabledState(true)
42         , __itemChanged(true)
43         , __itemType(LIST_ITEM_TYPE_CUSTOM)
44         , __reorderMode(false)
45 {
46
47 }
48
49 _ListItemCommon::~_ListItemCommon(void)
50 {
51         __pAppInfo = null;
52 }
53
54 int
55 _ListItemCommon::GetItemHeight(void) const
56 {
57         return __itemHeight;
58 }
59
60 void
61 _ListItemCommon::SetItemHeight(int itemHeight)
62 {
63         __itemHeight = itemHeight;
64 }
65
66 void
67 _ListItemCommon::SetChecked(bool checked)
68 {
69         __checkedState = checked;
70 }
71
72 bool
73 _ListItemCommon::IsChecked(void) const
74 {
75         return __checkedState;
76 }
77
78 void
79 _ListItemCommon::SetItemEnabled(bool enabled)
80 {
81         __enabledState = enabled;
82 }
83
84 bool
85 _ListItemCommon::IsItemEnabled(void) const
86 {
87         return __enabledState;
88 }
89
90 ListItemType
91 _ListItemCommon::GetItemType(void) const
92 {
93         return __itemType;
94 }
95
96 void
97 _ListItemCommon::SetItemType(ListItemType itemType)
98 {
99         __itemType = itemType;
100 }
101
102 bool
103 _ListItemCommon::IsReorderMode(void) const
104 {
105         return __reorderMode;
106 }
107
108 void
109 _ListItemCommon::SetReorderMode(bool enabled)
110 {
111         __reorderMode = enabled;
112 }
113
114 void
115 _ListItemCommon::SetAppInfo(const void* pAppInfo)
116 {
117         __pAppInfo = const_cast<void*>(pAppInfo);
118 }
119
120 void*
121 _ListItemCommon::GetAppInfo(void) const
122 {
123         return __pAppInfo;
124 }
125
126 void
127 _ListItemCommon::SetItemChanged(bool changed)
128 {
129         __itemChanged = changed;
130 }
131
132 bool
133 _ListItemCommon::IsItemChanged(void) const
134 {
135         return __itemChanged;
136 }
137
138 int
139 _ListItemCommon::AddRef(void)
140 {
141         return ++__refCount;
142 }
143
144 int
145 _ListItemCommon::Release(void)
146 {
147         --__refCount;
148         if (__refCount <= 0)
149         {
150                 delete this;
151                 return 0;
152         }
153
154         return __refCount;
155 }
156
157 }}} // Tizen::Ui::Controls
158