Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_UiListViewItemEvent.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_UiListViewItemEvent.cpp
20  * @brief       This is the implementation file for _UiListViewItemEvent class.
21  *
22  * This file contains the implementation of _UiListViewItemEvent class.
23  */
24
25 #include <FBaseErrors.h>
26 #include <FBaseSysLog.h>
27 #include "FUiCtrl_IUiListViewItemEventListener.h"
28 #include "FUiCtrl_UiListViewItemEvent.h"
29 #include "FUiCtrl_UiListViewItemEventArg.h"
30
31 using namespace Tizen::Base::Runtime;
32 using namespace Tizen::Ui;
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36
37 _UiListViewItemEvent::_UiListViewItemEvent(void)
38 {
39
40 }
41
42 _UiListViewItemEvent::~_UiListViewItemEvent(void)
43 {
44
45 }
46
47 void
48 _UiListViewItemEvent::SetSource(_Control* pSource) // temporary code
49 {
50         __pSource = pSource;
51 }
52
53 void
54 _UiListViewItemEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
55 {
56         // cast to _ItemEventArg
57         _UiListViewItemEventArg* pEventArg = dynamic_cast<_UiListViewItemEventArg*>(const_cast<IEventArg*>(&arg));
58         SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, E_INVALID_ARG, ("[E_INVALID_ARG] event argument is invalid type."));
59
60         int index1 = pEventArg->GetArg1();
61         int index2 = pEventArg->GetArg2();
62         int index3 = pEventArg->GetArg3();
63
64         if (index3 < 0)
65         {
66                 index3 = -1;
67         }
68
69         _IUiListViewItemEventListener* pListener = dynamic_cast<_IUiListViewItemEventListener*>(&listener);
70         SysTryReturnVoidResult(NID_UI_CTRL, pListener != null, E_INVALID_ARG, ("[E_INVALID_ARG] invalid listener type."));
71
72         switch (pEventArg->GetNotifyType())
73         {
74         case NOTIFY_TYPE_CONTEXTITEM_SELCTED:
75                 pListener->OnListViewContextItemStateChanged(*__pSource, index1, index2, index3, LIST_CONTEXT_ITEM_STATUS_SELECTED);
76                 break;
77
78         case NOTIFY_TYPE_CONTEXTITEM_HIGHLIGHTED:
79                 pListener->OnListViewContextItemStateChanged(*__pSource, index1, index2, index3, LIST_CONTEXT_ITEM_STATUS_HIGHLIGHTED);
80                 break;
81
82         default:
83                 return;
84         }
85 }
86
87 }}} // Tizen::Ui::Controls
88