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
57 * Note: This is a readonly property
59 DPL::Event::Property<WrtDB::WidgetType,
60 DPL::Event::PropertyReadOnly,
61 DPL::Event::PropertyStorageDynamicCached> Type;
64 * @brief Current widget actual size
66 DPL::Event::Property<WidgetSize> ActualSize;
69 * @brief Current widget preferred size
71 DPL::Event::Property<WidgetSize,
72 DPL::Event::PropertyReadOnly,
73 DPL::Event::PropertyStorageDynamicCached> PreferredSize;
76 * @brief Start URL for widget
78 DPL::Event::Property<DPL::OptionalString> StartURL;
81 * @brief Start URL information for widget
83 DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
86 * @brief Prefix URL for widget
88 * This is a prefix address of html file that widget is displaying.
89 * The whole address is PrefixURL + StartURL.
91 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
94 * @brief Install path for widget
96 * Gets path in which files of widget are being kept
98 DPL::Event::Property<DPL::String,
99 DPL::Event::PropertyReadOnly,
100 DPL::Event::PropertyStorageDynamicCached> InstallPath;
103 * @brief Path to widget's persistent storage.
105 * Gets path in which widget may store its persistent private data.
107 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
110 * @brief Path to widget's temporary storage.
112 * Gets path in which widget may store its temporary private data.
114 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
119 DPL::Event::Property<WrtDB::WidgetGUID,
120 DPL::Event::PropertyReadOnly,
121 DPL::Event::PropertyStorageDynamicCached> GUID;
124 * @brief Widget defaultlocale
126 DPL::Event::Property<DPL::OptionalString,
127 DPL::Event::PropertyReadOnly,
128 DPL::Event::PropertyStorageDynamicCached> defaultlocale;
131 * @brief Widget version
133 DPL::Event::Property<OptionalWidgetVersion,
134 DPL::Event::PropertyReadOnly,
135 DPL::Event::PropertyStorageDynamicCached> Version;
140 DPL::Event::Property<DPL::OptionalString> Name;
143 * @brief Widget short name
145 DPL::Event::Property<DPL::OptionalString> ShortName;
148 * @brief Widget description
150 DPL::Event::Property<DPL::OptionalString> Description;
153 * @brief Widget license
155 DPL::Event::Property<DPL::OptionalString> License;
158 * @brief Widget license href
160 DPL::Event::Property<DPL::OptionalString> LicenseHref;
165 DPL::Event::Property<OptionalWidgetIcon> Icon;
168 * @brief Widget splash image src
170 DPL::Event::Property<DPL::OptionalString,
171 DPL::Event::PropertyReadOnly,
172 DPL::Event::PropertyStorageDynamicCached> SplashImg;
177 DPL::Event::Property<WrtDB::WindowModeList,
178 DPL::Event::PropertyReadOnly,
179 DPL::Event::PropertyStorageDynamic> WindowModes;
182 * @brief Minimum of the WAC Engine Standard required to run widget.
184 DPL::Event::Property<WidgetStandard,
185 DPL::Event::PropertyReadOnly,
186 DPL::Event::PropertyStorageDynamicCached> Standard;
189 * @brief How much space application and its storage takes.
191 DPL::Event::Property<WidgetStorageSize,
192 DPL::Event::PropertyReadOnly,
193 DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
195 // * @brief Value of network element.
197 // DPL::Event::Property<bool,
198 // DPL::Event::PropertyReadOnly> AccessNetwork;
201 // * @brief Does widget contain WARP definitions.
203 // DPL::Event::Property<bool> WarpDefinitionEmpty;
206 * @brief Is back supported
208 DPL::Event::Property<bool,
209 DPL::Event::PropertyReadOnly,
210 DPL::Event::PropertyStorageDynamicCached> BackSupported;
213 * @brief Widget access list
215 DPL::Event::Property<WidgetAccessList> AccessList;
218 * @brief Is this DeveloperWidget
220 DPL::Event::Property<bool,
221 DPL::Event::PropertyReadOnly,
222 DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
225 DPL::Event::Property<WidgetSettingList> SettingList;
228 * @brief Widget Application Service list
230 DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
232 WidgetModel(const std::string &tizenId);
235 // Custom read write delegates
236 static WidgetStandard readStandard(DPL::Event::Model *model);
237 static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
238 static WidgetStorageSize getApplicationStorage(DPL::Event::Model *model);
239 static DPL::String getTimestamp();
241 DPL::String getTizenId() const;
244 #endif // SRC_DOMAIN_WIDGET_MODEL_H