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