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