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