Implemented the Handle assignment operators properly
[platform/core/uifw/dali-core.git] / dali / public-api / actors / custom-actor.h
1 #ifndef __DALI_CUSTOM_ACTOR_H__
2 #define __DALI_CUSTOM_ACTOR_H__
3
4 /*
5  * Copyright (c) 2014 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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/actors/custom-actor-impl.h>
24
25 namespace Dali DALI_IMPORT_API
26 {
27
28 namespace Internal DALI_INTERNAL
29 {
30 class CustomActor;
31 }
32
33 /**
34  * @brief CustomActor is a base class for custom UI controls.
35  *
36  * The implementation of the control must be supplied; see CustomActorImpl for more details.
37  */
38 class DALI_IMPORT_API CustomActor : public Actor
39 {
40 public:
41
42   /**
43    * @brief Create an uninitialized CustomActor handle.
44    *
45    * Only derived versions can be instantiated.
46    * Calling member functions with an uninitialized Dali::Object is not allowed.
47    */
48   CustomActor();
49
50   /**
51    * @brief Downcast an Object handle to CustomActor.
52    *
53    * If handle points to a CustomActor the downcast produces valid
54    * handle. If not the returned handle is left uninitialized.
55    *
56    * @param[in] handle to An object
57    * @return handle to a CustomActor or an uninitialized handle
58    */
59   static CustomActor DownCast( BaseHandle handle );
60
61   /**
62    * @brief Destructor
63    *
64    * This is non-virtual since derived Handle types must not contain data or virtual methods.
65    */
66   ~CustomActor();
67
68   /**
69    * @brief Retrieve the custom actor implementation.
70    *
71    * @return The implementation.
72    */
73   CustomActorImpl& GetImplementation();
74
75   /**
76    * @brief Retrieve the custom actor implementation.
77    *
78    * @return The implementation.
79    */
80   const CustomActorImpl& GetImplementation() const;
81
82   /**
83    * @brief Create an initialised CustomActor.
84    *
85    * @param[in] implementation The implementation for this custom actor.
86    * @return A handle to a newly allocated Dali resource.
87    */
88   CustomActor(CustomActorImpl& implementation);
89
90   /**
91    * @brief Copy constructor
92    *
93    * @param [in] copy The actor to copy.
94    */
95   CustomActor(const CustomActor& copy);
96
97   /**
98    * @brief Assignment operator
99    *
100    * @param [in] rhs The actor to copy.
101    */
102   CustomActor& operator=(const CustomActor& rhs);
103
104   /**
105    * @brief This method is defined to allow assignment of the NULL value,
106    * and will throw an exception if passed any other value.
107    *
108    * Assigning to NULL is an alias for Reset().
109    * @param [in] rhs  A NULL pointer
110    * @return A reference to this handle
111    */
112   CustomActor& operator=(BaseHandle::NullType* rhs);
113
114 public: // Not intended for application developers
115
116   /**
117    * @brief This constructor is used internally to create additional CustomActor handles.
118    *
119    * @param [in] actor A pointer to a newly allocated Dali resource
120    */
121   CustomActor(Internal::CustomActor* actor);
122 };
123
124 } // namespace Dali
125
126 #endif // __DALI_CUSTOM_ACTOR_H__