Optimization to reduce Handle size by 50%
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-api / controls / selectors / rotating-selector.h
1 #ifndef __DALI_TOOLKIT_CUSTOM_CHECK_ACTOR_H__
2 #define __DALI_TOOLKIT_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 // INTERNAL INCLUDES
22 #include <dali/dali.h>
23 #include <dali-toolkit/public-api/controls/control.h>
24
25 namespace Dali DALI_IMPORT_API
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33 class RotatingSelector;
34 }
35
36 /**
37  * RotatingSelector is a simple control to switch between two states (selected/unselected). A signal is emitted when the selector switches between
38  * the two states. The control has two faces one behind the other, The control is rotated while switching between the two states
39  */
40 class RotatingSelector : public Control
41 {
42 public:
43   //Signal Names
44   static const char* const SIGNAL_CHECKED;
45
46 public:
47
48   /**
49    * Create an uninitialized RotatingSelector; this can be initialized with RotatingSelector::New()
50    * Calling member functions with an uninitialized Dali::Object is not allowed.
51    */
52   RotatingSelector();
53
54   /**
55    * Copy constructor.
56    */
57   RotatingSelector( const RotatingSelector& rotatingSelector );
58
59   /**
60    * Assignment operator.
61    */
62   RotatingSelector& operator=( const RotatingSelector& rotatingSelector );
63
64   /**
65    * @brief Destructor
66    *
67    * This is non-virtual since derived Handle types must not contain data or virtual methods.
68    */
69   ~RotatingSelector();
70
71   /**
72    * Create an initialized RotatingSelector.
73    * @return A handle to a newly allocated Dali resource.
74    */
75   static RotatingSelector New(Actor& unSelectedActor, Actor& selectedActor);
76
77   /**
78    * Downcast an Object handle to RotatingSelector. If handle points to a RotatingSelector the
79    * downcast produces valid handle. If not the returned handle is left uninitialized.
80    * @param[in] handle Handle to an object
81    * @return handle to a RotatingSelector or an uninitialized handle
82    */
83   static RotatingSelector DownCast( BaseHandle handle );
84
85   /**
86    * Toggles the selection status of the selector.
87    * @param[in] toggle true for selected and false for un selected.
88    */
89   void SetSelected( bool toggle );
90
91   /**
92    * Queries the selection status of the selector.
93    * @return true if the selector is selected otherwise false
94    */
95   bool IsSelected() const;
96
97   /**
98    * Sets the actor to be displayed by the selector when it is in selected state
99    * @param[in] selectedActor The actor to display
100    */
101   void SetSelectedActor( Actor& selectedActor );
102
103   /**
104    * Gets the actor to be displayed by the selector when it is in selected state
105    * @return  A handle to the selected actor. If the selected actor has not been set, this handle will be invalid.
106    */
107   Actor GetSelectedActor();
108
109   /**
110    * Sets the actor to be displayed by the selector when it is in unselected state
111    * @param[in] unSelectedActor The actor to display
112    */
113   void SetUnSelectedActor( Actor& unSelectedActor );
114
115   /**
116    * Gets the actor to be displayed by the selector when it is in unselected state
117    * @return  A handle to Actor. If the unselected actor has not been set, this handle will be invalid.
118    */
119   Actor GetUnSelectedActor();
120
121   /**
122    * Sets whether the Selector is selectable
123    * @param[in] selectable true to be able to toggle the selector false otherwise
124    */
125   void SetSelectable( bool selectable );
126
127   /**
128    * Queries whether the Selector is selectable
129    * @return true if the selector is selectable, false otherwise
130    */
131   bool IsSelectable()const;
132
133 public: //Signals
134
135   // RotatingSelector Toggled
136   typedef SignalV2< void( RotatingSelector, bool ) > SelectedSignalV2;
137
138   /**
139    * Signal emitted when the rotating selector is in switched to a selected state.
140    */
141   SelectedSignalV2& SelectedSignal();
142
143 public: // Not intended for application developers
144
145   /**
146    * Creates a handle using the Toolkit::Internal implementation.
147    * @param[in]  implementation  The Control implementation.
148    */
149   RotatingSelector( Internal::RotatingSelector& implementation );
150
151   /**
152    * Allows the creation of this Control from an Internal::CustomActor pointer.
153    * @param[in]  internal  A pointer to the internal CustomActor.
154    */
155   RotatingSelector( Dali::Internal::CustomActor* internal );
156 };
157
158 } // namespace Toolkit
159
160 } // namespace Dali
161
162 #endif // __DALI_TOOLKIT_CUSTOM_CHECK_ACTOR_H__