Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / simple-visuals-control / my-control-impl.h
1 #ifndef DALI_DEMO_INTERNAL_MY_CONTROL_IMPL_H
2 #define DALI_DEMO_INTERNAL_MY_CONTROL_IMPL_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 // CLASS HEADER
21 #include "my-control.h"
22
23 // EXTERNAL INCLUDES
24 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26
27 namespace Demo
28 {
29 namespace Internal // To use TypeRegistry, handle and body classes need the same name
30 {
31 /**
32  * @brief A Simple Control to show use of visuals with a style sheet and changing visuals with a state change
33  */
34
35 class MyControl : public Dali::Toolkit::Internal::Control
36 {
37 public:
38   /**
39    * @brief Instantiate a new ContentView object
40    */
41   static Demo::MyControl New();
42
43   /**
44    * @brief Default constructor
45    */
46   MyControl();
47
48 public: // Properties
49   /**
50    * @brief Called when a property of an object of this type is set.
51    *
52    * @param[in] object The object whose property is set.
53    * @param[in] index The property index.
54    * @param[in] value The new property value.
55    */
56   static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value);
57
58   /**
59    * @brief Called to retrieve a property of an object of this type.
60    *
61    * @param[in] object The object whose property is to be retrieved.
62    * @param[in] index The property index.
63    * @return The current value of the property.
64    */
65   static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex);
66
67 private: // From Control
68   /**
69    * @copydoc Toolkit::Control::OnInitialize()
70    */
71   virtual void OnInitialize();
72
73 private:
74   /**
75    *  undefined constructor and operator=
76    */
77   MyControl(const MyControl&);
78   MyControl& operator=(const MyControl&);
79
80 private:
81 };
82
83 } // namespace Internal
84
85 inline Internal::MyControl& GetImpl(Demo::MyControl& handle)
86 {
87   DALI_ASSERT_ALWAYS(handle);
88   Dali::RefObject& object = handle.GetImplementation();
89   return static_cast<Internal::MyControl&>(object);
90 }
91
92 inline const Internal::MyControl& GetImpl(const Demo::MyControl& handle)
93 {
94   DALI_ASSERT_ALWAYS(handle);
95   const Dali::RefObject& object = handle.GetImplementation();
96   return static_cast<const Internal::MyControl&>(object);
97 }
98
99 } // namespace Demo
100
101 #endif //  DALI_DEMO_INTERNAL_MY_CONTROL_IMPL_H