2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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
9 // http://floralicense.org/license/
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.
18 #include <FBaseInteger.h>
19 #include <FBaseSysLog.h>
20 #include "FUiScenes_SceneTransitionImpl.h"
22 using namespace Tizen::Base;
24 namespace Tizen { namespace Ui { namespace Scenes
27 _SceneTransitionImpl::_SceneTransitionImpl(void)
28 : __direction(SCENE_TRANSITION_DIRECTION_FORWARD)
29 , __destinationSceneId("")
30 , __animationType(SCENE_TRANSITION_ANIMATION_TYPE_NONE)
31 , __historyOption(SCENE_HISTORY_OPTION_ADD_HISTORY)
32 , __destroyOption(SCENE_DESTROY_OPTION_KEEP)
37 _SceneTransitionImpl::_SceneTransitionImpl(const _SceneTransitionImpl& rhs)
38 : __direction(rhs.__direction)
39 , __destinationSceneId(rhs.__destinationSceneId)
40 , __animationType(rhs.__animationType)
41 , __historyOption(rhs.__historyOption)
42 , __destroyOption(rhs.__destroyOption)
47 _SceneTransitionImpl::_SceneTransitionImpl(SceneTransitionDirection direction, const SceneId& destinationSceneId,
48 SceneTransitionAnimationType animationType,
49 SceneHistoryOption historyOption, SceneDestroyOption destroyOption)
50 : __direction(direction)
51 , __destinationSceneId(destinationSceneId)
52 , __animationType(animationType)
53 , __historyOption(historyOption)
54 , __destroyOption(destroyOption)
60 _SceneTransitionImpl::operator=(const _SceneTransitionImpl& rhs)
64 __direction = rhs.__direction;
65 __destinationSceneId = rhs.__destinationSceneId;
66 __animationType = rhs.__animationType;
67 __historyOption = rhs.__historyOption;
68 __destroyOption = rhs.__destroyOption;
74 _SceneTransitionImpl::Equals(const _SceneTransitionImpl& rhs) const
76 return ((__direction == rhs.__direction) &&
77 (__destinationSceneId == rhs.__destinationSceneId) &&
78 (__animationType == rhs.__animationType) &&
79 (__historyOption == rhs.__historyOption) &&
80 (__destroyOption == rhs.__destroyOption));
84 _SceneTransitionImpl::GetHashCode(void) const
89 intValue = Integer(static_cast<int>(__direction));
90 hashMaker += intValue.ToString();
92 hashMaker += __destinationSceneId;
94 intValue = Integer(static_cast<int>(__animationType));
95 hashMaker += intValue.ToString();
97 intValue = Integer(static_cast<int>(__historyOption));
98 hashMaker += intValue.ToString();
100 intValue = Integer(static_cast<int>(__destroyOption));
101 hashMaker += intValue.ToString();
103 return hashMaker.GetHashCode();
106 _SceneTransitionImpl::~_SceneTransitionImpl(void)
112 _SceneTransitionImpl::SetDirection(SceneTransitionDirection direction)
114 SysTryReturnResult(NID_UI_SCENES,
115 ((direction == SCENE_TRANSITION_DIRECTION_FORWARD) || (direction == SCENE_TRANSITION_DIRECTION_BACKWARD)),
116 E_INVALID_ARG, "Invalid argument is used.");
117 __direction = direction;
121 SceneTransitionDirection
122 _SceneTransitionImpl::GetDirection(void) const
128 _SceneTransitionImpl::SetDestinationSceneId(const SceneId& sceneId)
130 SysTryReturnResult(NID_UI_SCENES, (sceneId.GetLength()>0), E_INVALID_ARG, "Invalid argument is used.");
131 __destinationSceneId = sceneId;
136 _SceneTransitionImpl::GetDestinationSceneId(void) const
138 return __destinationSceneId;
142 _SceneTransitionImpl::SetAnimationType(SceneTransitionAnimationType animationType)
144 SysTryReturnResult(NID_UI_SCENES, (SCENE_TRANSITION_ANIMATION_TYPE_LEFT <= animationType &&
145 animationType <= SCENE_TRANSITION_ANIMATION_TYPE_DEPTH_OUT),
146 E_INVALID_ARG, "Invalid argument is used.");
147 __animationType = animationType;
151 SceneTransitionAnimationType
152 _SceneTransitionImpl::GetAnimationType(void) const
154 return __animationType;
158 _SceneTransitionImpl::SetHistoryOption(SceneHistoryOption historyOption)
160 SysTryReturnResult(NID_UI_SCENES,
161 ((historyOption == SCENE_HISTORY_OPTION_ADD_HISTORY) || (historyOption == SCENE_HISTORY_OPTION_NO_HISTORY)),
162 E_INVALID_ARG, "Invalid argument is used.");
163 __historyOption = historyOption;
168 _SceneTransitionImpl::GetHistoryOption(void) const
170 return __historyOption;
174 _SceneTransitionImpl::SetDestroyOption(SceneDestroyOption destroyOption)
176 SysTryReturnResult(NID_UI_SCENES,
177 ((destroyOption == SCENE_DESTROY_OPTION_KEEP) || (destroyOption == SCENE_DESTROY_OPTION_DESTROY)),
178 E_INVALID_ARG, "Invalid argument is used.");
179 __destroyOption = destroyOption;
184 _SceneTransitionImpl::GetDestroyOption(void) const
186 return __destroyOption;
189 _SceneTransitionImpl*
190 _SceneTransitionImpl::GetInstance(SceneTransition& scene)
192 return scene.__pSceneTransitionImpl;
195 const _SceneTransitionImpl*
196 _SceneTransitionImpl::GetInstance(const SceneTransition& scene)
198 return scene.__pSceneTransitionImpl;
201 } } } // Tizen::Ui::Scenes