[dali_2.3.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / magnifier / magnifier.h
1 #ifndef DALI_TOOLKIT_MAGNIFIER_H
2 #define DALI_TOOLKIT_MAGNIFIER_H
3
4 /*
5  * Copyright (c) 2022 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 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/public-api/controls/control.h>
25
26 namespace Dali
27 {
28 namespace Toolkit
29 {
30 namespace Internal DALI_INTERNAL
31 {
32 class Magnifier;
33 }
34
35 /**
36  * Magnifier control is used to apply a magnify effect to content on the stage.
37  *
38  * This is done by rendering the contents of a SourceActor at a given source position
39  * to the stage as a separate overlay. In addition to the contents, an optional frame
40  * is displayed around the magnified contents.
41  */
42 class DALI_TOOLKIT_API Magnifier : public Control
43 {
44 public:
45   /**
46    * @brief The start and end property ranges for this control.
47    */
48   enum PropertyRange
49   {
50     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
51     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000, ///< Reserve property indices
52
53     ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
54     ANIMATABLE_PROPERTY_END_INDEX   = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices
55   };
56
57   /**
58    * @brief An enumeration of properties belonging to the Magnifier class.
59    */
60   struct Property
61   {
62     enum
63     {
64       // Event side properties
65       FRAME_VISIBILITY = PROPERTY_START_INDEX, ///< name "frameVisibility",       Whether a frame is visible or not,         type boolean
66       MAGNIFICATION_FACTOR,                    ///< name "magnificationFactor",   Larger value means greater magnification,  type float
67
68       // Animatable properties
69       SOURCE_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< name "sourcePosition",  The position of the source,  type Vector3
70     };
71   };
72
73 public:
74   /**
75    * Creates an empty Magnifier handle
76    */
77   Magnifier();
78
79   /**
80    * Copy constructor. Creates another handle that points to the same real object
81    * @param[in] handle to copy from
82    */
83   Magnifier(const Magnifier& handle);
84
85   /**
86    * Assignment operator. Changes this handle to point to another real object
87    * @param[in] handle to copy from
88    * @return reference to this
89    */
90   Magnifier& operator=(const Magnifier& handle);
91
92   /**
93    * Move constructor. Creates another handle that points to the same real object
94    * @param[in] rhs to move from
95    */
96   Magnifier(Magnifier&& rhs);
97
98   /**
99    * Move assignment operator. Changes this handle to point to another real object
100    * @param[in] rhs to move from
101    * @return reference to this
102    */
103   Magnifier& operator=(Magnifier&& rhs);
104
105   /**
106    * @brief Destructor
107    *
108    * This is non-virtual since derived Handle types must not contain data or virtual methods.
109    */
110   ~Magnifier();
111
112   /**
113    * Create the Poup control
114    * @return A handle to the Magnifier control.
115    */
116   static Magnifier New();
117
118   /**
119    * Downcast an Object handle to Magnifier. If handle points to an Magnifier the
120    * downcast produces valid handle. If not the returned handle is left uninitialized.
121    * @param[in] handle Handle to an object
122    * @return handle to a Magnifier or an uninitialized handle
123    */
124   static Magnifier DownCast(BaseHandle handle);
125
126 public:
127   /**
128    * Set the actors to be rendered in magnifier.
129    * @param[in] actor This actor and its children will be rendered.
130    */
131   void SetSourceActor(Actor actor);
132
133 public: // Not intended for application developers
134   /**
135    * Creates a handle using the Toolkit::Internal implementation.
136    * @param[in]  implementation  The Control implementation.
137    */
138   DALI_INTERNAL Magnifier(Internal::Magnifier& implementation);
139
140   /**
141    * Allows the creation of this Control from an Internal::CustomActor pointer.
142    * @param[in]  internal  A pointer to the internal CustomActor.
143    */
144   explicit DALI_INTERNAL Magnifier(Dali::Internal::CustomActor* internal);
145 };
146
147 } // namespace Toolkit
148
149 } // namespace Dali
150
151 #endif // DALI_TOOLKIT_MAGNIFIER_H