Implemented the Handle assignment operators properly
[platform/core/uifw/dali-core.git] / dali / public-api / geometry / cloth.h
1 #ifndef __DALI_CLOTH_H__
2 #define __DALI_CLOTH_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
22 // INTERNAL INCLUDES
23 #include <dali/public-api/math/rect.h>
24 #include <dali/public-api/math/vector4.h>
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/geometry/mesh.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33 class Cloth;
34 }
35
36 /**
37  * @brief A Cloth is a specialized mesh that can be used and modified
38  * by the Dynamics engine.
39  */
40 class Cloth : public Mesh
41 {
42 public:
43
44   /**
45    * @brief Create an initialized plane aligned on the XY axis.
46    *
47    * @param[in] width   The width of the plane
48    * @param[in] height  The height of the plane
49    * @param[in] xSteps  The number of vertices along the X axis
50    * @param[in] ySteps  The number of vertices along the Y axis
51    * @param[in] textureCoordinates  UV coordinates.
52    * @return A handle to a newly allocated Dali resource.
53    */
54   static Cloth New(const float width,
55                    const float height,
56                    const int xSteps,
57                    const int ySteps,
58                    const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f));
59
60
61   /**
62    * @brief Create an uninitialized Cloth; this can be initialized with Cloth::New().
63    *
64    * Calling member functions with an uninitialized Dali::Object is not allowed.
65    */
66   Cloth();
67
68   /**
69    * @brief Destructor
70    *
71    * This is non-virtual since derived Handle types must not contain data or virtual methods.
72    */
73   ~Cloth();
74
75   /**
76    * @brief This copy constructor is required for (smart) pointer semantics.
77    *
78    * @param [in] handle A reference to the copied handle
79    */
80   Cloth(const Cloth& handle);
81
82   /**
83    * @brief This assignment operator is required for (smart) pointer semantics.
84    *
85    * @param [in] rhs  A reference to the copied handle
86    * @return A reference to this
87    */
88   Cloth& operator=(const Cloth& rhs);
89
90   /**
91    * @brief This method is defined to allow assignment of the NULL value,
92    * and will throw an exception if passed any other value.
93    *
94    * Assigning to NULL is an alias for Reset().
95    * @param [in] rhs  A NULL pointer
96    * @return A reference to this handle
97    */
98   Cloth& operator=(BaseHandle::NullType* rhs);
99
100   /**
101    * @brief Downcast an Object handle to a Cloth handle.
102    *
103    * If handle points to a Cloth object the downcast produces valid
104    * handle. If not the returned handle is left uninitialized.
105    *
106    * @param[in] handle to an object
107    * @return handle to a Cloth object or an uninitialized handle
108    */
109   static Cloth DownCast( BaseHandle handle );
110
111 public: // Not intended for application developers
112
113   /**
114    * @brief This constructor is used by Dali New() methods.
115    *
116    * @param [in] cloth A pointer to a newly allocated Dali resource
117    */
118   explicit DALI_INTERNAL Cloth(Internal::Cloth* cloth);
119 };
120
121 } // namespace Dali
122
123 #endif // __DALI_CLOTH_H__