Tizen 2.1 base
[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     DPL::String TizenId;
53
54     /**
55      * @brief Widget type
56      *
57      * Note: This is a readonly property
58      */
59     DPL::Event::Property<WrtDB::WidgetType,
60     DPL::Event::PropertyReadOnly,
61     DPL::Event::PropertyStorageDynamicCached> Type;
62
63     /**
64      * @brief Current widget actual size
65      */
66     DPL::Event::Property<WidgetSize> ActualSize;
67
68     /**
69      * @brief Current widget preferred size
70      */
71     DPL::Event::Property<WidgetSize,
72                   DPL::Event::PropertyReadOnly,
73                   DPL::Event::PropertyStorageDynamicCached> PreferredSize;
74
75     /**
76      * @brief Start URL for widget
77      */
78     DPL::Event::Property<DPL::OptionalString> StartURL;
79
80     /**
81      * @brief Start URL information for widget
82      */
83     DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
84
85     /**
86      * @brief Prefix URL for widget
87      *
88      * This is a prefix address of html file that widget is displaying.
89      * The whole address is PrefixURL + StartURL.
90      */
91     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
92
93     /**
94      * @brief Install path for widget
95      *
96      * Gets path in which files of widget are being kept
97      */
98     DPL::Event::Property<DPL::String,
99                   DPL::Event::PropertyReadOnly,
100                   DPL::Event::PropertyStorageDynamicCached> InstallPath;
101
102     /**
103      * @brief Path to widget's persistent storage.
104      *
105      * Gets path in which widget may store its persistent private data.
106      */
107     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
108
109     /**
110      * @brief Path to widget's temporary storage.
111      *
112      * Gets path in which widget may store its temporary private data.
113      */
114     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
115
116     /**
117      * @brief Widget defaultlocale
118      */
119     DPL::Event::Property<DPL::OptionalString,
120                   DPL::Event::PropertyReadOnly,
121                   DPL::Event::PropertyStorageDynamicCached> defaultlocale;
122
123     /**
124      * @brief Widget name
125      */
126     DPL::Event::Property<DPL::OptionalString> Name;
127
128     /**
129      * @brief Widget short name
130      */
131     DPL::Event::Property<DPL::OptionalString> ShortName;
132
133     /**
134      * @brief Widget description
135      */
136     DPL::Event::Property<DPL::OptionalString> Description;
137
138     /**
139      * @brief Widget license
140      */
141     DPL::Event::Property<DPL::OptionalString> License;
142
143     /**
144      * @brief Widget license href
145      */
146     DPL::Event::Property<DPL::OptionalString> LicenseHref;
147
148     /**
149      * @brief Widget icon
150      */
151     DPL::Event::Property<OptionalWidgetIcon> Icon;
152
153     /**
154      * @brief Widget splash image src
155      */
156     DPL::Event::Property<DPL::OptionalString,
157                   DPL::Event::PropertyReadOnly,
158                   DPL::Event::PropertyStorageDynamicCached> SplashImg;
159
160     /**
161      * @brief window mode
162      */
163     DPL::Event::Property<WrtDB::WindowModeList,
164                   DPL::Event::PropertyReadOnly,
165                   DPL::Event::PropertyStorageDynamic> WindowModes;
166
167     //    /**
168     //     * @brief Value of network element.
169     //     */
170     //    DPL::Event::Property<bool,
171     //                  DPL::Event::PropertyReadOnly> AccessNetwork;
172
173     //    /**
174     //     * @brief Does widget contain WARP definitions.
175     //     */
176     //    DPL::Event::Property<bool> WarpDefinitionEmpty;
177
178     /**
179      * @brief Is back supported
180      */
181     DPL::Event::Property<bool,
182                   DPL::Event::PropertyReadOnly,
183                   DPL::Event::PropertyStorageDynamicCached> BackSupported;
184
185     /**
186      * @brief Widget access list
187      */
188     DPL::Event::Property<WidgetAccessList> AccessList;
189
190     /**
191      * @brief Is this DeveloperWidget
192      */
193     DPL::Event::Property<bool,
194                   DPL::Event::PropertyReadOnly,
195                   DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
196
197
198     DPL::Event::Property<WidgetSettingList> SettingList;
199
200     /**
201      * @brief Widget Application Service list
202      */
203     DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
204
205     WidgetModel(const std::string &tizenId);
206
207   private:
208     // Custom read write delegates
209     static DPL::String           getTimestamp();
210
211     DPL::String getTizenId() const;
212 };
213
214 #endif // SRC_DOMAIN_WIDGET_MODEL_H