4538f81421faa910441109432ce2c1809dc2efe0
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / magnifier / magnifier.h
1 #ifndef __DALI_TOOLKIT_MAGNIFIER_H__
2 #define __DALI_TOOLKIT_MAGNIFIER_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 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/public-api/controls/control.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 namespace Internal DALI_INTERNAL
33 {
34 class Magnifier;
35 }
36
37 /**
38  * Magnifier control is used to apply a magnify effect to content on the stage.
39  *
40  * This is done by rendering the contents of a SourceActor at a given source position
41  * to the stage as a separate overlay. In addition to the contents, an optional frame
42  * is displayed around the magnified contents.
43  */
44 class DALI_IMPORT_API Magnifier : public Control
45 {
46 public:
47
48   // Custom properties
49
50   static const std::string SOURCE_POSITION_PROPERTY_NAME;                   ///< Property, name "source-position",              type VECTOR3
51
52 public:
53
54   /**
55    * Creates an empty Magnifier handle
56    */
57   Magnifier();
58
59   /**
60    * Copy constructor. Creates another handle that points to the same real object
61    * @param handle to copy from
62    */
63   Magnifier( const Magnifier& handle );
64
65   /**
66    * Assignment operator. Changes this handle to point to another real object
67    */
68   Magnifier& operator=( const Magnifier& handle );
69
70   /**
71    * @brief Destructor
72    *
73    * This is non-virtual since derived Handle types must not contain data or virtual methods.
74    */
75   ~Magnifier();
76
77   /**
78    * Create the Poup control
79    * @return A handle to the Magnifier control.
80    */
81   static Magnifier New();
82
83   /**
84    * Downcast an Object handle to Magnifier. If handle points to an Magnifier the
85    * downcast produces valid handle. If not the returned handle is left uninitialized.
86    * @param[in] handle Handle to an object
87    * @return handle to a Magnifier or an uninitialized handle
88    */
89   static Magnifier DownCast( BaseHandle handle );
90
91 public:
92
93   /**
94    * Set the actors to be rendered in magnifier.
95    * @param[in] actor This actor and its children will be rendered.
96    */
97   void SetSourceActor(Actor actor);
98
99   /**
100    * Set the source camera position to render in magnifier
101    * @param[in] position The target position from which to render source.
102    */
103   void SetSourcePosition(Vector3 position);
104
105   /**
106    * Returns whether the frame is visible or not.
107    * @return true if frame is visible, false if not.
108    */
109   bool GetFrameVisibility() const;
110
111   /**
112    * Sets whether the frame part of the magnifier should be visible
113    * or not.
114    * @param[in] visible true to display frame, false to hide frame.
115    */
116   void SetFrameVisibility(bool visible);
117
118   /**
119    * Get the magnification factor of the magnifier
120    * The larger the value the larger the contents magnified.
121    * A value of 1.0f indications 1x magnification.
122    * @return Magnification factor is returned
123    */
124   float GetMagnificationFactor() const;
125
126   /**
127    * Set the magnification factor of the magnifier
128    * The larger the value the larger the contents magnified.
129    * A value of 1.0f indications 1x magnification.
130    * @param[in] value Magnification factor.
131    */
132   void SetMagnificationFactor(float value);
133
134 public: // Not intended for application developers
135
136   /**
137    * Creates a handle using the Toolkit::Internal implementation.
138    * @param[in]  implementation  The Control implementation.
139    */
140   DALI_INTERNAL Magnifier(Internal::Magnifier& implementation);
141
142   /**
143    * Allows the creation of this Control from an Internal::CustomActor pointer.
144    * @param[in]  internal  A pointer to the internal CustomActor.
145    */
146   explicit DALI_INTERNAL Magnifier(Dali::Internal::CustomActor* internal);
147 };
148
149 } // namespace Toolkit
150
151 } // namespace Dali
152
153 #endif // __DALI_TOOLKIT_MAGNIFIER_H__