emulator/emulatorbsp/specific/multitouch.h
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     1 // Copyright (c) 1995-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // wins\specific\multitouch.h
       
    15 // 
       
    16 //
       
    17 #ifndef MULTITOUCH_H
       
    18 #define MULTITOUCH_H
       
    19 
       
    20 #include <e32err.h>
       
    21 #include <emulator.h>
       
    22 #include <commctrl.h>
       
    23 #include "multitouchwindowsheader.h"
       
    24 
       
    25 #ifndef WM_INPUT
       
    26 #define WM_INPUT 0x00ff
       
    27 #endif
       
    28 
       
    29 /**
       
    30  * The main class for Multitouch
       
    31 */
       
    32 class DMultiTouch
       
    33 	{
       
    34 public:
       
    35 	DMultiTouch(TInt aProximityStep, TInt aPressureStep);
       
    36 	void OnWmInput(HWND aHWnd,TUint aMessage,TUint aWParam,TUint aLParam,HWND aParentHwnd);
       
    37 	void ShowPrimaryCursor(HWND aHWnd);
       
    38 	static bool Init();
       
    39 	static void ShowCursors();
       
    40 	static void HideCursors();
       
    41 	BOOL Register();
       
    42 	BOOL UnRegister();
       
    43 
       
    44 public:
       
    45 	static int iNumberOfMice;
       
    46 	static bool iMultiTouchSupported;
       
    47 	static bool iMultiTouchCreated;
       
    48 	static bool iMultiTouchTempEnabled;
       
    49 	int iZMaxRange;
       
    50 	int iPressureStep;
       
    51 	int iProximityStep;
       
    52 	int iMaxPressure;	
       
    53 	};
       
    54 
       
    55 extern DMultiTouch* TheMultiTouch;
       
    56 extern void MultiTouchWndPointer(TUint message,TInt aXpos,TInt aYpos, TInt aPointerId, TInt aZ);
       
    57 
       
    58 /**
       
    59  * The class of the Cursor Window
       
    60  */
       
    61 class CursorWindow
       
    62 {
       
    63 public:
       
    64 	CursorWindow();
       
    65 	HWND Create(HMODULE hm, HWND hwndParent, int number);
       
    66 	BOOL SetCursor(HCURSOR hc);
       
    67 	void GetPosition(POINT& pt);
       
    68 	void SetPosition(POINT& pt);
       
    69 	void Show();
       
    70 	void Hide();
       
    71 
       
    72 	HWND iHwnd;
       
    73 	int iNumber;
       
    74 	HCURSOR iCursor;
       
    75 	POINT iHotspot;
       
    76 };
       
    77 
       
    78 /**
       
    79  * The class encapsulating each mouse device
       
    80  */
       
    81 class DMultiMouse
       
    82 	{
       
    83 public:
       
    84 	DMultiMouse();
       
    85 	static TInt Add(RAWINPUTDEVICELIST& aDev);
       
    86 	static DMultiMouse* Find(HANDLE aHandle);
       
    87 	void HandleRawMouseEvent(RAWMOUSE& aEvent, HWND aWnd);
       
    88 	void CreateCursor(LPVOID aArg, HWND aWnd);
       
    89 	enum
       
    90 		{KMaxMice = 8};
       
    91 
       
    92 private:
       
    93 	void CorrectSystemMouse();
       
    94 	void ShowMousePos(HWND aHWnd);
       
    95 
       
    96 private:
       
    97 	int iX;
       
    98 	int iY;
       
    99 	int iZ;
       
   100 	HANDLE iDevice;
       
   101 	int iId;
       
   102 
       
   103 public:
       
   104 	bool iIsPrimary;
       
   105 	CursorWindow iCursorWnd;
       
   106 
       
   107 	static DMultiMouse iMice[KMaxMice];
       
   108 	static int iNumMice;
       
   109 	static DMultiMouse* iPrimary;
       
   110 	static int iMouseId;
       
   111 	};
       
   112 
       
   113 #endif