(toolkit) fix klocwork issues
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / internal / controls / selectors / rotating-selector-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_CUSTOM_CHECK_ACTOR_H__
2 #define __DALI_TOOLKIT_INTERNAL_CUSTOM_CHECK_ACTOR_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/animation/animation.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/public-api/controls/selectors/rotating-selector.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36
37 class RotatingSelector;
38
39
40 /**
41  * RotatingSelector is a custom control for text aligning and multiline support
42  */
43 class RotatingSelector : public Control
44 {
45 public:
46
47   /**
48    * Create a new RotatingSelector.
49    * @return A smart-pointer to the newly allocated RotatingSelector.
50    */
51   static Dali::Toolkit::RotatingSelector New(Actor& unSelectedActor, Actor& selectedActor);
52
53   /**
54    * @copydoc Dali::Toolkit::RotatingSelector::SetSelected()
55    */
56   void SetSelected( bool toggle );
57
58   /**
59    * @copydoc Dali::Toolkit::RotatingSelector::IsSelected()
60    */
61   bool IsSelected() const {return mSelected;}
62
63   /**
64    * @copydoc Dali::Toolkit::RotatingSelector::SetSelectedActor()
65    */
66   void SetSelectedActor( Actor& selectedActor );
67
68   /**
69    * @copydoc Dali::Toolkit::RotatingSelector::GetSelectedActor()
70    */
71   Actor GetSelectedActor();
72
73   /**
74    * @copydoc Dali::Toolkit::RotatingSelector::SetUnSelectedActor()
75    */
76   void SetUnSelectedActor( Actor& unSelectedActor );
77
78   /**
79    * @copydoc Dali::Toolkit::RotatingSelector::GetUnSelectedActor()
80    */
81   Actor GetUnSelectedActor();
82
83   /**
84    * @copydoc Dali::Toolkit::RotatingSelector::SetSelectable()
85    */
86   void SetSelectable( bool selectable );
87
88   /**
89    * @copydoc Dali::Toolkit::RotatingSelector::IsSelectable()
90    */
91   bool IsSelectable()const {return mSelectable;}
92
93   /**
94    * @copydoc Dali::Toolkit::RotatingSelector::SelectedSignal()
95    */
96   Toolkit::RotatingSelector::SelectedSignalV2& SelectedSignal();
97
98   /**
99    * Connects a callback function with the object's signals.
100    * @param[in] object The object providing the signal.
101    * @param[in] tracker Used to disconnect the signal.
102    * @param[in] signalName The signal to connect to.
103    * @param[in] functor A newly allocated FunctorDelegate.
104    * @return True if the signal was connected.
105    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
106    */
107   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
108
109 private: // From Control
110
111   /**
112    * @copydoc Toolkit::Control::OnInitialize()
113    */
114   virtual void OnInitialize();
115
116   /**
117    * @copydoc Toolkit::Control::OnTouchEvent(const TouchEvent& event)
118    */
119   virtual bool OnTouchEvent( const TouchEvent& event );
120
121 protected:
122
123   /**
124    * Construct a new RotatingSelector.
125    */
126   RotatingSelector();
127
128   /**
129    * A reference counted object may only be deleted by calling Unreference()
130    */
131   virtual ~RotatingSelector();
132
133 private:
134
135   // Undefined
136   RotatingSelector(const RotatingSelector&);
137
138   // Undefined
139   RotatingSelector& operator=(const RotatingSelector& rhs);
140
141   void ToggleAndAnimateSelection();
142   void AnimationCompleted( Animation& animation );
143
144
145 private:
146
147   Actor mContainer;
148   bool  mSelected;
149   bool  mSelectable;
150
151   Actor mUnSelectedActor;
152   Actor mSelectedActor;
153   bool  mPressed;
154
155   Animation mRotateAnimation;
156
157   bool  mIsAnimating;
158
159   Toolkit::RotatingSelector::SelectedSignalV2 mCheckedSignalV2;
160 };
161
162 } // namespace Internal
163
164 // Helpers for public-api forwarding methods
165
166 inline Toolkit::Internal::RotatingSelector& GetImpl(Toolkit::RotatingSelector& RotatingSelector)
167 {
168   DALI_ASSERT_ALWAYS(RotatingSelector);
169
170   Dali::RefObject& handle = RotatingSelector.GetImplementation();
171
172   return static_cast<Toolkit::Internal::RotatingSelector&>(handle);
173 }
174
175 inline const Toolkit::Internal::RotatingSelector& GetImpl(const Toolkit::RotatingSelector& RotatingSelector)
176 {
177   DALI_ASSERT_ALWAYS(RotatingSelector);
178
179   const Dali::RefObject& handle = RotatingSelector.GetImplementation();
180
181   return static_cast<const Toolkit::Internal::RotatingSelector&>(handle);
182 }
183
184 } // namespace Toolkit
185
186 } // namespace Dali
187
188 #endif // __DALI_TOOLKIT_INTERNAL_ITEM_VIEW_H__