4df3e277a2a9ae05ee34a72ca32cc288367f526d
[platform/core/uifw/dali-demo.git] / examples / transitions / shadow-button.h
1 #ifndef DALI_DEMO_SHADOW_BUTTON_H
2 #define DALI_DEMO_SHADOW_BUTTON_H
3
4 /*
5  * Copyright (c) 2017 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 #include <dali-toolkit/dali-toolkit.h>
21 #include <string>
22
23 namespace Demo
24 {
25
26 // All type registered controls need to have the same name for the body
27 // and the handle
28 namespace Internal
29 {
30 class ShadowButton;
31 }
32
33 /**
34  * Button that allows the RGB channels of an image to be altered.
35  */
36 class ShadowButton : public Dali::Toolkit::Control
37 {
38 public:
39   /**
40    * The start and end property ranges for this Control
41    */
42   enum PropertyRange
43   {
44     PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
45     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000,
46     ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
47     ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000
48   };
49
50   struct Property
51   {
52     enum
53     {
54       ACTIVE_TRANSITION = PROPERTY_START_INDEX,
55       INACTIVE_TRANSITION,
56       CLICK_TRANSITION,
57       BACKGROUND_VISUAL,
58       CHECKBOX_BG_VISUAL,
59       CHECKBOX_FG_VISUAL,
60       LABEL_VISUAL,
61       ACTIVE_STATE,
62       CHECK_STATE,
63     };
64   };
65
66 public: // Construction / destruction
67
68   /**
69    * Create an uninitialized handle
70    */
71   ShadowButton();
72
73   /**
74    * Create a new image channel button without an image. Use
75    * SetImage to give this button an image
76    */
77   static ShadowButton New();
78
79   /**
80    * Create a new image channel button from a given URL
81    */
82   static ShadowButton New( const std::string& url );
83
84   /**
85    * Destructor. This is non-virtual since derived Handle types must not
86    * contain data or virtual methods
87    */
88   ~ShadowButton();
89
90   /**
91    * Copy Constructor
92    */
93   ShadowButton( const ShadowButton& shadowButton );
94
95   /**
96    * Assignment Operator
97    */
98   ShadowButton& operator=( const ShadowButton& shadowButton );
99
100   /**
101    * Downcast
102    */
103   static ShadowButton DownCast( BaseHandle handle );
104
105 public: // API
106
107   /**
108    * @brief Set the button to be active or inactive.
109    *
110    * The button will perform a transition if there is a state change.
111    * @param[in] active The active state
112    */
113   void SetActiveState( bool active );
114
115   /**
116    * @brief Get the button's active state
117    *
118    * @return The active state
119    */
120   bool GetActiveState();
121
122   /**
123    * Set the check state
124    * @param[in] checkState The state of the checkbox
125    */
126   void SetCheckState( bool checkState );
127
128   /**
129    * Get the check state
130    * @return the check state
131    */
132   bool GetCheckState();
133
134 public: // Not for public use
135   /**
136    * Create a handle from an implementation
137    */
138   ShadowButton( Internal::ShadowButton& implementation );
139
140   /**
141    * Allow the creation of an ShadowButton handle from an internal CustomActor pointer
142    */
143   ShadowButton( Dali::Internal::CustomActor* internal );
144 };
145
146 } // namespace Demo
147
148 #endif // DALI_DEMO_SHADOW_BUTTON_H