a0c3cc6e3a9df2be04a63949b4fa8fb1e49bd929
[platform/core/uifw/pepper-dali.git] / pepper-dali / internal / object-view-impl.h
1 #ifndef __DALI_PEPPER_INTERNAL_OBJECT_VIEW_H__
2 #define __DALI_PEPPER_INTERNAL_OBJECT_VIEW_H__
3
4 /*
5  * Copyright (c) 2016 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 <pepper-dali/public-api/object-view/object-view.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/images/buffer-image.h>
26 #include <dali-toolkit/public-api/controls/control-impl.h>
27 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
28 #include <pepper.h>
29
30 namespace Dali
31 {
32
33 namespace Pepper
34 {
35
36 namespace Internal
37 {
38
39 class ObjectView : public Toolkit::Internal::Control
40 {
41 public:
42
43   /**
44    * @copydoc Dali::Pepper::ObjectView::New
45    */
46   static Dali::Pepper::ObjectView New();
47
48   /**
49    * @copydoc Dali::Pepper::ObjectView::SetImage
50    */
51   void SetImage( Image image );
52
53   /**
54    * @copydoc Dali::Pepper::ObjectView::GetPid
55    */
56   pid_t GetPid() const;
57
58   /**
59    * @copydoc Dali::Pepper::ObjectView::GetTitle
60    */
61   std::string GetTitle() const;
62
63   /**
64    * @copydoc Dali::Pepper::ObjectView::GetAppId
65    */
66   std::string GetAppId() const;
67
68   /**
69    * @copydoc Dali::Pepper::ObjectView::CancelTouchEvent
70    */
71   bool CancelTouchEvent();
72
73   /**
74    * Set pepper surface
75    */
76   void SetSurface( pepper_surface_t* surface );
77
78   /**
79    * Set pepper input modules
80    */
81   void SetInput( pepper_pointer_t* pointer, pepper_keyboard_t* keyboard, pepper_touch_t* touch );
82
83 protected:
84
85   /**
86    * Construct a new ObjectView.
87    */
88   ObjectView();
89
90   /**
91    * A reference counted object may only be deleted by calling Unreference()
92    */
93   virtual ~ObjectView();
94
95 protected: // From CustomActorImpl
96
97   /**
98    * @copydoc Dali::CustomActorImpl::OnTouchEvent( const TouchEvent& event )
99    */
100   virtual bool OnTouchEvent( const TouchEvent& event );
101
102 private: // From Control
103
104   /**
105    * @copydoc Dali::Toolkit::Control::OnInitialize()
106    */
107   virtual void OnInitialize();
108
109 private:
110
111   // Undefined
112   ObjectView( const ObjectView& );
113
114   // Undefined
115   ObjectView& operator= ( const ObjectView& );
116
117 private:
118
119   Toolkit::ImageView mImageView;
120   BufferImage mBufferImage;
121
122   int mWidth;
123   int mHeight;
124
125   bool mTouchDown;
126
127   pepper_surface_t* mSurface;
128   pepper_pointer_t* mPointer;
129   pepper_keyboard_t* mKeyboard;
130   pepper_touch_t* mTouch;
131 };
132
133 } // namespace Internal
134
135 // Helpers for public-api forwarding methods
136
137 inline Pepper::Internal::ObjectView& GetImplementation( Pepper::ObjectView& objectView )
138 {
139   DALI_ASSERT_ALWAYS( objectView );
140
141   Dali::RefObject& handle = objectView.GetImplementation();
142
143   return static_cast<Internal::ObjectView&>( handle );
144 }
145
146 inline const Pepper::Internal::ObjectView& GetImplementation( const Pepper::ObjectView& objectView )
147 {
148   DALI_ASSERT_ALWAYS( objectView );
149
150   const Dali::RefObject& handle = objectView.GetImplementation();
151
152   return static_cast<const Internal::ObjectView&>( handle );
153 }
154
155 } // namespace Pepper
156
157 } // namespace Dali
158
159 #endif // __DALI_PEPPER_INTERNAL_OBJECT_VIEW_H__