5ce4726fd041e545e94affae7a8207e63cc18be1
[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    * Virtual destructor.
66    * Dali::Object derived classes typically do not contain member data.
67    */
68   ~RotatingSelector();
69
70   /**
71    * Create an initialized RotatingSelector.
72    * @return A handle to a newly allocated Dali resource.
73    */
74   static RotatingSelector New(Actor& unSelectedActor, Actor& selectedActor);
75
76   /**
77    * Downcast an Object handle to RotatingSelector. If handle points to a RotatingSelector the
78    * downcast produces valid handle. If not the returned handle is left uninitialized.
79    * @param[in] handle Handle to an object
80    * @return handle to a RotatingSelector or an uninitialized handle
81    */
82   static RotatingSelector DownCast( BaseHandle handle );
83
84   /**
85    * Toggles the selection status of the selector.
86    * @param[in] toggle true for selected and false for un selected.
87    */
88   void SetSelected( bool toggle );
89
90   /**
91    * Queries the selection status of the selector.
92    * @return true if the selector is selected otherwise false
93    */
94   bool IsSelected() const;
95
96   /**
97    * Sets the actor to be displayed by the selector when it is in selected state
98    * @param[in] selectedActor The actor to display
99    */
100   void SetSelectedActor( Actor& selectedActor );
101
102   /**
103    * Gets the actor to be displayed by the selector when it is in selected state
104    * @return  A handle to the selected actor. If the selected actor has not been set, this handle will be invalid.
105    */
106   Actor GetSelectedActor();
107
108   /**
109    * Sets the actor to be displayed by the selector when it is in unselected state
110    * @param[in] unSelectedActor The actor to display
111    */
112   void SetUnSelectedActor( Actor& unSelectedActor );
113
114   /**
115    * Gets the actor to be displayed by the selector when it is in unselected state
116    * @return  A handle to Actor. If the unselected actor has not been set, this handle will be invalid.
117    */
118   Actor GetUnSelectedActor();
119
120   /**
121    * Sets whether the Selector is selectable
122    * @param[in] selectable true to be able to toggle the selector false otherwise
123    */
124   void SetSelectable( bool selectable );
125
126   /**
127    * Queries whether the Selector is selectable
128    * @return true if the selector is selectable, false otherwise
129    */
130   bool IsSelectable()const;
131
132 public: //Signals
133
134   // RotatingSelector Toggled
135   typedef SignalV2< void( RotatingSelector, bool ) > SelectedSignalV2;
136
137   /**
138    * Signal emitted when the rotating selector is in switched to a selected state.
139    */
140   SelectedSignalV2& SelectedSignal();
141
142 public: // Not intended for application developers
143
144   /**
145    * Creates a handle using the Toolkit::Internal implementation.
146    * @param[in]  implementation  The Control implementation.
147    */
148   RotatingSelector( Internal::RotatingSelector& implementation );
149
150   /**
151    * Allows the creation of this Control from an Internal::CustomActor pointer.
152    * @param[in]  internal  A pointer to the internal CustomActor.
153    */
154   RotatingSelector( Dali::Internal::CustomActor* internal );
155 };
156
157 } // namespace Toolkit
158
159 } // namespace Dali
160
161 #endif // __DALI_TOOLKIT_CUSTOM_CHECK_ACTOR_H__