epoc32/include/w32click.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2001-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 // Definition of class that needs to be provided by a Key Click plugin
    15 // 
    16 //
    17 
    18 #ifndef __W32CLICK_H__
    19 #define __W32CLICK_H__
    20 
    21 #ifndef __E32STD_H__
    22 #include <e32std.h>
    23 #endif
    24 #ifndef __E32BASE_H__
    25 #include <e32base.h>
    26 #endif
    27 #ifndef __W32STD_H__
    28 #include <w32std.h>
    29 #endif
    30 
    31 
    32 class CClickMaker: public CBase
    33 /** Key or pointer click plug-in provider interface.
    34 
    35 This class should be implemented by a plug-in DLL in order to produce a sound 
    36 when a key is pressed, a key auto repeats or when the screen is tapped with 
    37 a pointer. When any of these events occur, the window server informs the plug-in 
    38 DLL, which can then make the sound.
    39 
    40 The details of the event are also passed to the plug-in so that the sound 
    41 can be tailored to the precise event, for example clicking on different keys on the 
    42 keypad or on different parts of the screen could make different sounds.
    43 
    44 The name of the initial plug-in to use can be specified in the wsini.ini configuration 
    45 file using the KEYCLICKPLUGIN or KEYCLICKPLUGINFIXED keywords. When the operating 
    46 system boots, wsini.ini is read for the name of this plug-in. If a plug-in 
    47 name exists, the window server will try to load it. At a later time, any client 
    48 of the window server can request a new plug-in to be loaded or the current 
    49 one to be unloaded, using the RSoundPlugIn class.
    50 
    51 The plug-in is a polymorphic DLL which implements the CClickMaker interface. 
    52 Its first UID is KDynamicLibraryUidValue and its second UID is 0x10004F63. 
    53 Its first exported function should create an object of the CClickMaker sub-class 
    54 and should have the following signature:
    55 
    56 EXPORT_C CClickMaker* CreateClickMakerL() 
    57 
    58 @publishedAll 
    59 @released 
    60 @see RSoundPlugIn */
    61 	{
    62 public:
    63 	/** This function is called by the window server whenever there is a key event, 
    64 	to generate the sound.
    65 	
    66 	It must be implemented by the key or pointer click plug-in.
    67 	
    68 	If the sound cannot be made, the function should continue without leaving.
    69 	
    70 	@param aType The type of key event: EEventKey, EEventKeyUp, EEventKeyDown 
    71 	or EEventKeyRepeat.
    72 	@param aEvent The key event details. */
    73 	virtual void KeyEvent(TEventCode aType,const TKeyEvent& aEvent)=0;
    74 
    75 	/** This function is called by the window server whenever there is a pointer event, 
    76 	to generate the sound.
    77 	
    78 	It must be implemented by the key or pointer click plug-in.
    79 	
    80 	If the sound cannot be made, the function should continue without leaving.
    81 	
    82 	The iParentPosition data member of aEvent is not the position of the pointer 
    83 	event relative to origin of the parent window. Instead it is the position 
    84 	on the screen. This is because the parent window has no meaning inside the 
    85 	plug-in as it does to the window server client and also knowledge 
    86 	of the screen position may be useful to the plug-in.
    87 	
    88 	@param aEvent The pointer event details. */
    89 	virtual void PointerEvent(const TPointerEvent& aEvent)=0;
    90 
    91 	/** This function is intended for future expansion of the interface, in case it 
    92 	needs to support sounds for other types of event.
    93 
    94 	Currently it is called by the window server, with several values for aType.
    95 	For each of these aParam will need to be cast to a different class type 
    96 	to get the data:
    97 	EEventPointer: cast to TPointerEventData*
    98 	EEventScreenDeviceChanged: TClickMakerData*
    99 	EEventGroupWindowOpen: TGroupWindowOpenData*
   100 	EEventGroupWindowClose: TInt (the identifier of the window group being closed)
   101 	EEventWindowClose: TWindowCloseData*
   102 
   103 	@param aType One of the above listed values, in future may be used with other values.
   104 	@param aParam See above. */
   105 	virtual void OtherEvent(TInt aType,TAny* aParam=NULL)=0;
   106 
   107 	/** This function may be implemented by the key or pointer click plug-in to enable 
   108 	the plug-in to communicate with the window server client.
   109 	
   110 	If this is not required, the implementation may simply return zero.
   111 	
   112 	It is called by RSoundPlugIn::CommandReply() which returns the value returned 
   113 	by this function.
   114 	
   115 	The return value can be generated either by returning it from the function 
   116 	or by leaving with the value. In either case, the client will get back the 
   117 	value concerned.
   118 	
   119 	@param aOpcode Opcode understood by both the window server client and the 
   120 	plug-in DLL.
   121 	@param aArgs Arguments packaged by the window server client.
   122 	@return A value passed back to the client. This may be KErrNone or another 
   123 	of the system-wide error codes. */
   124 	virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs)=0;
   125 	};
   126 
   127 struct TClickMakerData
   128 /**
   129 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
   130 aType value is EEventScreenDeviceChanged.
   131 
   132 @publishedAll 
   133 @released 
   134 */
   135 	{
   136 	TInt screenDeviceMode;
   137 	};
   138 
   139 class TPointerEventData
   140 /**
   141 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
   142 aType value is EEventPointer.
   143 This includes information about the window the pointer event will be sent to.
   144 This is the normally the window being clicked on by the user, but pointer capturing 
   145 and grabbing may affect this.
   146 
   147 @publishedAll 
   148 @released 
   149 */
   150 	{
   151 public:
   152 	enum TSource
   153 		/**
   154 		A list of locations that WSERV receives events from
   155 		*/
   156 		{
   157 		/** The source is not specified. */
   158 		EUnspecified,
   159 		/** The event came from the kernel. */
   160 		EKernel,
   161 		/** The event came from a client API. */
   162 		EClient,
   163 		/** The event came from an Anim DLL. */
   164 		EAnimDLL,
   165 		};
   166 public:
   167 	/**
   168 	The version number of the data passed with EEventPointer, current always 0.
   169 	*/
   170 	TInt iVersion;
   171 	/**
   172 	The screen position of pointer event.
   173 	*/
   174 	TPoint iCurrentPos;
   175 	/**
   176 	The full pointer event data previously passed to the CClickMaker::PointerEvent function,
   177 	except that the iParentPosition will be the actual parent position, when previously passed
   178 	to the plug-in this value was the screen position.
   179 	*/
   180 	TPointerEvent iPointerEvent;
   181 	/**
   182 	The client handle of the window or zero if the window is not a client window.
   183 	*/
   184 	TUint32 iClientHandle;
   185 	/**
   186 	The current top left of the window on the screen.
   187 	*/
   188 	TPoint iWindowOrigin;
   189 	/**
   190 	The Window Group Identifier of the window group that is a parent (or grand parent etc.)
   191 	of the window the event is sent to or zero if the window is not a client window.
   192 	*/
   193 	TInt iWindowGroupId;
   194 	/**
   195 	The source that WSERV recieves the event from,
   196 	currently set to EUnspecified as this is for future expansion.
   197 	*/
   198 	TSource iSource;
   199 	};
   200 
   201 class TGroupWindowOpenData
   202 /**
   203 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
   204 aType value is EEventGroupWindowOpen.
   205 
   206 @publishedAll 
   207 @released 
   208 */
   209 	{
   210 public:
   211 	/**
   212 	The Window Group Identifier of the window being created.
   213 	*/
   214 	TInt iIdentifier;
   215 	/**
   216 	A number unique to the client creating the window group - allows the Plug-in to tell 
   217 	different clients apart.
   218 	*/
   219 	TUint iClient;
   220 	/**
   221 	The number of Window Groups currently owned by that client (not including the one being created).
   222 	*/
   223 	TInt iNumClientWindowGroups;
   224 	};
   225 
   226 class TWindowCloseData
   227 /**
   228 Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the aType value 
   229 is EEventWindowClose.
   230 
   231 @publishedAll 
   232 @released 
   233 */
   234 	{
   235 public:
   236 	/**
   237 	The client handle of the window being closed.
   238 	*/
   239 	TUint32 iClientHandle;
   240 	/**
   241 	The Window Group Identifier of the window group that is a parent (or grandparent etc.)
   242 	of the window being closed, or 0 if the window has been orphaned.
   243 	*/
   244 	TInt iWindowGroupId;
   245 	};
   246 
   247 #endif