[dali_1.2.23] Merge branch 'devel/master'
[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       CHECK_TRANSITION,
57       UNCHECK_TRANSITION,
58       BACKGROUND_VISUAL,
59       CHECKBOX_BG_VISUAL,
60       CHECKBOX_FG_VISUAL,
61       LABEL_VISUAL,
62       ACTIVE_STATE,
63       CHECK_STATE,
64     };
65   };
66
67 public: // Construction / destruction
68
69   /**
70    * Create an uninitialized handle
71    */
72   ShadowButton();
73
74   /**
75    * Create a new image channel button without an image. Use
76    * SetImage to give this button an image
77    */
78   static ShadowButton New();
79
80   /**
81    * Create a new image channel button from a given URL
82    */
83   static ShadowButton New( const std::string& url );
84
85   /**
86    * Destructor. This is non-virtual since derived Handle types must not
87    * contain data or virtual methods
88    */
89   ~ShadowButton();
90
91   /**
92    * Copy Constructor
93    */
94   ShadowButton( const ShadowButton& shadowButton );
95
96   /**
97    * Assignment Operator
98    */
99   ShadowButton& operator=( const ShadowButton& shadowButton );
100
101   /**
102    * Downcast
103    */
104   static ShadowButton DownCast( BaseHandle handle );
105
106 public: // API
107
108   /**
109    * @brief Set the button to be active or inactive.
110    *
111    * The button will perform a transition if there is a state change.
112    * @param[in] active The active state
113    */
114   void SetActiveState( bool active );
115
116   /**
117    * @brief Get the button's active state
118    *
119    * @return The active state
120    */
121   bool GetActiveState();
122
123   /**
124    * Set the check state
125    * @param[in] checkState The state of the checkbox
126    */
127   void SetCheckState( bool checkState );
128
129   /**
130    * Get the check state
131    * @return the check state
132    */
133   bool GetCheckState();
134
135 public: // Not for public use
136   /**
137    * Create a handle from an implementation
138    */
139   ShadowButton( Internal::ShadowButton& implementation );
140
141   /**
142    * Allow the creation of an ShadowButton handle from an internal CustomActor pointer
143    */
144   ShadowButton( Dali::Internal::CustomActor* internal );
145 };
146
147 } // namespace Demo
148
149 #endif // DALI_DEMO_SHADOW_BUTTON_H