Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_IconListViewItemImpl.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_IconListViewItemImpl.cpp
20  * @brief               This is the implementation file for the _IconListViewItemImpl class.
21  */
22
23 // Includes
24 #include <FBaseSysLog.h>
25
26 #include "FUiCtrl_IconListItem.h"
27 #include "FUiCtrl_IconListViewItemImpl.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31
32 namespace Tizen { namespace Ui { namespace Controls
33 {
34
35 _IconListViewItemImpl::_IconListViewItemImpl(IconListViewItem* pIconListViewItem, _IconListItem* pItem)
36         : __pIconListViewItem(pIconListViewItem)
37         , __pIconListItem(pItem)
38 {
39         // nothing
40 }
41
42 _IconListViewItemImpl::~_IconListViewItemImpl(void)
43 {
44         __pIconListViewItem = null;
45
46         __pIconListItem->SetAppInfo(null);
47         __pIconListItem->Release();
48         __pIconListItem = null;
49 }
50
51 _IconListViewItemImpl*
52 _IconListViewItemImpl::CreateIconListViewItemImplN(IconListViewItem& pIconListViewItem, const Bitmap& bitmap,
53                 const String* pText, const Bitmap* pSelectedBitmap, const Bitmap* pHighlightedBitmap)
54 {
55         _IconListItem* pItem = _IconListItem::CreateIconListItemN(&pIconListViewItem);
56         SysTryReturn(NID_UI_CTRL, (pItem != null), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
57
58         _IconListViewItemImpl* pImpl = null;
59         result r = E_SUCCESS;
60         r = pItem->SetBitmap(ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL, &bitmap);
61         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
62
63         pImpl = new (std::nothrow) _IconListViewItemImpl(&pIconListViewItem, pItem);
64         SysTryCatch(NID_UI_CTRL, (pImpl != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
65
66         ClearLastResult();
67
68         pItem->SetText(pText);
69         pItem->SetBitmap(ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED, pSelectedBitmap);
70         pItem->SetBitmap(ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED, pHighlightedBitmap);
71
72         return pImpl;
73 CATCH:
74         delete pItem;
75         pItem = null;
76
77         return null;
78 }
79
80 result
81 _IconListViewItemImpl::SetOverlayBitmap(int overlayBitmapId, const Tizen::Graphics::Bitmap* pOverlayBitmap,
82                 HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
83 {
84         return __pIconListItem->SetOverlayBitmap(overlayBitmapId, pOverlayBitmap, horizontalAlignment, verticalAlignment);
85 }
86
87 }}} // Tizen::Ui::Controls