2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FUiEffectsEffect.h
19 * @brief This is the header file for the %Effect class.
21 * This header file contains the declarations of the %Effect class.
24 #ifndef _FUI_EFFECTS_EFFECT_H_
25 #define _FUI_EFFECTS_EFFECT_H_
27 #include <FBaseObject.h>
28 #include <FUiEffectsTypes.h>
31 namespace Tizen { namespace Base {
35 namespace Tizen { namespace Ui {
40 namespace Tizen { namespace Graphics {
45 namespace Tizen { namespace Base { namespace Collection {
47 }}} // Tizen::Base::Collection
49 namespace Tizen { namespace Ui { namespace Effects
51 class IEffectEventListener;
52 class IEffectResourceProvider;
57 * @brief This class contains API for managing effects.
61 * The %Effect class contains API for managing effects.
63 class _OSP_EXPORT_ Effect
64 : public Tizen::Base::Object
68 * Binds the effect to Tizen::UI::Control for rendering effect.
72 * @return An error code
73 * @param [in] pControl Tizen::UI::Control whose content is filled by the effect
74 * @exception E_SUCCESS The specified effect is bound with @c control successfully.
75 * @exception E_OPERATION_FAILED The system has failed to initialize the 3D system.
76 * @exception E_IN_PROGRESS The specified effect is running now, setting, changing or resetting render target is impossible
78 result SetRenderTarget(Tizen::Ui::Control* pControl);
85 * @return An error code
86 * @exception E_SUCCESS The specified effect is started successfully.
87 * @exception E_INVALID_STATE The specified effect has already started.
88 * @exception E_OPERATION_FAILED The specified effect has a runtime error in the script.
89 * @exception E_ALREADY_SET Other effects which use the same control as a render target are currently running.
98 * @return An error code
99 * @param [in] effectStartInfo A list of input arguments to pass to the OnEffectStarted() method of the scripts @n
100 * All arguments must be represented in @c float data type.
101 * @exception E_SUCCESS The specified effect is started successfully.
102 * @exception E_INVALID_STATE The specified effect has already started.
103 * @exception E_OPERATION_FAILED The specified effect has a runtime error in the script.
104 * @exception E_ALREADY_SET Other effects which use the same control as a render target are currently running.
106 result Start(const Tizen::Base::Collection::IList& effectStartInfo);
113 * @return An error code
114 * @exception E_SUCCESS The specified effect is stopped successfully.
115 * @exception E_INVALID_STATE The specified effect has not started as yet.
120 * Informs the effect of a TouchPress event.
124 * @return An error code
125 * @param [in] touchEventInfo The touch event information
126 * @param [in] offset The effect will regard the touch position in @c touchEventInfo translated by @c offset
127 * @exception E_SUCCESS The specified effect is successfully sent with a TouchPress event.
128 * @exception E_INVALID_STATE The specified effect has not started as yet.
129 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchPressed() script method or the effect is time-based.
131 result FeedTouchPressEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo, const Tizen::Graphics::Point& offset);
134 * Informs the effect of a TouchPress event.
138 * @return An error code
139 * @param [in] touchEventInfo The touch event information
140 * @exception E_SUCCESS The specified effect is successfully sent with a TouchPress event.
141 * @exception E_INVALID_STATE The specified effect has not started as yet.
142 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchPressed() script method or the effect is time-based.
144 result FeedTouchPressEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo);
147 * Informs the effect of a TouchMove event.
151 * @return An error code
152 * @param [in] touchEventInfo The touch event information
153 * @param [in] offset The effect will regard the touch position in @c touchEventInfo translated by @c offset
154 * @exception E_SUCCESS The specified effect is successfully sent with a TouchMove event.
155 * @exception E_INVALID_STATE The specified effect has not started as yet.
156 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchMoved() script method or the effect is time-based.
158 result FeedTouchMoveEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo, const Tizen::Graphics::Point& offset);
161 * Informs the effect of a TouchMove event.
165 * @return An error code
166 * @param [in] touchEventInfo The touch event information
167 * @exception E_SUCCESS The specified effect is successfully sent with a TouchMove event.
168 * @exception E_INVALID_STATE The specified effect has not started as yet.
169 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchMoved() script method or the effect is time-based.
171 result FeedTouchMoveEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo);
174 * Informs the effect of a TouchRelease event.
178 * @return An error code
179 * @param [in] touchEventInfo The touch event information
180 * @param [in] offset The effect will regard the touch position in @c touchEventInfo translated by @c offset
181 * @exception E_SUCCESS The specified effect is successfully sent with a TouchRelease event.
182 * @exception E_INVALID_STATE The specified effect has not started as yet.
183 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchReleased() script method or the effect is time-based.
185 result FeedTouchReleaseEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo, const Tizen::Graphics::Point& offset);
188 * Informs the effect of a TouchRelease event.
192 * @return An error code
193 * @param [in] touchEventInfo The touch event information
194 * @exception E_SUCCESS The specified effect is successfully sent with a TouchRelease event.
195 * @exception E_INVALID_STATE The specified effect has not started as yet.
196 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchReleased() script method or the effect is time-based.
198 result FeedTouchReleaseEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo);
201 * Informs the effect of a TouchDoublePress event.
205 * @return An error code
206 * @param [in] touchEventInfo The touch event information
207 * @param [in] offset The effect will regard the touch position in @c touchEventInfo translated by @c offset
208 * @exception E_SUCCESS The specified effect is successfully sent with a TouchDoublePress event.
209 * @exception E_INVALID_STATE The specified effect has not started as yet.
210 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchDoublePressed() script method or the effect is time-based.
212 result FeedTouchDoublePressEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo, const Tizen::Graphics::Point& offset);
215 * Informs the effect of a TouchDoublePress event.
219 * @return An error code
220 * @param [in] touchEventInfo The touch event information
221 * @exception E_SUCCESS The specified effect is successfully sent with a TouchDoublePress event.
222 * @exception E_INVALID_STATE The specified effect has not started as yet.
223 * @exception E_OPERATION_FAILED There is a runtime error in the OnTouchDoublePressed() script method or the effect is time-based.
225 result FeedTouchDoublePressEvent(const Tizen::Ui::TouchEventInfo& touchEventInfo);
228 * Sets the effect's bitmap that is used as a graphical surface in scripts.
232 * @return An error code
233 * @param [in] bitmapId The bitmap ID to update
234 * @param [in] bitmap The bitmap content
235 * @exception E_SUCCESS The bitmap is updated successfully.
236 * @exception E_OPERATION_FAILED Updating the bitmap contents has failed.
238 result SetBitmap(long bitmapId, const Tizen::Graphics::Bitmap& bitmap);
241 * Checks whether the effect is running.
245 * @return @c true if the effect is running, @n
248 bool IsRunning(void) const;
251 * Gets the effect type.
255 * @return The type of effect
257 EffectType GetType(void) const;
260 * Gets the name of the effect.
264 * @return The name of the effect.
266 Tizen::Base::String GetName(void) const;
269 * Sets the IEffectsEventListener instance to get notified when the state of the effect is changed.
273 * @param [in] pListener The event listener to set @n
274 * If @c pListener is @c null, the status changes of this instance are not notified anymore.
275 * @see GetEffectEventListener
277 void SetEffectEventListener(IEffectEventListener* pListener);
280 * Gets the IEffectsEventListener instance that is registered to the instance.
284 * @return The event listener
286 * @see SetEffectEventListener
288 IEffectEventListener* GetEffectEventListener(void) const;
291 * Sets the IEffectsResourceProvider instance to get notified when resources are needed by the effect.
295 * @param [in] pProvider The resource provider to provide the effect with bitmap resources @n
296 * If @c pProvider is @c null, this instance will not display effects correctly.
298 * @see GetResourceProvider
300 void SetResourceProvider(IEffectResourceProvider* pProvider);
303 * Gets the IEffectsResourceProvider instance that is registered to the instance.
307 * @return The resource provider
309 * @see SetResourceProvider
311 IEffectResourceProvider* GetResourceProvider(void) const;
315 * This default constructor is intentionally declared as protected so that only the platform can create an instance.
322 * This destructor overrides Tizen::Base::Object::~Object().
326 virtual ~Effect(void);
329 // This method is for internal use only. Using this method can cause behavioral, security-related,
330 // and consistency-related issues in the application.
333 // This method is reserved and may change its name at any time without prior notice.
337 virtual void Effect_Reserved1(void) {}
340 // This method is for internal use only. Using this method can cause behavioral, security-related,
341 // and consistency-related issues in the application.
344 // This method is reserved and may change its name at any time without prior notice.
348 virtual void Effect_Reserved2(void) {}
351 // This method is for internal use only. Using this method can cause behavioral, security-related,
352 // and consistency-related issues in the application.
355 // This method is reserved and may change its name at any time without prior notice.
359 virtual void Effect_Reserved3(void) {}
362 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
363 Effect(const Effect& rhs);
365 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
366 Effect& operator=(const Effect& rhs);
369 friend class _EffectManagerImpl;
370 friend class _EffectImpl;
371 _EffectImpl* __pEffectImpl;
374 }}} // Tizen::Ui::Effects
376 #endif // _FUI_EFFECTS_EFFECT_H_