Source code formating unification
[platform/framework/web/wrt.git] / src / domain / widget_model.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file    widget_model.h
18  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
19  * @version 1.0
20  * @brief   Header file for widget model
21  */
22 #ifndef SRC_DOMAIN_WIDGET_MODEL_H
23 #define SRC_DOMAIN_WIDGET_MODEL_H
24
25 #include <dpl/event/model.h>
26 #include <dpl/event/property.h>
27 #include <dpl/optional.h>
28 #include <string>
29
30 #include "widget_data_types.h"
31
32 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
33
34 /**
35  * @brief Widget model
36  *
37  * Widget model is the core object that hold information about
38  * properties of widget. After wrt launch each widget contained in database is
39  * mapped to WidgetModel.
40  *
41  * Widget model is a type of MVC model, so it is possible to listen for it's
42  * changes.
43  *
44  */
45 class WidgetModel : public DPL::Event::Model
46 {
47   public:
48
49     /**
50      * @brief Tizen id
51      *
52      *  ex> "TizenIDabc.appname"
53      *
54      *  - TizenId / AppId : "TizenIDabc.appname"
55      *  - TzPkgId         : "TizenIDabc"
56      *  - App name        : "appname"
57      *
58      */
59     DPL::String TizenId;
60     DPL::Event::Property<WrtDB::TizenPkgId,
61                          DPL::Event::PropertyReadOnly,
62                          DPL::Event::PropertyStorageDynamicCached> TzPkgId;
63
64     /**
65      * @brief Widget type
66      *
67      * Note: This is a readonly property
68      */
69     DPL::Event::Property<WrtDB::WidgetType,
70                          DPL::Event::PropertyReadOnly,
71                          DPL::Event::PropertyStorageDynamicCached> Type;
72
73     /**
74      * @brief Current widget actual size
75      */
76     DPL::Event::Property<WidgetSize> ActualSize;
77
78     /**
79      * @brief Current widget preferred size
80      */
81     DPL::Event::Property<WidgetSize,
82                          DPL::Event::PropertyReadOnly,
83                          DPL::Event::PropertyStorageDynamicCached>
84     PreferredSize;
85
86     /**
87      * @brief Start URL for widget
88      */
89     DPL::Event::Property<DPL::OptionalString> StartURL;
90
91     /**
92      * @brief Start URL information for widget
93      */
94     DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
95
96     /**
97      * @brief Prefix URL for widget
98      *
99      * This is a prefix address of html file that widget is displaying.
100      * The whole address is PrefixURL + StartURL.
101      */
102     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
103
104     /**
105      * @brief Install path for widget
106      *
107      * Gets path in which files of widget are being kept
108      */
109     DPL::Event::Property<DPL::String,
110                          DPL::Event::PropertyReadOnly,
111                          DPL::Event::PropertyStorageDynamicCached> InstallPath;
112
113     /**
114      * @brief Path to widget's persistent storage.
115      *
116      * Gets path in which widget may store its persistent private data.
117      */
118     DPL::Event::Property<DPL::String,
119                          DPL::Event::PropertyReadOnly> PersistentStoragePath;
120
121     /**
122      * @brief Path to widget's temporary storage.
123      *
124      * Gets path in which widget may store its temporary private data.
125      */
126     DPL::Event::Property<DPL::String,
127                          DPL::Event::PropertyReadOnly> TemporaryStoragePath;
128
129     /**
130      * @brief Widget defaultlocale
131      */
132     DPL::Event::Property<DPL::OptionalString,
133                          DPL::Event::PropertyReadOnly,
134                          DPL::Event::PropertyStorageDynamicCached>
135     defaultlocale;
136
137     /**
138      * @brief Widget name
139      */
140     DPL::Event::Property<DPL::OptionalString> Name;
141
142     /**
143      * @brief Widget short name
144      */
145     DPL::Event::Property<DPL::OptionalString> ShortName;
146
147     /**
148      * @brief Widget description
149      */
150     DPL::Event::Property<DPL::OptionalString> Description;
151
152     /**
153      * @brief Widget license
154      */
155     DPL::Event::Property<DPL::OptionalString> License;
156
157     /**
158      * @brief Widget license href
159      */
160     DPL::Event::Property<DPL::OptionalString> LicenseHref;
161
162     /**
163      * @brief Widget icon
164      */
165     DPL::Event::Property<OptionalWidgetIcon> Icon;
166
167     /**
168      * @brief Widget splash image src
169      */
170     DPL::Event::Property<DPL::OptionalString,
171                          DPL::Event::PropertyReadOnly,
172                          DPL::Event::PropertyStorageDynamicCached> SplashImg;
173
174     /**
175      * @brief window mode
176      */
177     DPL::Event::Property<WrtDB::WindowModeList,
178                          DPL::Event::PropertyReadOnly,
179                          DPL::Event::PropertyStorageDynamic> WindowModes;
180
181     //    /**
182     //     * @brief Value of network element.
183     //     */
184     //    DPL::Event::Property<bool,
185     //                  DPL::Event::PropertyReadOnly> AccessNetwork;
186
187     //    /**
188     //     * @brief Does widget contain WARP definitions.
189     //     */
190     //    DPL::Event::Property<bool> WarpDefinitionEmpty;
191
192     /**
193      * @brief Is back supported
194      */
195     DPL::Event::Property<bool,
196                          DPL::Event::PropertyReadOnly,
197                          DPL::Event::PropertyStorageDynamicCached>
198     BackSupported;
199
200     /**
201      * @brief Widget access list
202      */
203     DPL::Event::Property<WidgetAccessList> AccessList;
204
205     /**
206      * @brief Is this DeveloperWidget
207      */
208     DPL::Event::Property<bool,
209                          DPL::Event::PropertyReadOnly,
210                          DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
211
212     DPL::Event::Property<WidgetSettingList> SettingList;
213
214     /**
215      * @brief Widget Application Service list
216      */
217     DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
218
219     WidgetModel(const std::string &tizenId);
220
221   private:
222     // Custom read write delegates
223     static DPL::String           getTimestamp();
224
225     DPL::String getTizenId() const;
226 };
227
228 #endif // SRC_DOMAIN_WIDGET_MODEL_H