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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
26 #define KUidCustomCrossCheckValue 0x80282748
32 const TUid KUidCustomCrossCheck={KUidCustomCrossCheckValue};
34 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
37 /** Identifies an application view using two unique identifiers (UIDs): a view
38 UID and an application UID.
40 The application UID is required so that the application associated with the view
41 can be started if it is not already running.
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;
53 /** A unique application ID (or application UID).
55 Uniquely identifies the application associated with the view. */
57 /** A unique view ID (or view UID).
59 Uniquely identifies the view. */
63 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
68 #define KNullViewId TVwsViewId(KNullUid,KNullUid)
74 const TInt KErrViewWrongMode=1; // !!! Wrong error code - should be -ve & unique
76 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
78 class TVwsViewIdAndMessage
80 The TVwsViewIdAndMessage class identifies a view and encapsulates a message to
81 be read by the view when it is activated.
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);
94 TUid iCustomMessageId;
95 TInt iCustomMessageLength;
96 TPtrC8 iCustomMessage;
100 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
103 The TVwsViewEvent class encapsulates the attributes of a view server event.
106 - The view ids of the two views associated with the event
107 - The attributes of any message which can go with the event.
114 enum TVwsViewEventType
118 EVwsScreenDeviceChanged,
119 EVwsDeactivationNotification,
120 EVwsActivationNotification,
121 EVwsDeactivateViewDifferentInstance
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);
133 TVwsViewEventType iEventType;
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
142 TVwsViewId iViewOneId;
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
151 TVwsViewId iViewTwoId;
153 The type of message being passed in the custom message buffer
155 TUid iCustomMessageId;
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
160 TInt iCustomMessageLength;
170 typedef TPckgBuf<TVwsViewIdAndMessage> TVwsViewIdAndMessageBuf;
176 typedef TPckgBuf<TVwsViewEvent> TVwsViewEventBuf;
178 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
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) {}
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.
194 @param aUid A reference to the TVwsViewId object to be copied. */
195 : iAppUid(aUid.iAppUid), iViewUid(aUid.iViewUid) {}
197 inline TVwsViewId::TVwsViewId(TUid aAppUid,TUid aViewUid)
198 /** Constructs a TVwsViewId object with the specified application UID and view UID.
200 @param aAppUid The application UID.
201 @param aViewUid The view UID. */
202 : iAppUid(aAppUid), iViewUid(aViewUid) {}
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.
208 Returns true if both application UIDs and both view UIDs are the same, otherwise
211 @param aUid A reference to a TVwsViewId object.
212 @return ETrue if objects are the same, EFalse otherwise. */
214 return (aUid.iAppUid==iAppUid && aUid.iViewUid==iViewUid);
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.
221 Returns true if either the application UIDs or view UIDs are different, otherwise
224 @param aUid A reference to a TVwsViewId object.
225 @return ETrue if objects are different, EFalse otherwise. */
227 return (aUid.iAppUid!=iAppUid || aUid.iViewUid!=iViewUid);
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)
236 iCustomMessageId.iUid=0;
237 iCustomMessage.Set(KNullDesC8);
240 /** Constructs a TVwsViewIdAndMessage object, and initialises it to contain the
241 specified view UID and an empty message
243 @param aId A reference to the TVwsViewId to be used
245 inline TVwsViewIdAndMessage::TVwsViewIdAndMessage(const TVwsViewId& aId)
246 : iViewId(aId), iCustomMessageLength(0)
248 iCustomMessageId.iUid=0;
249 iCustomMessage.Set(KNullDesC8);
252 /** Constructs a TVwsViewIdAndMessage object, and initialises it to contain the
253 specified view UID and the specified message
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
259 inline TVwsViewIdAndMessage::TVwsViewIdAndMessage(const TVwsViewId& aId,TUid aCustomMessageId,const TDesC8& aCustomMessage)
260 : iViewId(aId), iCustomMessageId(aCustomMessageId)
262 iCustomMessageLength=aCustomMessage.Length();
263 iCustomMessage.Set(aCustomMessage);
266 /** Copies the contents of another TVwsViewIdAndMessage into this one
268 @param aVwsViewIdAndMessage A reference to the TVwsViewIdAndMessage to be copied
270 @return A reference to the object being copied into
272 inline TVwsViewIdAndMessage& TVwsViewIdAndMessage::operator=(const TVwsViewIdAndMessage& aVwsViewIdAndMessage)
274 iViewId=aVwsViewIdAndMessage.iViewId;
275 iCustomMessageId=aVwsViewIdAndMessage.iCustomMessageId;
276 iCustomMessageLength=aVwsViewIdAndMessage.iCustomMessage.Length();
277 iCustomMessage.Set(aVwsViewIdAndMessage.iCustomMessage);
281 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
283 inline TVwsViewEvent::TVwsViewEvent() {}
285 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType)
286 : iEventType(aEventType),iViewOneId(),iViewTwoId(),iCustomMessageId(KNullUid),iCustomMessageLength(0) {}
288 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId)
289 : iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(),iCustomMessageId(KNullUid),iCustomMessageLength(0) {}
291 inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId)
292 : iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(aViewTwoId),iCustomMessageId(KNullUid),iCustomMessageLength(0) {}
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) {}
297 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS