epoc32/include/vwsdef.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/vwsdef.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/vwsdef.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,277 @@
     1.4 -vwsdef.h
     1.5 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __VWSDEF_H__
    1.21 +#define __VWSDEF_H__
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +
    1.25 +/**
    1.26 +@publishedPartner
    1.27 +*/
    1.28 +#define KUidCustomCrossCheckValue 0x80282748
    1.29 +
    1.30 +/**
    1.31 +@publishedPartner
    1.32 +*/
    1.33 +const TUid KUidCustomCrossCheck={KUidCustomCrossCheckValue};
    1.34 +
    1.35 +class TVwsViewId
    1.36 +/** Identifies an application view using two unique identifiers (UIDs): a view 
    1.37 +UID and an application UID. 
    1.38 +
    1.39 +The application UID is required so that the application associated with the view 
    1.40 +can be started if it is not already running.
    1.41 +
    1.42 +@publishedAll 
    1.43 +@released */
    1.44 +	{
    1.45 +public:
    1.46 +	inline TVwsViewId();
    1.47 +	inline TVwsViewId(const TVwsViewId& aUid);
    1.48 +	inline TVwsViewId(TUid aAppUid,TUid aViewUid);
    1.49 +	inline TBool operator==(const TVwsViewId& aUid) const;
    1.50 +	inline TBool operator!=(const TVwsViewId& aUid) const;
    1.51 +public:
    1.52 +	/** A unique application ID (or application UID).
    1.53 +	
    1.54 +	Uniquely identifies the application associated with the view. */
    1.55 +	TUid iAppUid;
    1.56 +	/** A unique view ID (or view UID).
    1.57 +	
    1.58 +	Uniquely identifies the view. */
    1.59 +	TUid iViewUid;
    1.60 +	};
    1.61 +
    1.62 +/** @internalTechnology */
    1.63 +#define KNullViewId TVwsViewId(KNullUid,KNullUid)
    1.64 +
    1.65 +/** @internalTechnology */
    1.66 +const TInt KErrViewWrongMode=1; // !!! Wrong error code - should be -ve & unique
    1.67 +
    1.68 +
    1.69 +class TVwsViewIdAndMessage
    1.70 +/**
    1.71 +The TVwsViewIdAndMessage class identifies a view and encapsulates a message to
    1.72 +be read by the view when it is activated.
    1.73 +
    1.74 +@publishedAll 
    1.75 +@released 
    1.76 +*/
    1.77 +	{
    1.78 +public:
    1.79 +	inline TVwsViewIdAndMessage();
    1.80 +	inline TVwsViewIdAndMessage(const TVwsViewId& aId);
    1.81 +	inline TVwsViewIdAndMessage(const TVwsViewId& aId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
    1.82 +	inline TVwsViewIdAndMessage& operator=(const TVwsViewIdAndMessage& aVwsViewIdAndMessage);
    1.83 +public:
    1.84 +	TVwsViewId iViewId;
    1.85 +	TUid iCustomMessageId;
    1.86 +	TInt iCustomMessageLength;
    1.87 +	TPtrC8 iCustomMessage;
    1.88 +	};
    1.89 +
    1.90 +
    1.91 +
    1.92 +class TVwsViewEvent
    1.93 +/**
    1.94 +The TVwsViewEvent class encapsulates the attributes of a view server event.
    1.95 +These are:
    1.96 +- The event type
    1.97 +- The view ids of the two views associated with the event
    1.98 +- The attributes of any message which can go with the event.
    1.99 +
   1.100 +@publishedPartner
   1.101 +@released 
   1.102 +*/
   1.103 +	{
   1.104 +public:
   1.105 +	enum TVwsViewEventType
   1.106 +		{
   1.107 +		EVwsActivateView,
   1.108 +		EVwsDeactivateView,
   1.109 +		EVwsScreenDeviceChanged,
   1.110 +		EVwsDeactivationNotification,
   1.111 +		EVwsActivationNotification,
   1.112 +		EVwsDeactivateViewDifferentInstance
   1.113 +		};
   1.114 +public:
   1.115 +	inline TVwsViewEvent();
   1.116 +	inline TVwsViewEvent(TVwsViewEventType aEventType);
   1.117 +	inline TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId);
   1.118 +	inline TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId);
   1.119 +	inline TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId,TUid aCustomMessageId,TInt aCustomMessageLength);
   1.120 +public:
   1.121 +	/**
   1.122 +	The event type.
   1.123 +	*/
   1.124 +	TVwsViewEventType iEventType;
   1.125 +	/**
   1.126 +	The first view id associated with the event. This has a different meaning for each of the event types:
   1.127 +	- For ActivateView events, it is the view to activate
   1.128 +	- For DeactivateView events, it is the view to deactivate
   1.129 +	- For ScreenDeviceChange events, it is the id of the currently active view
   1.130 +	- For ActivationNotification events, it is the id of the activated view
   1.131 +	- For DeactivationNotification events, it is the id of the deactivated view
   1.132 +	*/
   1.133 +	TVwsViewId iViewOneId;
   1.134 +	/**
   1.135 +	The second view id associated with the event. This has a different meaning for each of the event types:
   1.136 +	- For ActivateView events, it is the view that will be deactivated
   1.137 +	- For DeactivateView events, it is the view that has been activated
   1.138 +	- For ScreenDeviceChange events, it is unused
   1.139 +	- For ActivationNotification events, it is the view that will be deactivated
   1.140 +	- For DeactivationNotification events, it is the id of the view that has been activated
   1.141 +	*/
   1.142 +	TVwsViewId iViewTwoId;
   1.143 +	/**
   1.144 +	The type of message being passed in the custom message buffer
   1.145 +	*/
   1.146 +	TUid iCustomMessageId;
   1.147 +	/**
   1.148 +	The length of the custom message being held by the server.
   1.149 +	To retrieve the message itself from the server, a buffer of this length must be allocated
   1.150 +	*/
   1.151 +	TInt iCustomMessageLength;
   1.152 +	};
   1.153 +
   1.154 +
   1.155 +//
   1.156 +// Typedefs.
   1.157 +//
   1.158 +/** @internalComponent */
   1.159 +typedef TPckgBuf<TVwsViewIdAndMessage> TVwsViewIdAndMessageBuf;
   1.160 +
   1.161 +/** @internalComponent */
   1.162 +typedef TPckgBuf<TVwsViewEvent> TVwsViewEventBuf;
   1.163 +
   1.164 +
   1.165 +//
   1.166 +// Inlines
   1.167 +//
   1.168 +
   1.169 +inline TVwsViewId::TVwsViewId()
   1.170 +/** Constructs a TVwsViewId object, and initialises both the application UID and 
   1.171 +the view UID to NULL. */
   1.172 +	: iAppUid(KNullUid), iViewUid(KNullUid) {}
   1.173 +
   1.174 +inline TVwsViewId::TVwsViewId(const TVwsViewId& aUid)
   1.175 +/** Constructs a new TVwsViewId object from an existing one. This simply performs 
   1.176 +a member-wise copy, each member variable of the passed in object is individually 
   1.177 +copied to the corresponding member variable of the new object.
   1.178 +
   1.179 +@param aUid A reference to the TVwsViewId object to be copied. */
   1.180 +	: iAppUid(aUid.iAppUid), iViewUid(aUid.iViewUid) {}
   1.181 +
   1.182 +inline TVwsViewId::TVwsViewId(TUid aAppUid,TUid aViewUid)
   1.183 +/** Constructs a TVwsViewId object with the specified application UID and view UID.
   1.184 +
   1.185 +@param aAppUid The application UID.
   1.186 +@param aViewUid The view UID. */
   1.187 +	: iAppUid(aAppUid), iViewUid(aViewUid) {}
   1.188 +
   1.189 +inline TBool TVwsViewId::operator==(const TVwsViewId& aUid) const
   1.190 +/** Checks whether the TVwsViewId object being operated upon and the TVwsViewId 
   1.191 +object specified are the same.
   1.192 +
   1.193 +Returns true if both application UIDs and both view UIDs are the same, otherwise 
   1.194 +returns false.
   1.195 +
   1.196 +@param aUid A reference to a TVwsViewId object.
   1.197 +@return ETrue if objects are the same, EFalse otherwise. */
   1.198 +	{
   1.199 +	return (aUid.iAppUid==iAppUid && aUid.iViewUid==iViewUid);
   1.200 +	}
   1.201 +
   1.202 +inline TBool TVwsViewId::operator!=(const TVwsViewId& aUid) const
   1.203 +/** Checks whether the TVwsViewId object being operated upon and the TVwsViewId 
   1.204 +object specified are different.
   1.205 +
   1.206 +Returns true if either the application UIDs or view UIDs are different, otherwise 
   1.207 +returns false.
   1.208 +
   1.209 +@param aUid A reference to a TVwsViewId object.
   1.210 +@return ETrue if objects are different, EFalse otherwise. */
   1.211 +	{
   1.212 +	return (aUid.iAppUid!=iAppUid || aUid.iViewUid!=iViewUid);
   1.213 +	}
   1.214 +
   1.215 +
   1.216 +/** Constructs a TVwsViewIdAndMessage object, and initialises it to contain a
   1.217 +NULL view UID and an empty message */
   1.218 +inline TVwsViewIdAndMessage::TVwsViewIdAndMessage()
   1.219 +	: iViewId(TVwsViewId()), iCustomMessageLength(0)
   1.220 +	{
   1.221 +	iCustomMessageId.iUid=0;
   1.222 +	iCustomMessage.Set(KNullDesC8);
   1.223 +	}
   1.224 +
   1.225 +/** Constructs a TVwsViewIdAndMessage object, and initialises it to contain the
   1.226 +specified view UID and an empty message
   1.227 +
   1.228 +@param aId A reference to the TVwsViewId to be used
   1.229 +*/
   1.230 +inline TVwsViewIdAndMessage::TVwsViewIdAndMessage(const TVwsViewId& aId)
   1.231 +	: iViewId(aId), iCustomMessageLength(0)
   1.232 +	{
   1.233 +	iCustomMessageId.iUid=0;
   1.234 +	iCustomMessage.Set(KNullDesC8);
   1.235 +	}
   1.236 +
   1.237 +/** Constructs a TVwsViewIdAndMessage object, and initialises it to contain the
   1.238 +specified view UID and the specified message
   1.239 +
   1.240 +@param aId A reference to the TVwsViewId to be used
   1.241 +@param aCustomMessageId The message Id to use
   1.242 +@param aCustomMessage A narrow descriptor containing the message
   1.243 +*/
   1.244 +inline TVwsViewIdAndMessage::TVwsViewIdAndMessage(const TVwsViewId& aId,TUid aCustomMessageId,const TDesC8& aCustomMessage)
   1.245 +	: iViewId(aId), iCustomMessageId(aCustomMessageId)
   1.246 +	{
   1.247 +	iCustomMessageLength=aCustomMessage.Length();
   1.248 +	iCustomMessage.Set(aCustomMessage);
   1.249 +	}
   1.250 +
   1.251 +/** Copies the contents of another TVwsViewIdAndMessage into this one
   1.252 +
   1.253 +@param aVwsViewIdAndMessage A reference to the TVwsViewIdAndMessage to be copied
   1.254 +
   1.255 +@return A reference to the object being copied into
   1.256 +*/
   1.257 +inline TVwsViewIdAndMessage& TVwsViewIdAndMessage::operator=(const TVwsViewIdAndMessage& aVwsViewIdAndMessage)
   1.258 +	{
   1.259 +	iViewId=aVwsViewIdAndMessage.iViewId;
   1.260 +	iCustomMessageId=aVwsViewIdAndMessage.iCustomMessageId;
   1.261 +	iCustomMessageLength=aVwsViewIdAndMessage.iCustomMessage.Length();
   1.262 +	iCustomMessage.Set(aVwsViewIdAndMessage.iCustomMessage);
   1.263 +	return(*this);
   1.264 +	}
   1.265 +
   1.266 +inline TVwsViewEvent::TVwsViewEvent() {}
   1.267 +
   1.268 +inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType)
   1.269 +	: iEventType(aEventType),iViewOneId(),iViewTwoId(),iCustomMessageId(KNullUid),iCustomMessageLength(0) {}
   1.270 +
   1.271 +inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId)
   1.272 +	: iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(),iCustomMessageId(KNullUid),iCustomMessageLength(0) {}
   1.273 +
   1.274 +inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId)
   1.275 +	: iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(aViewTwoId),iCustomMessageId(KNullUid),iCustomMessageLength(0) {}
   1.276 +
   1.277 +inline TVwsViewEvent::TVwsViewEvent(TVwsViewEventType aEventType,const TVwsViewId& aViewOneId,const TVwsViewId& aViewTwoId,TUid aCustomMessageId,TInt aCustomMessageLength)
   1.278 +	: iEventType(aEventType),iViewOneId(aViewOneId),iViewTwoId(aViewTwoId),iCustomMessageId(aCustomMessageId),iCustomMessageLength(aCustomMessageLength) {}
   1.279 +
   1.280 +
   1.281 +#endif