2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiAnimVisualElement.h
20 * @brief This is the header file for the %VisualElement class.
22 * This header file contains the declarations of the %VisualElement class.
25 #ifndef _FUI_ANIM_VISUAL_ELEMENT_H_
26 #define _FUI_ANIM_VISUAL_ELEMENT_H_
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FGrpFloatMatrix4.h>
31 #include <FGrpFloatPoint.h>
32 #include <FGrpFloatRectangle.h>
33 #include <FUiVariant.h>
34 #include <FUiAnimTypes.h>
35 #include <FUiAnimIVisualElementAnimationProvider.h>
36 #include <FUiAnimIVisualElementContentProvider.h>
37 #include <FUiAnimIVisualElementEventListener.h>
39 namespace Tizen { namespace Graphics {
43 namespace Tizen { namespace Ui { namespace Animations
46 class VisualElementSurface;
47 class _VisualElementImpl;
51 * @class VisualElement
52 * @brief This class is a base class for all displayable objects on screen with animations.
56 * The %VisualElement class is a base class for all displayable objects on screen with animations.
57 * It encapsulates properties about coordinates (bounds, transform matrix, children transform matrix and so on),
58 * contents (content bounds, clipping, opacity, show state and so on) and tree-hierarchy.
59 * It also provides infrastructure necessary for animations (AddAnimation(), RemoveAnimation() and so on).
60 * A %VisualElement object instantiated by applications works as a model object and may have a cloned counter part for presentation on screen which has a separated life-cycle.
61 * The presentation object is managed by system and applications must not change properties of it.
62 * Most animations of %VisualElement are applied on presentation objects. Properties set by applications are stored in model objects while properties of presentation objects
63 * are changing during implicit or explicit animations.
65 * This class also provides interfaces such as IVisualElementContentProvider, IVisualElementEventListener, and IVisualElementAnimationProvider to override default behaviors
66 * without inheritances.
68 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/visualelement.htm">Visual Elements</a>.
72 class _OSP_EXPORT_ VisualElement
73 : public Tizen::Base::Object
77 * The lowest drawing group, such as, background element.
81 static const int Z_ORDER_GROUP_LOWEST = -1000;
85 * The level of the default group.
89 static const int Z_ORDER_GROUP_NORMAL = 0;
93 * The highest drawing group, such as, top-most element.
97 static const int Z_ORDER_GROUP_HIGHEST = 1000;
101 * @enum RenderOperation
102 * Defines the render operation for %VisualElement. @n
103 * The contents of %VisualElement will be composited on screen using this operation.
107 RENDER_OPERATION_BLEND = 0, /**< The contents will be displayed blended with underlying %VisualElements */
108 RENDER_OPERATION_COPY /**< The contents will be displayed obscuring other underlying %VisualElements */
113 * The object is not fully constructed after this constructor is called.
114 * For full construction, the Construct() method must be called right after calling this constructor.
121 * Initializes this instance of %VisualElement.
125 * @return An error code
126 * @exception E_SUCCESS The method is successful.
127 * @exception E_SYSTEM A system error has occurred.
129 result Construct(void);
132 * Deallocates this instance and all descendants of %VisualElement.
136 * @remarks This method must be used to destroy this instance. @n
137 * Do not use @c delete operator.
138 * @remarks This method first destroys children, and then it destroys the parent(this instance).
139 * @remarks This method will call OnDestructing() callback before deallocating the instance.
140 * @remarks The destructing sequence is as follows:
141 * 1. Destroy children recursively.
142 * 2. Calls %OnDestructing() callback.
143 * 3. Detaches from parent.
144 * 4. Removes all animations associated with this instance.
145 * 5. Deallocates this instance.
151 * Sets the animation provider which creates implicit animations.
155 * @return An error code
156 * @param[in] pProvider The animation provider to create implicit animations
157 * @exception E_SUCCESS The method is successful.
158 * @exception E_INVALID_OPERATION This instance does not allow to set an animation provider. @n
159 * The animation provider can be set to the model instance only.
161 * @see IVisualElementAnimationProvider
162 * @see GetAnimationProvider()
164 result SetAnimationProvider(IVisualElementAnimationProvider* pProvider);
167 * Gets the assigned animation provider.
171 * @return The animation provider
172 * @exception E_INVALID_OPERATION This instance does not allow to get an animation provider. @n
173 * The animation provider can be set to the model instance only.
174 * @remarks The specific error code can be accessed using the GetLastResult() method.
175 * @see IVisualElementAnimationProvider
176 * @see SetAnimationProvider()
178 IVisualElementAnimationProvider* GetAnimationProvider(void) const;
181 * Sets the content provider which customizes information on contents.
185 * @param[in] pProvider The content provider to customize information on content
186 * @exception E_SUCCESS The method is successful.
187 * @exception E_INVALID_OPERATION This instance does not allow to set a content provider. @n
188 * The content provider can be set to the model instance only.
189 * @see IVisualElementContentProvider
190 * @see GetContentProvider()
192 result SetContentProvider(IVisualElementContentProvider* pProvider);
195 * Gets the assigned content provider.
199 * @return The content provider
200 * @exception E_INVALID_OPERATION This instance does not allow to get content provider. @n
201 * The content provider can be set to the model instance only.
202 * @remarks The specific error code can be accessed using the GetLastResult() method.
203 * @see IVisualElementContentProvider
204 * @see SetContentProvider()
206 IVisualElementContentProvider* GetContentProvider(void) const;
209 * Sets the %VisualElement event listener.
213 * @param[in] pListener The %VisualElement event listener
214 * @exception E_SUCCESS The method is successful.
215 * @exception E_INVALID_OPERATION This instance does not allow to set an event listener. @n
216 * The event listener can be set to the model instance only.
217 * @see IVisualElementEventListener
218 * @see GetVisualElementEventListener()
220 result SetVisualElementEventListener(IVisualElementEventListener* pListener);
223 * Gets the assigned %VisualElement event listener.
227 * @return The %VisualElement event listener
228 * @exception E_INVALID_OPERATION This instance does not allow to get an event listener. @n
229 * The event listener can be set to the model instance only.
230 * @remarks The specific error code can be accessed using the GetLastResult() method.
231 * @see IVisualElementEventListener
232 * @see SetVisualElementEventListener()
234 IVisualElementEventListener* GetVisualElementEventListener(void) const;
238 * Overrides the OnConstructed() method to provide user-specific initialization code.
242 * @remarks This method is called after the instance is initialized by the Construct() method successfully.
245 * @see OnDestructing()
247 virtual void OnConstructed(void);
250 * Overrides the OnDestructing() method to provide user-specific termination code.
254 * @remarks This method is called before deallocating the %VisualElement instance by the Destroy() method.
257 * @see OnConstructed()
259 virtual void OnDestructing(void);
262 * Called by the GetChildAt() method to check whether this instance contains the @c point specified. @n
263 * If the Tizen::Ui::Animations::IVisualElementAnimationProvider interface is set to this instance,
264 * the Tizen::Ui::Animations::IVisualElementContentProvider::HitTest() callback will be called instead.
268 * @return The hit test result
269 * @param[in] point The hit position in the coordinate space of this instance
270 * @remarks Hit test results must be one of the following values: @n
271 * - Tizen::Ui::Animations::HitTestResult::HIT_TEST_NOWHERE
272 * - Tizen::Ui::Animations::HitTestResult::HIT_TEST_MATCH
274 * @see IVisualElementContentProvider::HitTest()
276 virtual HitTestResult OnHitTest(const Tizen::Graphics::FloatPoint& point);
279 * Before the system calls OnDraw() method to fill the contents, the %OnPrepareDraw() method is called to give an opportunity to hook or prepare drawing. @n
280 * If the [IVisualElementContentProvider](@ref Tizen::Ui::Animations::IVisualElementContentProvider) interface is set to this instance,
281 * the [PrepareDraw()](@ref Tizen::Ui::Animations::IVisualElementContentProvider::PrepareDraw) callback will be called instead.
285 * @return @c true if OnDraw() can be called, @n
287 * @see IVisualElementContentProvider::PrepareDraw()
289 virtual bool OnPrepareDraw(void);
292 * Called to fill contents on the canvas provided by the system. @n
293 * If the [IVisualElementContentProvider](@ref Tizen::Ui::Animations::IVisualElementContentProvider) is set to this instance,
294 * the [DrawContent()](@ref Tizen::Ui::Animations::IVisualElementContentProvider::DrawContent) callback will be called instead.
298 * @param[in] canvas The canvas to fill the contents of %VisualElement
299 * @see IVisualElementContentProvider::DrawContent()
301 virtual void OnDraw(Tizen::Graphics::Canvas& canvas);
304 * Overrides the %OnCreateAnimationForProperty() method to provide user-specific implicit animation. @n
305 * If the [IVisualElementAnimationProvider](@ref Tizen::Ui::Animations::IVisualElementAnimationProvider) interface is set to this instance,
306 * the [CreateAnimationForProperty()](@ref Tizen::Ui::Animations::IVisualElementAnimationProvider::CreateAnimationForProperty) callback will be called instead.
310 * @return The VisualElementAnimation instance for the specified property, @n
311 else @c null to disable implicit animation for the property
312 * @param[in] property The property to animate implicitly
313 * @remarks The returned [Animation](@ref Tizen::Ui::Animations::VisualElementAnimation) instance must be allocated on the heap if needed. @n
314 * If you do not need an implicit animation for the @c property at the time this method is called, return @c null.
315 * @see IVisualElementAnimationProvider::CreateAnimationForProperty()
317 virtual VisualElementAnimation* OnCreateAnimationForProperty(const Tizen::Base::String& property);
320 * Overrides the %OnGetPropertyRequested() method to provide user-specific properties or to change default behaviors of %VisualElement class. @n
321 * This method is called whenever GetProperty() is called.
325 * @return The property's value
326 * @param[in] property The property name
329 * @see OnSetPropertyRequested()
331 virtual Tizen::Ui::Variant OnGetPropertyRequested(const Tizen::Base::String& property) const;
334 * Overrides the %OnSetPropertyRequested() method to provide user-specific properties or to change default behaviors of %VisualElement class. @n
335 * This method is called whenever SetProperty() is called.
339 * @return An error code
340 * @param[in] property The property name
341 * @param[in] value The value of the property to set
344 * @see OnGetPropertyRequested()
346 virtual result OnSetPropertyRequested(const Tizen::Base::String& property, const Tizen::Ui::Variant& value);
349 * Gets the parent of this instance.
353 * @return The parent of the this instance
355 VisualElement* GetParent(void) const;
358 * Gets a list of children of this instance.
362 * @return The list of children of this instance
363 * @exception E_SUCCESS The method is successful.
364 * @exception E_OUT_OF_MEMORY The memory is insufficient.
365 * @remarks The specific error code can be accessed using the GetLastResult() method.
366 * @remarks If an exception occurs, this method returns @c null.
368 Tizen::Base::Collection::IList* GetChildrenN(void) const;
371 * Gets the count of children.
375 * @return The count of children
377 int GetChildrenCount(void) const;
380 * Checks whether this instance is a child or descendant of the specified one.
384 * @return @c true if this instance is a child or descendant of the specified one, @n
386 * @param[in] other An instance of %VisualElement to test relationship
388 bool IsChildOf(const VisualElement& other) const;
391 * Attaches a child to this instance. @n
392 * The %AttachChild() method attaches the specified @c child at the highest position in the Z order group of the @c child.
393 * If you need to change Z-Order group, you can change it using the SetZOrderGroup() method.
397 * @return An error code
398 * @param[in] child The %VisualElement instance to attach to this instance
399 * @exception E_SUCCESS The method is successful.
400 * @exception E_INVALID_ARG The input parameter is incorrect. Either of the following conditions has occurred: @n
401 * - The specified @c child is not instantiated successfully. @n
402 * - The specified @c child is this instance. @n
403 * - The specified @c child is already an ancestor of this instance.
404 * @see SetZOrderGroup()
407 * @see ChangeZOrder()
409 result AttachChild(const VisualElement& child);
412 * Inserts a child to this instance. @n
413 * If @c pReference is not @c null, the Z order group of @c child will be changed into that of @c pReference and @c child will be
414 * placed right above or below the @c pReference instance according to the @c above parameter.
418 * @return An error code
419 * @param[in] child The %VisualElement instance to attach to this instance
420 * @param[in] pReference A pointer to the %VisualElement instance that is referenced
421 * @param[in] above Specifies the position of @c child relative to the @c pReference
422 * @exception E_SUCCESS The method is successful.
423 * @exception E_INVALID_ARG The input parameter is incorrect. Either of the following conditions has occurred: @n
424 * - The specified @c child is not instantiated successfully. @n
425 * - The specified @c child is this instance. @n
426 * - The specified @c child and @c pReference are same. @n
427 * - The specified @c child is already an ancestor of this instance. @n
428 * - The parent of @c pReference is not this instance if @c pReference is not @c null. @n
429 * @remarks If @c above is @c true, the @c child will be attached above @c pReference in Z order,
430 * else it will be attached below the @c pReference %VisualElement. @n
431 * If @c pReference is @c null, the @c child will be attached at the highest position in the @c child's Z order group,
432 * else the child will be attached at the lowest position in the @c child's Z order group.
433 * @see SetZOrderGroup()
436 * @see ChangeZOrder()
438 result InsertChild(const VisualElement& child, const VisualElement* pReference, bool above);
441 * Detaches a child from this instance.
445 * @param[in] child The %VisualElement instance to detach from this instance
446 * @exception E_SUCCESS The method is successful.
447 * @exception E_OBJ_NOT_FOUND The specified @c child is not a child of this instance.
448 * @remarks This method detaches @c child from this instance. If you need to deallocate %VisualElement, call Destroy() method, not C++ delete.
452 result DetachChild(const VisualElement& child);
455 * Changes Z order of this instance.
459 * @param[in] pReference A pointer to the %VisualElement instance that is referenced
460 * @param[in] above Specifies the position of this instance relative to the @c pReference
461 * @exception E_SUCCESS The method is successful.
462 * @exception E_INVALID_ARG The input parameter is incorrect. Either of the following conditions has occurred: @n
463 * - This instance does not have a parent (not attached). @n
464 * - This instance and @c pReference do not have same parent if @c pReference is not @c null. @n
465 * - The specified @c pReference is this instance. @n
466 * @remarks If @c above is @c true, this instance will be attached above @c pReference in Z order,
467 * else it will be attached below the @c pReference %VisualElement. @n
468 * If @c pReference is @c null, this instance will be attached at the highest position in the Z order group of this instance,
469 * else the child will be attached at the lowest position in the Z order group of this instance.
474 result ChangeZOrder(const VisualElement* pReference, bool above);
477 * Gets the child of the specified @c name. @n
478 * If there are multiple matches of the name, it returns the first match.
482 * @return The %VisualElement instance having the specified @c name @n
483 * else @c null if there is not %VisualElement with the specified @c name
484 * @param[in] name The name of the %VisualElement
485 * @param[in] searchDescendants @c true to find a match among all the descendants of this instance, @n
487 * @exception E_SUCCESS The method is successful.
488 * @exception E_OBJ_NOT_FOUND There is no %VisualElement with the specified @c name.
489 * @remarks The specific error code can be accessed using the GetLastResult() method.
490 * @remarks If an exception occurs, this method returns @c null.
494 VisualElement* GetChild(const Tizen::Base::String& name, bool searchDescendants) const;
497 * Gets the farthest (highest Z order) %VisualElement descendant including this instance that contains a specified @c point. @n
498 * The OnHitTest() method or [HitTest](@ref Tizen::Ui::Animations::IVisualElementContentProvider::HitTest) callback may be called
499 * for descendants of this instance including itself.
503 * @return The %VisualElement that contains @c point, @n
504 * else @c null if @c point is completely outside of this instance
505 * @param[in] point The position in coordinate space of this instance
506 * @exception E_SUCCESS The method is successful.
507 * @exception E_OBJ_NOT_FOUND There is no %VisualElement containing the specified @c point.
508 * @remarks The specific error code can be accessed using the GetLastResult() method.
509 * @remarks If an exception occurs, this method returns @c null.
510 * @remarks This method assumes that all ancestors of this instance do not clip children.
511 * @see IVisualElementContentProvider::HitTest()
513 * @see IsClipChildrenEnabled()
514 * @see SetClipChildrenEnabled()
516 VisualElement* GetChildAt(const Tizen::Graphics::FloatPoint& point) const;
519 * Adds an animation without key name.
523 * @return An error code
524 * @param[in] animation The animation instance
525 * @exception E_SUCCESS The method is successful.
526 * @exception E_INVALID_ARG The input parameter is incorrect.
527 * @exception E_INVALID_OPERATION This instance is not a model object. @n
528 * An animation can be added to the model instance only.
529 * @see RemoveAnimation()
530 * @see GetAnimationN()
532 result AddAnimation(const VisualElementAnimation& animation);
535 * Adds an animation with key name.
539 * @return An error code
540 * @param[in] keyName The name of the animation that is used to identify animations @n
541 * Empty @c keyName is allowed.
542 * @param[in] animation The animation instance
543 * @exception E_SUCCESS The method is successful.
544 * @exception E_INVALID_ARG The input parameter is incorrect.
545 * @exception E_OBJ_ALREADY_EXIST An animation with @c keyName already exists.
546 * @exception E_INVALID_OPERATION This instance is not a model object. @n
547 * An animation can be added to the model instance only.
548 * @see RemoveAnimation()
549 * @see GetAnimationN()
551 result AddAnimation(const Tizen::Base::String& keyName, const VisualElementAnimation& animation);
554 * Removes the animation with the specified @c keyName.
558 * @return An error code
559 * @param[in] keyName The name of the animation to remove
560 * @exception E_SUCCESS The method is successful.
561 * @exception E_OBJ_NOT_FOUND An animation with @c keyName does not exist.
562 * @see AddAnimation()
563 * @see GetAnimationN()
565 result RemoveAnimation(const Tizen::Base::String& keyName);
568 * Gets the animation playing for the specified property.
572 * @return A pointer to the animation
573 * @param[in] keyName The name of the animation
574 * @exception E_SUCCESS The method is successful.
575 * @exception E_OBJ_NOT_FOUND An animation with @c keyName does not exist.
576 * @remarks The specific error code can be accessed using the GetLastResult() method.
577 * @remarks If an exception occurs, this method returns @c null.
578 * @see AddAnimation()
579 * @see RemoveAnimation()
581 VisualElementAnimation* GetAnimationN(const Tizen::Base::String& keyName) const;
584 * Removes all animations.
588 * @see AddAnimation()
589 * @see RemoveAnimation()
591 void RemoveAllAnimations(void);
594 * Adds a rectangle to update region of this instance. @n
595 * The update region represents the portion of the %VisualElement's area that must be redrawn by the OnDraw() method.
599 * @return An error code
600 * @param[in] pRectangle The pointer to the rectangular region that contains the coordinates of the rectangle to add to the update region @n
601 * If @c pRectangle is @c null, entire area is added to the update region.
602 * @exception E_SUCCESS The method is successful.
603 * @exception E_INVALID_OPERATION The contents of this instance is set by the SetSurface() method.
606 result InvalidateRectangle(const Tizen::Graphics::FloatRectangle* pRectangle);
609 * Gets the smallest rectangle that completely encloses the update region of this instance. @n
610 * Applications can use the update region in the OnDraw() method to minimize the redrawing area to improve performance.
611 * The %GetUpdateRectangle() method returns an empty rectangle if it is not called inside OnDraw() method.
615 * @return The rectangle to update
616 * @remarks The specific error code can be accessed using the GetLastResult() method.
617 * @remarks If an exception occurs, this method returns FloatRectangle(0.0, 0.0, -1.0, -1.0).
618 * @see InvalidateRectangle()
620 Tizen::Graphics::FloatRectangle GetUpdateRectangle(void) const;
623 * Updates the content area of all the descendants including this instance.
624 * The %Draw() method will call OnDraw() or DrawContent() method only if there are regions invalidated by InvalidateRectangle().
625 * The platform will call this method later automatically if applications do not call explicitly.
629 * @return An error code
630 * @exception E_SUCCESS The method is successful.
631 * @exception E_INVALID_STATE This instance is not attached to the maintained tree for displaying. @n
632 * For displaying, this instance should be descendant of the root %VisualElement.
633 * @exception E_SYSTEM A system error has occurred.
634 * @see IVisualElementContentProvider
639 * Marks the entire area of this instance to be flushed.
643 * @return An error code
644 * @exception E_SUCCESS The method is successful.
648 result SetFlushNeeded(void);
651 * Creates and returns a graphics canvas whose bounds, position, and size are equal to those of this instance.
655 * @return The graphic canvas of the %VisualElement, @n
656 * else @c null if an exception occurs
657 * @exception E_SUCCESS The method is successful.
658 * @exception E_INVALID_STATE This instance is in an invalid state.
659 * @exception E_INVALID_OPERATION The contents of this instance is set by the SetSurface() method.
660 * @exception E_OUT_OF_RANGE The size of the %VisualElement instance is @c 0 or smaller.
661 * @remarks This method allocates a Tizen::Graphics::Canvas whose bounds are equal to that of the %VisualElement.
662 * It is the developer's responsibility to deallocate the canvas after use.
663 * The canvas is guaranteed to be valid only if the properties of the parent %VisualElement of the canvas remain unchanged.
664 * Therefore, one must delete previously allocated canvas and create a new canvas using this method,
665 * if the size or position of the %VisualElement is changed. @n
666 * @remarks The specific error code can be accessed using the GetLastResult() method.
667 * @remarks If an exception occurs, this method returns @c null.
668 * @see GetCanvasN(const Tizen::Graphics::Rectangle& bounds)
670 Tizen::Graphics::Canvas* GetCanvasN(void) const;
674 * Creates and returns a graphic canvas of the specified area.
678 * @return The graphic canvas of the %VisualElement, @n
679 * else @c null if an exception occurs
680 * @param[in] bounds The position relative to the top-left corner of the %VisualElement and size
681 * @exception E_SUCCESS The method is successful.
682 * @exception E_INVALID_STATE This instance is in an invalid state.
683 * @exception E_INVALID_OPERATION The contents of this instance is set by the SetSurface() method.
684 * @exception E_OUT_OF_RANGE The specified @c bounds do not intersect with the bounds of the %VisualElement. @n
685 * The width and height must be greater than @c 0.
686 * @remarks Only the graphic canvas of displayable %VisualElement can be obtained.
687 * If the specified area is not inside the %VisualElement,
688 * the graphics canvas of overlapped area between the %VisualElement and the specified @c bound is returned. @n
689 * This method allocates a Tizen::Graphics::Canvas whose bounds are equal to that of the %VisualElement.
690 * It is the developer's responsibility to deallocate the canvas after use.
691 * The canvas is guaranteed to be valid only if the properties of the parent %VisualElement of the canvas remain unchanged.
692 * Therefore, one must delete previously allocated canvas and create a new canvas using this method,
693 * if the size or position of the control is changed. @n
694 * @remarks The specific error code can be accessed using the GetLastResult() method.
695 * @remarks If an exception occurs, this method returns @c null.
698 Tizen::Graphics::Canvas* GetCanvasN(const Tizen::Graphics::Rectangle& bounds) const;
701 * Gets the name of this instance.
705 * @return The name of this instance
707 Tizen::Base::String GetName(void) const;
710 * Sets the name of this instance.
714 * @param[in] name The name of the %VisualElement instance @n
715 * Empty or duplicated name with other instances are also allowed.
717 void SetName(const Tizen::Base::String& name);
720 * Gets the value of the %VisualElement's property.
724 * @return The value of the specified property
725 * @param[in] property The %VisualElement's property
726 * @exception E_SUCCESS The method is successful.
727 * @exception E_KEY_NOT_FOUND The specified @c property is not found.
728 * @remarks The specific error code can be accessed using the GetLastResult() method.
729 * @remarks If an exception occurs, this method returns @c Variant::NULL_VARIANT.
730 * @remarks Additional exceptions can occur according to the behavior of subclasses.
732 * @see OnGetPropertyRequested()
734 Variant GetProperty(const Tizen::Base::String& property) const;
737 * Sets the value of the %VisualElement's property.
741 * @return The property's value
742 * @param[in] property The %VisualElement's property
743 * @param[in] value The value of the %VisualElement's property to set
744 * @exception E_SUCCESS The method is successful.
745 * @exception E_KEY_NOT_FOUND The specified @c property is not found.
746 * @remarks Additional exceptions can occur according to the behavior of subclasses.
748 * @see OnSetPropertyRequested()
750 result SetProperty(const Tizen::Base::String& property, const Variant& value);
753 * Sets the Z order group of this instance.
757 * @return An error code
758 * @param[in] zOrderGroup The value of Z order which must be between @c Z_ORDER_GROUP_LOWEST and @c Z_ORDER_GROUP_HIGHEST @n
759 * The default value is @c Z_ORDER_GROUP_NORMAL.
760 * @exception E_SUCCESS The method is successful.
761 * @exception E_OUT_OF_RANGE The @c zOrderGroup is not between @c Z_ORDER_GROUP_LOWEST and @c Z_ORDER_GROUP_HIGHEST.
762 * @remarks You can choose the @c zOrderGroup value as follows: @n
763 * - Tizen::Ui::Animations::Z_ORDER_GROUP_LOWEST @n
764 * - Tizen::Ui::Animations::Z_ORDER_GROUP_NORMAL @n
765 * - Tizen::Ui::Animations::Z_ORDER_GROUP_HIGHEST @n
766 * Or you can specify an integer value between @c ZORDER_GROUP_LOWEST and @c ZORDER_GROUP_HIGHEST.
767 * @see GetZOrderGroup()
769 result SetZOrderGroup(int zOrderGroup);
772 * Gets the Z order group of this instance.
776 * @return The Z order group of this instance
777 * @see SetZOrderGroup()
779 int GetZOrderGroup(void) const;
782 * Checks whether the redraw-on-resize feature is enabled.
786 * @return @c true if the redraw-on-resize feature is enabled, @n
788 * @remarks The entire content area will be added to the update region when bounds are changed if redraw-on-resize is enabled. @n
789 * Otherwise, current contents will be scaled for the new bounds of this instance without redrawing.
790 * @see SetRedrawOnResizeEnabled()
792 bool IsRedrawOnResizeEnabled(void) const;
795 * Enables or disables the redraw-on-resize feature.
799 * @param[in] enable Set to @c true if invalidation is needed whenever resized, @n
801 * @see IsRedrawOnResizeEnabled()
803 void SetRedrawOnResizeEnabled(bool enable);
806 * Gets the position and the size of this instance.
810 * @return An instance of the Tizen::Graphics::FloatRectangle that represents the position of top-left corner, @n
811 * the width, and the height of this instance. @n It has relative coordinate space to the parent.
814 Tizen::Graphics::FloatRectangle GetBounds(void) const;
817 * Sets the position and the size of this instance.
821 * @return An error code
822 * @param[in] bounds The new bounds of this instance
823 * @exception E_SUCCESS The method is successful.
824 * @exception E_INVALID_STATE This instance is in an invalid state.
825 * @remarks When the size of @c bounds is changed, the entire content area will be added to the update region of this instance if redraw-on-resize feature is enabled.
827 * @see IsRedrawOnResizeEnabled()
828 * @see SetRedrawOnResizeEnabled()
830 result SetBounds(const Tizen::Graphics::FloatRectangle& bounds);
833 * Gets the position on the Z-axis.
837 * @return The position on the Z-axis
838 * @see SetZPosition()
840 float GetZPosition(void) const;
843 * Sets the position on the Z-axis.
847 * @param[in] zPosition The position on the Z-axis
848 * @see GetZPosition()
850 void SetZPosition(float zPosition);
853 * Checks whether this instance is visible or not. @n
854 * Even if the show state is @c true, this instance can be invisible when show state of one of the ancestors is @c false.
858 * @return @c true if this instance is visible, @n
860 * @see GetShowState()
861 * @see SetShowState()
863 bool IsVisible(void) const;
866 * Gets the show state of this instance.
870 * @return The show state of the %VisualElement instance, @n
872 * @remarks Even if the show state is @c true, the %VisualElement is invisible if it is not attached to a parent.
873 * @see SetShowState()
876 bool GetShowState(void) const;
879 * Sets the show state of this instance.
883 * @param[in] show Set to @c true if this instance needs to show, @n
885 * @see GetShowState()
888 void SetShowState(bool show);
891 * Gets the opacity of this instance.
895 * @return The opacity of this instance
898 float GetOpacity(void) const;
901 * Sets the opacity of this instance.
905 * @param[in] opacity The new opacity which must be within the range [0.0, 1.0]
906 * @remarks The changing opacity affects all the descendants of this instance.
909 void SetOpacity(float opacity);
912 * Enables or disables the implicit animation. @n
913 * If enabled, implicit animations may be created whenever animatable properties of this instance change.
917 * @param[in] enable Set to @c true to enable the implicit animation, @n
919 * @remarks The implicit animation is enabled by default.
920 * @see IsImplicitAnimationEnabled()
922 void SetImplicitAnimationEnabled(bool enable);
925 * Checks whether the implicit animation is enabled.
929 * @return @c true if the implicit animation is enabled, @n
931 * @see SetImplicitAnimationEnabled()
933 bool IsImplicitAnimationEnabled(void) const;
936 * Gets the transform matrix of this instance.
940 * @return The transform matrix of this instance
941 * @see SetTransformMatrix()
943 Tizen::Graphics::FloatMatrix4 GetTransformMatrix(void) const;
946 * Sets the transform matrix of this instance.
950 * @return An error code
951 * @param[in] transform The transform matrix
952 * @exception E_SUCCESS The method is successful.
953 * @exception E_INVALID_ARG The input parameter is incorrect. @n
954 * The E_INVALID_ARG exception occurs when the specified @c transform is not invertible.
955 * @see GetTransformMatrix()
957 result SetTransformMatrix(const Tizen::Graphics::FloatMatrix4& transform);
960 * Gets the transform matrix applied to each child.
964 * @return The transform matrix applied to each child
965 * @remarks The transform matrix for children is typically used for the projection matrix to layout children in 3D space.
966 * @see SetChildrenTransformMatrix()
968 Tizen::Graphics::FloatMatrix4 GetChildrenTransformMatrix(void) const;
971 * Sets the transform matrix applied to each child.
975 * @return An error code
976 * @param[in] transform The transform matrix
977 * @exception E_SUCCESS The method is successful.
978 * @exception E_INVALID_ARG The input parameter is incorrect. @n
979 * The E_INVALID_ARG exception occurs when the specified @c transform is not invertible.
980 * @see GetChildrenTransformMatrix()
982 result SetChildrenTransformMatrix(const Tizen::Graphics::FloatMatrix4& transform);
986 * Gets the anchor point for this instance's transform matrix in uniform coordinate space
987 * (0.0 and 1.0 mean left/top and right/bottom of the bounds, respectively).
991 * @return The anchor point of this instance
994 Tizen::Graphics::FloatPoint GetAnchor(void) const;
997 * Sets the anchor point of this instance's transform matrix in uniform coordinate space
998 * (0.0 and 1.0 mean left/top and right/bottom of the bounds, respectively).
1002 * @param[in] anchor The anchor point in uniform coordinate space
1005 void SetAnchor(const Tizen::Graphics::FloatPoint& anchor);
1008 * Gets the Z component of this instance's anchor point for transform matrix.
1012 * @return The Z component of the anchor point
1015 float GetAnchorZ(void) const;
1018 * Sets the Z component of this instance's anchor point for transform matrix.
1022 * @param[in] anchorZ The Z component of anchor point
1025 void SetAnchorZ(float anchorZ);
1028 * Gets the custom data of this instance.
1032 * @return The user data associated with this instance
1033 * @see SetUserData()
1035 void* GetUserData(void) const;
1038 * Sets the custom data of this instance.
1042 * @param[in] pUserData The user data associated with this instance
1043 * @see GetUserData()
1045 void SetUserData(void* pUserData);
1048 * Sets the contents of this instance with the specified VisualElementSurface. @n
1049 * The contents of the @c pSurface is not copied by the %SetSurface() method, but shared with this instance.
1053 * @return An error code
1054 * @param[in] pSurface The pointer to VisualElementSurface @n
1055 * If @c pSurface is @c null, surface will be created internally by system.
1056 * @exception E_SUCCESS The method is successful.
1057 * @exception E_INVALID_OPERATION This instance does not allow VisualElementSurface for contents.
1058 * @remarks If applications modify the contents of @c pSurface, the modifications will be applied to all
1059 * the %VisualElements which share same VisualElementSurface. But in this case, applications need to call
1060 * the SetFlushNeeded() method for those %VisualElements because the modifications of the @c pSurface will not be applied on the screen automatically.
1061 * @see GetSurfaceN()
1063 result SetSurface(VisualElementSurface* pSurface);
1066 * Gets the VisualElementSurface this instance uses for its contents.
1070 * @return A pointer to VisualElementSurface
1071 * @exception E_SUCCESS The method is successful.
1072 * @exception E_SYSTEM A system error has occurred.
1073 * @remarks The specific error code can be accessed using the GetLastResult() method.
1074 * @remarks If an exception occurs, this method returns @c null.
1077 VisualElementSurface* GetSurfaceN(void) const;
1080 * Sets the render operation of this instance.
1084 * @return An error code
1085 * @param[in] renderOperation The new rendering operation
1086 * @exception E_SUCCESS The method is successful.
1087 * @exception E_INVALID_ARG The specified @c renderOperation is out of range.
1088 * @see GetRenderOperation()
1090 result SetRenderOperation(RenderOperation renderOperation);
1093 * Gets the render operation of this instance.
1097 * @return The render operation of this instance
1098 * @see SetRenderOperation()
1100 RenderOperation GetRenderOperation(void) const;
1103 * Checks whether all the descendants are clipped to the bounds of this instance.
1107 * @return @c true if this instance clips all the descendants, @n
1109 * @see SetClipChildrenEnabled()
1111 bool IsClipChildrenEnabled(void) const;
1114 * Enables or disables clipping of all the descendants.
1118 * @param[in] clipChildren Set to @c true if all the descendants are needed to clip to the bounds of this instance, @n
1120 * @see IsClipChildrenEnabled()
1122 void SetClipChildrenEnabled(bool clipChildren);
1125 * Converts the specified @c point in @c pFromVisualElement coordinate space to this instance's coordinate space.
1129 * @return An error code
1130 * @param[in,out] point The point to convert
1131 * @param[in] pFromVisualElement The %VisualElement instance with @c point in its coordinate space
1132 * @exception E_SUCCESS The method is successful.
1133 * @exception E_INVALID_ARG The input parameter is incorrect.
1134 * @remarks This instance and @c pFromVisualElement must share a common ancestor. @n
1135 * If @c null, it is regarded that @c point is in the screen coordinate space.
1136 * @see ConvertCoordinates(Tizen::Graphics::FloatRectangle& rectangle, const VisualElement* pFromVisualElement)
1138 result ConvertCoordinates(Tizen::Graphics::FloatPoint& point, const VisualElement* pFromVisualElement) const;
1141 * Converts the specified @c rectangle in @c pFromVisualElement coordinate space to this instance's coordinate space.
1145 * @return An error code
1146 * @param[in,out] rectangle The rectangle to convert
1147 * @param[in] pFromVisualElement The %VisualElement instance with @c rectangle in its coordinate space
1148 * @exception E_SUCCESS The method is successful.
1149 * @exception E_INVALID_ARG The input parameter is incorrect.
1150 * @exception E_SYSTEM A system error has occurred.
1151 * @remarks This instance and @c pFromVisualElement must share a common parent. @n
1152 * If @c null, it is regarded that @c rectangle is in the screen coordinate space.
1153 * @see ConvertCoordinates(Tizen::Graphics::FloatPoint& point, const VisualElement* pFromVisualElement)
1155 result ConvertCoordinates(Tizen::Graphics::FloatRectangle& rectangle, const VisualElement* pFromVisualElement) const;
1158 * Sets the sub-rectangle of contents which this instance must display.
1162 * @return An error code
1163 * @param[in] contentBounds The sub-rectangle of contents to display in uniform coordinate space
1164 * @exception E_SUCCESS The method is successful.
1165 * @exception E_INVALID_ARG The width and height of @c contentBounds must be greater than @c 0.0.
1166 * @remarks Default @c contentBounds is FloatRectangle(0.0, 0.0, 1.0, 1.0).
1167 * @remarks If each component of @c contentBounds is not within the range [0.0, 1.0], the integer portion of the coordinates are
1168 * ignored and only fractional part is used which creates a repeating contents.
1169 * @see GetContentBounds()
1171 result SetContentBounds(const Tizen::Graphics::FloatRectangle& contentBounds);
1174 * Gets the sub-rectangle of contents which this instance must display.
1178 * @return The sub-rectangle of contents to be displayed in uniform coordinate space
1179 * @remarks Default @c contentBounds is FloatRectangle(0.0, 0.0, 1.0, 1.0).
1180 * @see SetContentBounds()
1182 Tizen::Graphics::FloatRectangle GetContentBounds(void) const;
1185 * Acquires the %VisualElement instance for display.
1189 * @return The %VisualElement instance for display(readonly)
1190 * @remarks If this instance is a presentation object, this method returns itself.
1191 * @see ReleasePresentationInstance()
1193 const VisualElement* AcquirePresentationInstance(void);
1196 * Releases the %VisualElement instance for display.
1200 * @remarks This method should be called only after AcquirePresentationInstance() call.
1201 * @see AcquirePresentationInstance()
1203 void ReleasePresentationInstance(void);
1206 * Acquires the %VisualElement instance for model.
1210 * @return The %VisualElement instance for model(readonly)
1211 * @remarks If this instance is a model object, this method returns itself.
1212 * @see ReleaseModelInstance()
1215 const VisualElement* AcquireModelInstance(void);
1218 * Releases the %VisualElement instance for model.
1222 * @remarks This method should be called only after AcquireModelInstance() call.
1224 void ReleaseModelInstance(void);
1227 * Flushes %VisualElements on screen.
1231 * @return An error code
1232 * @exception E_SUCCESS The method is successful.
1233 * @exception E_SYSTEM A system error has occurred.
1234 * @remarks Because this method may degrade the performance of system, applications must use this method only when really needed.
1235 * @see SetFlushNeeded()
1237 static result Flush(void);
1242 * This is copy constructor for the %VisualElement class.
1246 * @param[in] rhs An instance of %VisualElement
1249 VisualElement(const VisualElement& rhs);
1252 * This is the destructor for this class.
1256 * @remarks The delete operator cannot be used to deallocate the %VisualElement instance.
1259 virtual ~VisualElement(void);
1262 * Creates and returns a polymorphic copy of this %VisualElement instance for the presentation. @n
1263 * All descendants of %VisualElement must implement the %CloneN() method and the copy constructor appropriately. @n
1264 * When the %VisualElement instance is created, the framework make a %VisualElement for the presentation with this method.
1268 * @return The clone of this instance
1270 virtual VisualElement* CloneN(void) const;
1274 // This method is for internal use only. Using this method can cause behavioral, security-related,
1275 // and consistency-related issues in the application.
1278 // This method is reserved and may change its name at any time without prior notice.
1282 virtual void VisualElement_Reserved1(void) {}
1286 // This method is for internal use only. Using this method can cause behavioral, security-related,
1287 // and consistency-related issues in the application.
1290 // This method is reserved and may change its name at any time without prior notice.
1294 virtual void VisualElement_Reserved2(void) {}
1298 // This method is for internal use only. Using this method can cause behavioral, security-related,
1299 // and consistency-related issues in the application.
1302 // This method is reserved and may change its name at any time without prior notice.
1306 virtual void VisualElement_Reserved3(void) {}
1310 // This method is for internal use only. Using this method can cause behavioral, security-related,
1311 // and consistency-related issues in the application.
1314 // This method is reserved and may change its name at any time without prior notice.
1318 virtual void VisualElement_Reserved4(void) {}
1322 // This method is for internal use only. Using this method can cause behavioral, security-related,
1323 // and consistency-related issues in the application.
1326 // This method is reserved and may change its name at any time without prior notice.
1330 virtual void VisualElement_Reserved5(void) {}
1336 // The implementation of this assignment constructor is intentionally blank to prohibit assignment of objects.
1340 VisualElement& operator =(const VisualElement& rhs);
1344 _VisualElementImpl* _pVisualElementImpl;
1346 friend class _VisualElementImpl;
1350 }}} // Tizen::Ui::Animations
1352 #endif //_FUIANIMVISUALELEMENT_H_