Fixing display errors in EditDate/EditTime
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_UiScrollEventArg.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_UiScrollEventArg.cpp
20 * @brief        This is the implementation for the _UiScrollEventArg class.
21 */
22
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_UiScrollEventArg.h"
25
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Runtime;
28
29 namespace Tizen { namespace Ui { namespace Controls
30 {
31
32 ////////////////////////////////////////////////////////////////////////////////
33 /// _UiScrollEventArg class Lifecycle
34
35 _UiScrollEventArg::_UiScrollEventArg(_ScrollEventType eventType, const _Control& source, float scrollPosition, ScrollEndEvent scrollType)
36         : __eventType(eventType)
37         , __pSource(const_cast <_Control*>(&source))
38         , __scrollPosition(scrollPosition)
39         , __scrollType(scrollType)
40 {
41         // nothing
42 }
43
44 _UiScrollEventArg::~_UiScrollEventArg(void)
45 {
46         // nothing
47 }
48
49 _UiScrollEventArg*
50 _UiScrollEventArg::GetScrollEventArgN(const _Control& source)
51 {
52         _UiScrollEventArg* pEventArg = new (std::nothrow) _UiScrollEventArg(SCROLL_EVENT_ON_SCROLL_STOPPED, source);
53         SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[%s] The memory is insufficient.", GetErrorMessage(E_OUT_OF_MEMORY));
54
55         return pEventArg;
56 }
57
58 _UiScrollEventArg*
59 _UiScrollEventArg::GetScrollJumpToTopEventArgN(const _Control& source)
60 {
61         _UiScrollEventArg* pEventArg = new (std::nothrow) _UiScrollEventArg(SCROLL_EVENT_ON_SCROLL_JUMP_TO_TOP, source);
62         SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[%s] The memory is insufficient.", GetErrorMessage(E_OUT_OF_MEMORY));
63
64         return pEventArg;
65 }
66
67 _UiScrollEventArg*
68 _UiScrollEventArg::GetScrollEventArgN(const _Control& source, float scrollPosition)
69 {
70         _UiScrollEventArg* pEventArg = new (std::nothrow) _UiScrollEventArg(SCROLL_EVENT_ON_SCROLL_POSITION_CHANGED, source, scrollPosition);
71         SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[%s] The memory is insufficient.", GetErrorMessage(E_OUT_OF_MEMORY));
72
73         return pEventArg;
74 }
75
76 _UiScrollEventArg*
77 _UiScrollEventArg::GetScrollEventArgN(const _Control& source, ScrollEndEvent scrollType)
78 {
79         _UiScrollEventArg* pEventArg = new (std::nothrow) _UiScrollEventArg(SCROLL_EVENT_ON_SCROLL_END_REACHED, source, -1.0f, scrollType);
80         SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[%s] The memory is insufficient.", GetErrorMessage(E_OUT_OF_MEMORY));
81
82         return pEventArg;
83 }
84
85 ////////////////////////////////////////////////////////////////////////////////
86 /// _UiScrollEventArg class Access
87 _ScrollEventType
88 _UiScrollEventArg::GetEventType(void) const
89 {
90         ClearLastResult();
91         return __eventType;
92 }
93
94 _Control*
95 _UiScrollEventArg::GetSource(void) const
96 {
97         ClearLastResult();
98         return __pSource;
99 }
100
101 ScrollEndEvent
102 _UiScrollEventArg::GetScrollType(void) const
103 {
104         ClearLastResult();
105         return __scrollType;
106 }
107
108 float
109 _UiScrollEventArg::GetScrollPosition(void) const
110 {
111         ClearLastResult();
112         return __scrollPosition;
113 }
114
115 }}}     // Tizen::Ui::Controls