[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) 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
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 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    */
88   Magnifier& operator=(const Magnifier& handle);
89
90   /**
91    * @brief Destructor
92    *
93    * This is non-virtual since derived Handle types must not contain data or virtual methods.
94    */
95   ~Magnifier();
96
97   /**
98    * Create the Poup control
99    * @return A handle to the Magnifier control.
100    */
101   static Magnifier New();
102
103   /**
104    * Downcast an Object handle to Magnifier. If handle points to an Magnifier the
105    * downcast produces valid handle. If not the returned handle is left uninitialized.
106    * @param[in] handle Handle to an object
107    * @return handle to a Magnifier or an uninitialized handle
108    */
109   static Magnifier DownCast(BaseHandle handle);
110
111 public:
112   /**
113    * Set the actors to be rendered in magnifier.
114    * @param[in] actor This actor and its children will be rendered.
115    */
116   void SetSourceActor(Actor actor);
117
118 public: // Not intended for application developers
119   /**
120    * Creates a handle using the Toolkit::Internal implementation.
121    * @param[in]  implementation  The Control implementation.
122    */
123   DALI_INTERNAL Magnifier(Internal::Magnifier& implementation);
124
125   /**
126    * Allows the creation of this Control from an Internal::CustomActor pointer.
127    * @param[in]  internal  A pointer to the internal CustomActor.
128    */
129   explicit DALI_INTERNAL Magnifier(Dali::Internal::CustomActor* internal);
130 };
131
132 } // namespace Toolkit
133
134 } // namespace Dali
135
136 #endif // DALI_TOOLKIT_MAGNIFIER_H