(Properties) Added ability to add non-animatable event-thread only properties via...
[platform/core/uifw/dali-core.git] / dali / internal / event / actor-attachments / actor-attachment-impl.h
1 #ifndef __DALI_INTERNAL_ACTOR_ATTACHMENT_H__
2 #define __DALI_INTERNAL_ACTOR_ATTACHMENT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/public-api/object/ref-object.h>
22
23 namespace Dali
24 {
25
26 namespace Internal
27 {
28
29 class Stage;
30
31 /**
32  * An abstract base class for attachments, such a renderable objects and lights.
33  * ActorAttachments must be attached to an actor, in order to be displayed.
34  */
35 class ActorAttachment : public Dali::RefObject
36 {
37 public:
38
39   /**
40    * Query whether the attachment is connected to the stage.
41    * @return True if the attachment is connected to the stage.
42    */
43   bool OnStage() const;
44
45   /**
46    * Called by the attached actor, when connected to the Stage.
47    */
48   void Connect();
49
50   /**
51    * Called by the attached actor, when the actor is disconnected from the Stage.
52    */
53   void Disconnect();
54
55   /**
56    * Sets whether a renderable attachment is visible.
57    * By default attachments are visible.
58    * @param[in] visible True if the object is visible.
59    */
60   void SetVisible(bool visible);
61
62   /**
63    * Retrieve whether a renderable attachment is visible.
64    * @return True if the object is visible.
65    */
66   bool IsVisible() const;
67
68 protected:
69
70   /**
71    * Construct a new attachment.
72    * @param[in] stage Used to send messages to scene-graph.
73    */
74   ActorAttachment( Stage& stage );
75
76   /**
77    * A reference counted object may only be deleted by calling Unreference()
78    */
79   virtual ~ActorAttachment();
80
81 private:
82
83   // Undefined
84   ActorAttachment(const ActorAttachment&);
85
86   // Undefined
87   ActorAttachment& operator=(const ActorAttachment& rhs);
88
89   /**
90    * For use in derived classes, called after ConnectToStage()
91    */
92   virtual void OnStageConnection() = 0;
93
94   /**
95    * For use in derived classes, called after DisconnectFromStage()
96    */
97   virtual void OnStageDisconnection() = 0;
98
99 protected:
100
101   Stage* mStage; ///< Used to send messages to scene-graph; valid until Core destruction
102
103   bool mIsOnStage : 1; ///< Flag to identify whether the attachment is on-stage
104 };
105
106 } // namespace Internal
107
108 } // namespace Dali
109
110 #endif // __DALI_INTERNAL_ACTOR_ATTACHMENT_H__