Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / FUi_PropertyBase.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  * @file                FUI_PropertyBase.cpp
19  * @brief               This is the implementation file for _PropertyBase class.
20  */
21
22 #include <new>
23 #include <FBaseSysLog.h>
24 #include "FUi_PropertyBase.h"
25
26 using namespace Tizen::Base;
27
28 namespace Tizen { namespace Ui
29 {
30
31 // PropertyBase class
32 _PropertyBase::_PropertyBase(void)
33         : __pPropertyChangeEventListener(null)
34 {
35 }
36
37 _PropertyBase::~_PropertyBase(void)
38 {
39         __pPropertyChangeEventListener = null;
40 }
41
42 result
43 _PropertyBase::SetProperty(const String& name, const Variant& value)
44 {
45         SetLastResult(E_OBJ_NOT_FOUND);
46         return E_KEY_NOT_FOUND;
47 }
48
49 Variant
50 _PropertyBase::GetProperty(const String& name) const
51 {
52         SetLastResult(E_KEY_NOT_FOUND);
53         return Variant::NULL_VARIANT;
54 }
55
56 bool
57 _PropertyBase::IsPropertyChangeEventListenerAdded(void) const
58 {
59         return (__pPropertyChangeEventListener != null);
60 }
61
62 result
63 _PropertyBase::AddPropertyChangeEventListener(const Tizen::Ui::_IPropertyChangeEventListener& listener)
64 {
65         return SetPropertyChangeEventListener(&listener);
66 }
67
68 result
69 _PropertyBase::RemovePropertyChangeEventListener(const Tizen::Ui::_IPropertyChangeEventListener& listener)
70 {
71         ClearLastResult();
72         __pPropertyChangeEventListener = null;
73
74         return E_SUCCESS;
75 }
76
77 result
78 _PropertyBase::SetPropertyChangeEventListener(const Tizen::Ui::_IPropertyChangeEventListener* pListener)
79 {
80         ClearLastResult();
81
82         __pPropertyChangeEventListener = const_cast<_IPropertyChangeEventListener*>(pListener);
83
84         return E_SUCCESS;
85 }
86
87 bool
88 _PropertyBase::FirePropertyEvent(const Tizen::Ui::_PropertyBase& source, const String& name, const Variant& oldValue, const Variant& newValue, bool isChangedEvent)
89 {
90         ClearLastResult();
91
92         if (!__pPropertyChangeEventListener)
93         {
94                 return true;
95         }
96
97         if (isChangedEvent)
98         {
99                 __pPropertyChangeEventListener->OnPropertyChanged(const_cast<_PropertyBase&>(source), name, oldValue, newValue);
100         }
101         else
102         {
103                 __pPropertyChangeEventListener->OnPropertyChanging(const_cast<_PropertyBase&>(source), name, oldValue, newValue);
104         }
105
106         return true;
107 }
108
109 } } //Tizen::Ui
110