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
55 * @brief Widget handle
57 * Note: This is a readonly property
59 DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
64 * Note: This is a readonly property
66 DPL::Event::Property<WrtDB::WidgetType,
67 DPL::Event::PropertyReadOnly,
68 DPL::Event::PropertyStorageDynamicCached> Type;
71 * @brief Current widget actual size
73 DPL::Event::Property<WidgetSize> ActualSize;
76 * @brief Current widget preferred size
78 DPL::Event::Property<WidgetSize,
79 DPL::Event::PropertyReadOnly,
80 DPL::Event::PropertyStorageDynamicCached> PreferredSize;
83 * @brief Start URL for widget
85 DPL::Event::Property<DPL::OptionalString> StartURL;
88 * @brief Start URL information for widget
90 DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
93 * @brief Prefix URL for widget
95 * This is a prefix address of html file that widget is displaying.
96 * The whole address is PrefixURL + StartURL.
98 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
101 * @brief Install path for widget
103 * Gets path in which files of widget are being kept
105 DPL::Event::Property<DPL::String,
106 DPL::Event::PropertyReadOnly,
107 DPL::Event::PropertyStorageDynamicCached> InstallPath;
110 * @brief Path to widget's persistent storage.
112 * Gets path in which widget may store its persistent private data.
114 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
117 * @brief Path to widget's temporary storage.
119 * Gets path in which widget may store its temporary private data.
121 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
126 DPL::Event::Property<WrtDB::WidgetGUID,
127 DPL::Event::PropertyReadOnly,
128 DPL::Event::PropertyStorageDynamicCached> GUID;
131 * @brief Widget defaultlocale
133 DPL::Event::Property<DPL::OptionalString,
134 DPL::Event::PropertyReadOnly,
135 DPL::Event::PropertyStorageDynamicCached> defaultlocale;
138 * @brief Widget version
140 DPL::Event::Property<OptionalWidgetVersion,
141 DPL::Event::PropertyReadOnly,
142 DPL::Event::PropertyStorageDynamicCached> Version;
147 DPL::Event::Property<DPL::OptionalString> Name;
150 * @brief Widget short name
152 DPL::Event::Property<DPL::OptionalString> ShortName;
155 * @brief Widget description
157 DPL::Event::Property<DPL::OptionalString> Description;
160 * @brief Widget license
162 DPL::Event::Property<DPL::OptionalString> License;
165 * @brief Widget license href
167 DPL::Event::Property<DPL::OptionalString> LicenseHref;
172 DPL::Event::Property<OptionalWidgetIcon> Icon;
175 * @brief Widget splash image src
177 DPL::Event::Property<DPL::OptionalString,
178 DPL::Event::PropertyReadOnly,
179 DPL::Event::PropertyStorageDynamicCached> SplashImg;
184 DPL::Event::Property<WrtDB::WindowModeList,
185 DPL::Event::PropertyReadOnly,
186 DPL::Event::PropertyStorageDynamic> WindowModes;
189 * @brief Minimum of the WAC Engine Standard required to run widget.
191 DPL::Event::Property<WidgetStandard,
192 DPL::Event::PropertyReadOnly,
193 DPL::Event::PropertyStorageDynamicCached> Standard;
196 * @brief How much space application and its storage takes.
198 DPL::Event::Property<WidgetStorageSize,
199 DPL::Event::PropertyReadOnly,
200 DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
202 // * @brief Value of network element.
204 // DPL::Event::Property<bool,
205 // DPL::Event::PropertyReadOnly> AccessNetwork;
208 // * @brief Does widget contain WARP definitions.
210 // DPL::Event::Property<bool> WarpDefinitionEmpty;
213 * @brief Is back supported
215 DPL::Event::Property<bool,
216 DPL::Event::PropertyReadOnly,
217 DPL::Event::PropertyStorageDynamicCached> BackSupported;
220 * @brief Widget access list
222 DPL::Event::Property<WidgetAccessList> AccessList;
225 * @brief Is this DeveloperWidget
227 DPL::Event::Property<bool,
228 DPL::Event::PropertyReadOnly,
229 DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
232 DPL::Event::Property<WidgetSettingList> SettingList;
235 * @brief Widget Application Service list
237 DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
239 WidgetModel(const std::string &tizenId);
242 // Custom read write delegates
243 static WidgetStandard readStandard(DPL::Event::Model *model);
244 static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
245 static WidgetStorageSize getApplicationStorage(DPL::Event::Model *model);
246 static DPL::String getTimestamp();
248 DPL::String getTizenId() const;
251 #endif // SRC_DOMAIN_WIDGET_MODEL_H