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