Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_IconListData.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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_IconListData.cpp
20  * @brief       This is the implementation file for _IconListData class
21  *
22  * This file contains the implementation of _IconListData class
23  */
24
25 #include "FUiCtrl_IconListData.h"
26
27 using namespace Tizen::Base;
28 using namespace Tizen::Ui;
29 using namespace Tizen::Graphics;
30
31 namespace Tizen { namespace Ui { namespace Controls
32 {
33
34 _IconListData::_IconListData(void)
35         : __pNormalBitmap(null)
36         , __pFocusedBitmap(null)
37         , __labelText()
38         , __itemId(-1)
39 {
40 }
41
42 _IconListData::~_IconListData(void)
43 {
44         delete __pNormalBitmap;
45         __pNormalBitmap = null;
46
47         delete __pFocusedBitmap;
48         __pFocusedBitmap = null;
49 }
50
51 const Bitmap*
52 _IconListData::GetNormalBitmap(void)
53 {
54         return __pNormalBitmap;
55 }
56
57 const Bitmap*
58 _IconListData::GetFocusedBitmap(void)
59 {
60         return __pFocusedBitmap;
61 }
62
63 const String
64 _IconListData::GetLabelText(void)
65 {
66         return __labelText;
67 }
68
69 int
70 _IconListData::GetItemId(void)
71 {
72         return __itemId;
73 }
74
75 void
76 _IconListData::SetNormalBitmap(const Bitmap* pNormalBitmap)
77 {
78
79         if (pNormalBitmap != null)
80         {
81                 __pNormalBitmap = new (std::nothrow) Bitmap();
82                 SysTryReturnVoidResult(NID_UI_CTRL, (__pNormalBitmap != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
83
84                 result r = __pNormalBitmap->Construct(*pNormalBitmap, Rectangle(0, 0, pNormalBitmap->GetWidth(), pNormalBitmap->GetHeight()));
85                 if (IsFailed(r))
86                 {
87                         SysLogException(NID_UI_CTRL, r, "[E_SYSTEM]Bitmap construct failed");
88                 }
89         }
90
91 }
92
93 void
94 _IconListData::SetFocusedBitmap(const Bitmap* pFocusedBitmap)
95 {
96         if (pFocusedBitmap != null)
97         {
98                 __pFocusedBitmap = new (std::nothrow) Bitmap();
99                 SysTryReturnVoidResult(NID_UI_CTRL, (__pFocusedBitmap != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
100
101                 result r = __pFocusedBitmap->Construct(*pFocusedBitmap, Rectangle(0, 0, pFocusedBitmap->GetWidth(), pFocusedBitmap->GetHeight()));
102                 if (IsFailed(r))
103                 {
104                         SysLogException(NID_UI_CTRL, r, "[E_SYSTEM]Bitmap construct failed");
105                 }
106         }
107 }
108
109 void
110 _IconListData::SetLabelText(const String& labelText)
111 {
112         __labelText = labelText;
113
114 }
115
116 void
117 _IconListData::SetItemId(int itemId)
118 {
119         __itemId = itemId;
120 }
121
122 }}} // Tizen::Ui::Controls