|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __VWSDEF_H__ |
|
17 #define __VWSDEF_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
22 /** |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 #define KUidCustomCrossCheckValue 0x80282748 |
|
27 |
|
28 /** |
|
29 @publishedPartner |
|
30 @released |
|
31 */ |
|
32 const TUid KUidCustomCrossCheck={KUidCustomCrossCheckValue}; |
|
33 |
|
34 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
35 |
|
36 class TVwsViewId |
|
37 /** Identifies an application view using two unique identifiers (UIDs): a view |
|
38 UID and an application UID. |
|
39 |
|
40 The application UID is required so that the application associated with the view |
|
41 can be started if it is not already running. |
|
42 |
|
43 @publishedAll |
|
44 @released */ |
|
45 { |
|
46 public: |
|
47 inline TVwsViewId(); |
|
48 inline TVwsViewId(const TVwsViewId& aUid); |
|
49 inline TVwsViewId(TUid aAppUid,TUid aViewUid); |
|
50 inline TBool operator==(const TVwsViewId& aUid) const; |
|
51 inline TBool operator!=(const TVwsViewId& aUid) const; |
|
52 public: |
|
53 /** A unique application ID (or application UID). |
|
54 |
|
55 Uniquely identifies the application associated with the view. */ |
|
56 TUid iAppUid; |
|
57 /** A unique view ID (or view UID). |
|
58 |
|
59 Uniquely identifies the view. */ |
|
60 TUid iViewUid; |
|
61 }; |
|
62 |
|
63 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
64 /** |
|
65 @internalTechnology |
|
66 @released |
|
67 */ |
|
68 #define KNullViewId TVwsViewId(KNullUid,KNullUid) |
|
69 |
|
70 /** |
|
71 @internalTechnology |
|
72 @released |
|
73 */ |
|
74 const TInt KErrViewWrongMode=1; // !!! Wrong error code - should be -ve & unique |
|
75 |
|
76 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
77 |
|
78 class TVwsViewIdAndMessage |
|
79 /** |
|
80 The TVwsViewIdAndMessage class identifies a view and encapsulates a message to |
|
81 be read by the view when it is activated. |
|
82 |
|
83 @publishedAll |
|
84 @released |
|
85 */ |
|
86 { |
|
87 public: |
|
88 inline TVwsViewIdAndMessage(); |
|
89 inline TVwsViewIdAndMessage(const TVwsViewId& aId); |
|
90 inline TVwsViewIdAndMessage(const TVwsViewId& aId,TUid aCustomMessageId,const TDesC8& aCustomMessage); |
|
91 inline TVwsViewIdAndMessage& operator=(const TVwsViewIdAndMessage& aVwsViewIdAndMessage); |
|
92 public: |
|
93 TVwsViewId iViewId; |
|
94 TUid iCustomMessageId; |
|
95 TInt iCustomMessageLength; |
|
96 TPtrC8 iCustomMessage; |
|
97 }; |
|
98 |
|
99 |
|
100 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
101 class TVwsViewEvent |
|
102 /** |
|
103 The TVwsViewEvent class encapsulates the attributes of a view server event. |
|
104 These are: |
|
105 - The event type |
|
106 - The view ids of the two views associated with the event |
|
107 - The attributes of any message which can go with the event. |
|
108 |
|
109 @publishedPartner |
|
110 @released |
|
111 */ |
|
112 { |
|
113 public: |
|
114 enum TVwsViewEventType |
|
115 { |
|
116 EVwsActivateView, |
|
117 EVwsDeactivateView, |
|
118 EVwsScreenDeviceChanged, |
|
119 EVwsDeactivationNotification, |
|
120 EVwsActivationNotification, |
|
121 EVwsDeactivateViewDifferentInstance |
|
122 }; |
|
123 public: |
|
124 inline TVwsViewEvent(); |
|
125 inline TVwsViewEvent(TVwsViewEventType aEventType); |
|
126 inline TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId); |
|
127 inline TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId); |
|
128 inline TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId,TUid aCustomMessageId,TInt aCustomMessageLength); |
|
129 public: |
|
130 /** |
|
131 The event type. |
|
132 */ |
|
133 TVwsViewEventType iEventType; |
|
134 /** |
|
135 The first view id associated with the event. This has a different meaning for each of the event types: |
|
136 - For ActivateView events, it is the view to activate |
|
137 - For DeactivateView events, it is the view to deactivate |
|
138 - For ScreenDeviceChange events, it is the id of the currently active view |
|
139 - For ActivationNotification events, it is the id of the activated view |
|
140 - For DeactivationNotification events, it is the id of the deactivated view |
|
141 */ |
|
142 TVwsViewId iViewOneId; |
|
143 /** |
|
144 The second view id associated with the event. This has a different meaning for each of the event types: |
|
145 - For ActivateView events, it is the view that will be deactivated |
|
146 - For DeactivateView events, it is the view that has been activated |
|
147 - For ScreenDeviceChange events, it is unused |
|
148 - For ActivationNotification events, it is the view that will be deactivated |
|
149 - For DeactivationNotification events, it is the id of the view that has been activated |
|
150 */ |
|
151 TVwsViewId iViewTwoId; |
|
152 /** |
|
153 The type of message being passed in the custom message buffer |
|
154 */ |
|
155 TUid iCustomMessageId; |
|
156 /** |
|
157 The length of the custom message being held by the server. |
|
158 To retrieve the message itself from the server, a buffer of this length must be allocated |
|
159 */ |
|
160 TInt iCustomMessageLength; |
|
161 }; |
|
162 |
|
163 // |
|
164 // Typedefs. |
|
165 // |
|
166 /** |
|
167 @internalComponent |
|
168 @released |
|
169 */ |
|
170 typedef TPckgBuf<TVwsViewIdAndMessage> TVwsViewIdAndMessageBuf; |
|
171 |
|
172 /** |
|
173 @internalComponent |
|
174 @released |
|
175 */ |
|
176 typedef TPckgBuf<TVwsViewEvent> TVwsViewEventBuf; |
|
177 |
|
178 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
179 |
|
180 // |
|
181 // Inlines |
|
182 // |
|
183 |
|
184 inline TVwsViewId::TVwsViewId() |
|
185 /** Constructs a TVwsViewId object, and initialises both the application UID and |
|
186 the view UID to NULL. */ |
|
187 : iAppUid(KNullUid), iViewUid(KNullUid) {} |
|
188 |
|
189 inline TVwsViewId::TVwsViewId(const TVwsViewId& aUid) |
|
190 /** Constructs a new TVwsViewId object from an existing one. This simply performs |
|
191 a member-wise copy, each member variable of the passed in object is individually |
|
192 copied to the corresponding member variable of the new object. |
|
193 |
|
194 @param aUid A reference to the TVwsViewId object to be copied. */ |
|
195 : iAppUid(aUid.iAppUid), iViewUid(aUid.iViewUid) {} |
|
196 |
|
197 inline TVwsViewId::TVwsViewId(TUid aAppUid,TUid aViewUid) |
|
198 /** Constructs a TVwsViewId object with the specified application UID and view UID. |
|
199 |
|
200 @param aAppUid The application UID. |
|
201 @param aViewUid The view UID. */ |
|
202 : iAppUid(aAppUid), iViewUid(aViewUid) {} |
|
203 |
|
204 inline TBool TVwsViewId::operator==(const TVwsViewId& aUid) const |
|
205 /** Checks whether the TVwsViewId object being operated upon and the TVwsViewId |
|
206 object specified are the same. |
|
207 |
|
208 Returns true if both application UIDs and both view UIDs are the same, otherwise |
|
209 returns false. |
|
210 |
|
211 @param aUid A reference to a TVwsViewId object. |
|
212 @return ETrue if objects are the same, EFalse otherwise. */ |
|
213 { |
|
214 return (aUid.iAppUid==iAppUid && aUid.iViewUid==iViewUid); |
|
215 } |
|
216 |
|
217 inline TBool TVwsViewId::operator!=(const TVwsViewId& aUid) const |
|
218 /** Checks whether the TVwsViewId object being operated upon and the TVwsViewId |
|
219 object specified are different. |
|
220 |
|
221 Returns true if either the application UIDs or view UIDs are different, otherwise |
|
222 returns false. |
|
223 |
|
224 @param aUid A reference to a TVwsViewId object. |
|
225 @return ETrue if objects are different, EFalse otherwise. */ |
|
226 { |
|
227 return (aUid.iAppUid!=iAppUid || aUid.iViewUid!=iViewUid); |
|
228 } |
|
229 |
|
230 |
|
231 /** Constructs a TVwsViewIdAndMessage object, and initialises it to contain a |
|
232 NULL view UID and an empty message */ |
|
233 inline TVwsViewIdAndMessage::TVwsViewIdAndMessage() |
|
234 : iViewId(TVwsViewId()), iCustomMessageLength(0) |
|
235 { |
|
236 iCustomMessageId.iUid=0; |
|
237 iCustomMessage.Set(KNullDesC8); |
|
238 } |
|
239 |
|
240 /** Constructs a TVwsViewIdAndMessage object, and initialises it to contain the |
|
241 specified view UID and an empty message |
|
242 |
|
243 @param aId A reference to the TVwsViewId to be used |
|
244 */ |
|
245 inline TVwsViewIdAndMessage::TVwsViewIdAndMessage(const TVwsViewId& aId) |
|
246 : iViewId(aId), iCustomMessageLength(0) |
|
247 { |
|
248 iCustomMessageId.iUid=0; |
|
249 iCustomMessage.Set(KNullDesC8); |
|
250 } |
|
251 |
|
252 /** Constructs a TVwsViewIdAndMessage object, and initialises it to contain the |
|
253 specified view UID and the specified message |
|
254 |
|
255 @param aId A reference to the TVwsViewId to be used |
|
256 @param aCustomMessageId The message Id to use |
|
257 @param aCustomMessage A narrow descriptor containing the message |
|
258 */ |
|
259 inline TVwsViewIdAndMessage::TVwsViewIdAndMessage(const TVwsViewId& aId,TUid aCustomMessageId,const TDesC8& aCustomMessage) |
|
260 : iViewId(aId), iCustomMessageId(aCustomMessageId) |
|
261 { |
|
262 iCustomMessageLength=aCustomMessage.Length(); |
|
263 iCustomMessage.Set(aCustomMessage); |
|
264 } |
|
265 |
|
266 /** Copies the contents of another TVwsViewIdAndMessage into this one |
|
267 |
|
268 @param aVwsViewIdAndMessage A reference to the TVwsViewIdAndMessage to be copied |
|
269 |
|
270 @return A reference to the object being copied into |
|
271 */ |
|
272 inline TVwsViewIdAndMessage& TVwsViewIdAndMessage::operator=(const TVwsViewIdAndMessage& aVwsViewIdAndMessage) |
|
273 { |
|
274 iViewId=aVwsViewIdAndMessage.iViewId; |
|
275 iCustomMessageId=aVwsViewIdAndMessage.iCustomMessageId; |
|
276 iCustomMessageLength=aVwsViewIdAndMessage.iCustomMessage.Length(); |
|
277 iCustomMessage.Set(aVwsViewIdAndMessage.iCustomMessage); |
|
278 return(*this); |
|
279 } |
|
280 |
|
281 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
282 |
|
283 inline TVwsViewEvent::TVwsViewEvent() {} |
|
284 |
|
285 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType) |
|
286 : iEventType(aEventType),iViewOneId(),iViewTwoId(),iCustomMessageId(KNullUid),iCustomMessageLength(0) {} |
|
287 |
|
288 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId) |
|
289 : iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(),iCustomMessageId(KNullUid),iCustomMessageLength(0) {} |
|
290 |
|
291 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId) |
|
292 : iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(aViewTwoId),iCustomMessageId(KNullUid),iCustomMessageLength(0) {} |
|
293 |
|
294 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId,TUid aCustomMessageId,TInt aCustomMessageLength) |
|
295 : iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(aViewTwoId),iCustomMessageId(aCustomMessageId),iCustomMessageLength(aCustomMessageLength) {} |
|
296 |
|
297 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
298 |
|
299 #endif |