[Tizen] Create Widget Application
[platform/core/uifw/dali-adaptor.git] / adaptors / widget / internal / widget-data-impl.h
1 #ifndef __DALI_INTERNAL_WIDGET_DATA_H__
2 #define __DALI_INTERNAL_WIDGET_DATA_H__
3
4 /*
5  * Copyright (c) 2017 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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <widget-data.h>
26 #include <window.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36 class WidgetData;
37 typedef IntrusivePtr<WidgetData> WidgetDataPtr;
38
39 /**
40  * Implementation of the Application class.
41  */
42 class WidgetData : public BaseObject
43 {
44 public:
45
46   /**
47    * Create a new WidgetData
48    * @param[in]      instanceId for widget instance
49    * @param[in]      args for widget instance
50    * @param[in]      content for widget instance
51    * @return A handle to the WidgetData
52    */
53   static Dali::WidgetData New( const char* instanceId, bundle* args, char* content );
54
55   /**
56    * @brief Get widget instance id
57    * @SINCE_1_2.47
58    * @return Id of widget instance
59    */
60   const char* GetInstanceId();
61
62   /**
63    * @brief Get widget instance arguments
64    * @SINCE_1_2.47
65    * @return Bundle which contains widget instance arguments
66    */
67   bundle* GetArgs();
68
69   /**
70    * @brief Get widget instance content
71    * @SINCE_1_2.47
72    * @return Content of widget instance
73    */
74   char* GetContent();
75
76   /**
77    * @brief Get widget instance Window
78    * @SINCE_1_2.47
79    * @return Window of widget instance
80    */
81   Dali::Window GetWindow();
82
83   /**
84    * @brief Set widget instance arguments
85    * @SINCE_1_2.47
86    * @param[in] args arguments of widget instance
87    */
88   void SetArgs( bundle* args );
89
90   /**
91    * @brief Set widget instance arguments
92    * @SINCE_1_2.47
93    * @param[in] content content of widget instance
94    */
95   void SetContent( char* content );
96
97   /**
98    * @brief Set widget instance arguments
99    * @SINCE_1_2.47
100    * @param[in] window Window of widget instance
101    */
102   void SetWindow( Dali::Window window );
103
104 protected:
105
106   /**
107    * Private Constructor
108    * @param[in]      instanceId for widget instance
109    * @param[in]      args for widget instance
110    * @param[in]      content for widget instance
111    */
112   WidgetData( const char* instanceId, bundle* args, char* content );
113
114   /**
115    * Destructor
116    */
117   virtual ~WidgetData();
118
119   // Undefined
120   WidgetData(const WidgetData&);
121   WidgetData& operator=(WidgetData&);
122
123 private:
124
125   Dali::Window   mWindow;
126   bundle*        mArgs;
127   const char*    mInstanceId;
128   char*          mContent;
129
130 };
131
132 inline WidgetData& GetImplementation(Dali::WidgetData& widgetData)
133 {
134   DALI_ASSERT_ALWAYS(widgetData && "widget data handle is empty");
135
136   BaseObject& handle = widgetData.GetBaseObject();
137
138   return static_cast<Internal::Adaptor::WidgetData&>(handle);
139 }
140
141 inline const WidgetData& GetImplementation(const Dali::WidgetData& widgetData)
142 {
143   DALI_ASSERT_ALWAYS(widgetData && "widget data handle is empty");
144
145   const BaseObject& handle = widgetData.GetBaseObject();
146
147   return static_cast<const Internal::Adaptor::WidgetData&>(handle);
148 }
149
150 } // namespace Adaptor
151
152 } // namespace Internal
153
154 } // namespace Dali
155
156 #endif // __DALI_INTERNAL_WIDGET_DATA_H__