Merge "Added previously ommited types of geometry: LINE_STRIP, LINE_LOOP in the ...
[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 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 // INTERNAL INCLUDES
22 #include <dali/public-api/object/ref-object.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 class EventThreadServices;
31
32 /**
33  * An abstract base class for attachments, such a renderable objects and lights.
34  * ActorAttachments must be attached to an actor, in order to be displayed.
35  */
36 class ActorAttachment : public Dali::RefObject
37 {
38 public:
39
40   /**
41    * Query whether the attachment is connected to the stage.
42    * @return True if the attachment is connected to the stage.
43    */
44   bool OnStage() const;
45
46   /**
47    * Called by the attached actor, when connected to the Stage.
48    */
49   void Connect();
50
51   /**
52    * Called by the attached actor, when the actor is disconnected from the Stage.
53    */
54   void Disconnect();
55
56 protected:
57
58   /**
59    * Construct a new attachment.
60    * @param[in] eventThreadServices Used for messaging to and reading from scene-graph.
61    */
62   ActorAttachment( EventThreadServices& eventThreadServices );
63
64   /**
65    * A reference counted object may only be deleted by calling Unreference()
66    */
67   virtual ~ActorAttachment();
68
69 private:
70
71   // Undefined
72   ActorAttachment(const ActorAttachment&);
73
74   // Undefined
75   ActorAttachment& operator=(const ActorAttachment& rhs);
76
77   /**
78    * For use in derived classes, called after ConnectToStage()
79    */
80   virtual void OnStageConnection() = 0;
81
82   /**
83    * For use in derived classes, called after DisconnectFromStage()
84    */
85   virtual void OnStageDisconnection() = 0;
86
87 protected:
88   /**
89    * For use in message sending to and property reading from the scene graph
90    * Inlined for speed
91    * @return The EventThreadServices object
92    */
93   inline EventThreadServices& GetEventThreadServices()
94   {
95     return mEventThreadServices;
96   }
97
98   /**
99    * For use in message sending to and property reading from the scene graph
100    * Inlined for speed
101    */
102   inline const EventThreadServices& GetEventThreadServices() const
103   {
104     return mEventThreadServices;
105   }
106
107 private:
108   EventThreadServices& mEventThreadServices; ///< Used to send messages to scene-graph; valid until Core destruction
109
110 protected:
111   bool mIsOnStage : 1; ///< Flag to identify whether the attachment is on-stage
112
113 };
114
115 } // namespace Internal
116
117 } // namespace Dali
118
119 #endif // __DALI_INTERNAL_ACTOR_ATTACHMENT_H__