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