Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_UiIconListItemEvent.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_UiIconListItemEvent.cpp
20  * @brief       This is the implementation file for the _UiIconListItemEvent class.
21  */
22
23 #include <FBaseSysLog.h>
24
25 #include "FUiCtrl_IconListView.h"
26 #include "FUiCtrl_IconListViewItemEventArg.h"
27 #include "FUiCtrl_IIconListItemEventListener.h"
28 #include "FUiCtrl_UiIconListItemEvent.h"
29
30 namespace Tizen { namespace Ui { namespace Controls
31 {
32
33 _UiIconListItemEvent::_UiIconListItemEvent(void)
34         : __pSource(null)
35 {
36 }
37
38 _UiIconListItemEvent::~_UiIconListItemEvent(void)
39 {
40 }
41
42 result
43 _UiIconListItemEvent::Construct(const _IconListView& source)
44 {
45         result r = _Event::Initialize();
46
47         // set event source
48         if (r == E_SUCCESS)
49         {
50                 __pSource = const_cast <_IconListView*>(&source);
51         }
52
53         return r;
54 }
55
56 const _IconListView*
57 _UiIconListItemEvent::GetSource(void) const
58 {
59         return __pSource;
60 }
61
62 void
63 _UiIconListItemEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
64 {
65         // cast to IIconListItemEventListener
66         _IIconListItemEventListener* pItemListener = dynamic_cast<_IIconListItemEventListener*>(&listener);
67         SysTryReturnVoidResult(NID_UI_CTRL, (pItemListener != null), E_INVALID_ARG, "[E_INVALID_ARG] Invalid listener is used.");
68
69         // cast to _UiIconListItemEventArg
70         const _IconListViewItemEventArg* pItemEventArg = dynamic_cast<const _IconListViewItemEventArg*>(&arg);
71         SysTryReturnVoidResult(NID_UI_CTRL, (pItemEventArg != null), E_INVALID_ARG,
72                         "[E_INVALID_ARG] Invalid event argument is used.");
73
74         switch (pItemEventArg->GetEventType())
75         {
76         case EVENT_TYPE_ITEM_SELECTED:
77                 pItemListener->OnIconListItemStateChanged(const_cast<_IconListViewItemEventArg*>(pItemEventArg));
78                 break;
79         case EVENT_TYPE_OVERLAY_BITMAP_SELECTED:
80                 pItemListener->OnIconListViewOverlayBitmapSelected(const_cast<_IconListViewItemEventArg*>(pItemEventArg));
81                 break;
82         case EVENT_TYPE_ITEM_REORDERED:
83                 pItemListener->OnIconListViewItemReordered(const_cast<_IconListViewItemEventArg*>(pItemEventArg));
84                 break;
85         }
86
87         SetLastResult(E_SUCCESS);
88 }
89
90 }}} // Tizen::Ui::Controls