2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file widget_model.h
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief Header file for widget model
22 #ifndef SRC_DOMAIN_WIDGET_MODEL_H
23 #define SRC_DOMAIN_WIDGET_MODEL_H
25 #include <dpl/event/model.h>
26 #include <dpl/event/property.h>
27 #include <dpl/optional.h>
30 #include "widget_data_types.h"
32 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
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.
41 * Widget model is a type of MVC model, so it is possible to listen for it's
45 class WidgetModel : public DPL::Event::Model
50 * @brief Widget handle
52 * Note: This is a readonly property
54 DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
59 * Note: This is a readonly property
61 DPL::Event::Property<WrtDB::WidgetType,
62 DPL::Event::PropertyReadOnly,
63 DPL::Event::PropertyStorageDynamicCached> Type;
66 * @brief Current widget actual size
68 DPL::Event::Property<WidgetSize> ActualSize;
71 * @brief Current widget preferred size
73 DPL::Event::Property<WidgetSize,
74 DPL::Event::PropertyReadOnly,
75 DPL::Event::PropertyStorageDynamicCached> PreferredSize;
78 * @brief Start URL for widget
80 DPL::Event::Property<DPL::OptionalString> StartURL;
83 * @brief Start URL information for widget
85 DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
88 * @brief Prefix URL for widget
90 * This is a prefix address of html file that widget is displaying.
91 * The whole address is PrefixURL + StartURL.
93 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
96 * @brief Install path for widget
98 * Gets path in which files of widget are being kept
100 DPL::Event::Property<DPL::String,
101 DPL::Event::PropertyReadOnly,
102 DPL::Event::PropertyStorageDynamicCached> InstallPath;
105 * @brief Path to widget's persistent storage.
107 * Gets path in which widget may store its persistent private data.
109 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
112 * @brief Path to widget's temporary storage.
114 * Gets path in which widget may store its temporary private data.
116 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
121 DPL::Event::Property<WrtDB::WidgetGUID,
122 DPL::Event::PropertyReadOnly,
123 DPL::Event::PropertyStorageDynamicCached> GUID;
126 * @brief Widget defaultlocale
128 DPL::Event::Property<DPL::OptionalString,
129 DPL::Event::PropertyReadOnly,
130 DPL::Event::PropertyStorageDynamicCached> defaultlocale;
133 * @brief Widget version
135 DPL::Event::Property<OptionalWidgetVersion,
136 DPL::Event::PropertyReadOnly,
137 DPL::Event::PropertyStorageDynamicCached> Version;
142 DPL::Event::Property<DPL::OptionalString> Name;
145 * @brief Widget short name
147 DPL::Event::Property<DPL::OptionalString> ShortName;
150 * @brief Widget description
152 DPL::Event::Property<DPL::OptionalString> Description;
155 * @brief Widget license
157 DPL::Event::Property<DPL::OptionalString> License;
160 * @brief Widget license href
162 DPL::Event::Property<DPL::OptionalString> LicenseHref;
167 DPL::Event::Property<OptionalWidgetIcon> Icon;
170 * @brief Widget splash image src
172 DPL::Event::Property<DPL::OptionalString,
173 DPL::Event::PropertyReadOnly,
174 DPL::Event::PropertyStorageDynamicCached> SplashImg;
179 DPL::Event::Property<WrtDB::WindowModeList,
180 DPL::Event::PropertyReadOnly,
181 DPL::Event::PropertyStorageDynamic> WindowModes;
184 * @brief Package name
186 DPL::Event::Property<DPL::String,
187 DPL::Event::PropertyReadOnly,
188 DPL::Event::PropertyStorageDynamicCached> TizenId;
191 * @brief Minimum of the WAC Engine Standard required to run widget.
193 DPL::Event::Property<WidgetStandard,
194 DPL::Event::PropertyReadOnly,
195 DPL::Event::PropertyStorageDynamicCached> Standard;
198 * @brief How much space application and its storage takes.
200 DPL::Event::Property<WidgetStorageSize,
201 DPL::Event::PropertyReadOnly,
202 DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
204 // * @brief Value of network element.
206 // DPL::Event::Property<bool,
207 // DPL::Event::PropertyReadOnly> AccessNetwork;
210 // * @brief Does widget contain WARP definitions.
212 // DPL::Event::Property<bool> WarpDefinitionEmpty;
215 * @brief Is back supported
217 DPL::Event::Property<bool,
218 DPL::Event::PropertyReadOnly,
219 DPL::Event::PropertyStorageDynamicCached> BackSupported;
222 * @brief Widget access list
224 DPL::Event::Property<WidgetAccessList> AccessList;
227 * @brief Is this DeveloperWidget
229 DPL::Event::Property<bool,
230 DPL::Event::PropertyReadOnly,
231 DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
233 DPL::Event::Property<bool,
234 DPL::Event::PropertyReadOnly,
235 DPL::Event::PropertyStorageDynamicCached> IsDeletable;
237 DPL::Event::Property<WidgetSettingList> SettingList;
240 * @brief Widget Application Service list
242 DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
244 WidgetModel(const std::string &tizenId);
247 // Custom read write delegates
248 static DPL::String readTizenId(DPL::Event::Model *model);
249 static WidgetStandard readStandard(DPL::Event::Model *model);
250 static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
251 static WidgetStorageSize getApplicationStorage(DPL::Event::Model *model);
252 static DPL::String getTimestamp();
254 WidgetHandle getHandle() const;
257 #endif // SRC_DOMAIN_WIDGET_MODEL_H