Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiAnim_NativeLayer.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FUiAnim_NativeLayer.h
20  * @brief       This is the header file for the _NativeLayer class.
21  *
22  * This header file contains the declarations of the _NativeLayer class.
23  */
24
25 #ifndef _FUI_ANIM_INTERNAL_INATIVE_LAYER_H_
26 #define _FUI_ANIM_INTERNAL_INATIVE_LAYER_H_
27
28 #include <FUi_Types.h>
29 #include <FGrpFloatRectangle.h>
30
31
32 namespace Tizen { namespace Ui { namespace Animations
33 {
34 class _RootVisualElement;
35 class _INativeNode;
36
37 class _OSP_EXPORT_ _NativeLayer
38 {
39 public:
40         /**
41          * destructor
42          *
43          * @since 2.0
44          */
45         virtual ~_NativeLayer(void);
46
47         /**
48          * Factory method of the native layer.
49          *
50          * @since 2.0
51          * @return              instance of the native layer.
52          * @remarks     This method make a instance of native layer by configuration.And call the Construct() method.
53          */
54         static _NativeLayer* CreateInstanceN(void);
55
56 public:
57         /**
58          * Initializes the native layer. It is designed with 2 phase-construction.
59          * This method invoke the OnConstructed method for constructing.
60          * @since 2.0
61          * @return              instance of the native layer.
62          *
63          * @see         OnConstructed()
64          */
65         result Construct(void);
66
67         _RootVisualElement* GetRootVisualElement(void) const;
68
69
70         void SetFlushNeeded(void)
71         {
72                 __needFlush = true;
73         }
74
75         void ResetFlushNeeded(void)
76         {
77                 __needFlush = false;
78         }
79
80         bool IsFlushNeeded(void) const
81         {
82                 return __needFlush;
83         }
84
85         /**
86          * Sets the position and the size of this instance.
87          *
88          * @since 2.0
89          *
90          * @return              An error code
91          */
92         virtual result SetBounds(const Tizen::Graphics::FloatRectangle& bounds) = 0;
93
94         /**
95          * Gets the position and the size of this instance.
96          *
97          * @since 2.0
98          *
99          * @return              An instance of the FloatRectangle that represents the position of top-left corner,@n
100          *                              the width, and the height of this instance. It has relative coordinate space to the parent.
101          */
102         virtual Tizen::Graphics::FloatRectangle GetBounds(void) const = 0;
103
104         /**
105          * Sets the show state of this instance.
106          *
107          * @since 2.0
108          *
109          * @return              An error code
110          * @param[in]   show                            Set to @c true if this instance needs to be shown,@n
111          *                                                                      else @c false
112          * @see                 GetShowState()
113          */
114         virtual result SetShowState(bool show) = 0;
115
116
117         /**
118          * Gets the show state of this instance.
119          *
120          * @since 2.0
121          * @return              The show state of the %VisualElement instance.
122          *                              If an exception occurs , return @c false.
123          * @see                 SetShowState()
124          */
125         virtual bool GetShowState(void) const = 0;
126
127
128         /**
129          * Flushes native layer on screen.
130          *
131          * @since 2.0
132          *
133          */
134         virtual void Flush(void) = 0;
135
136 protected:
137
138         virtual result OnConstructed(void) = 0;
139         /**
140          * Binds a _RootVisualElement to the native layer. This method should configure the _RootVisualElement.
141          *
142          * @since 2.0
143          * @return              error code.
144          */
145         virtual result Configure(_RootVisualElement& rootElement) = 0;
146
147 protected:
148         /**
149          * constructor
150          *
151          * @since 2.0
152          */
153         _NativeLayer(void);
154
155 private:
156         /**
157          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
158          *
159          * @since 2.0
160          *
161          */
162         _NativeLayer(const _NativeLayer& rhs);
163
164         /**
165          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
166          *
167          * @since 2.0
168          *
169          */
170         _NativeLayer& operator =(const _NativeLayer& rhs);
171
172 protected:
173         _RootVisualElement* _pRootVisualElement;
174
175 private:
176         bool __needFlush;
177
178         friend class _RootVisualElement;
179
180 };
181
182 }}} //namespace Tizen { namespace Ui { namespace Animations
183
184 #endif //_FUI_ANIM_INTERNAL_INATIVE_LAYER_H_