moused.inc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {
  2. Free Pascal port of the OpenPTC C++ library.
  3. Copyright (C) 2001-2006 Nikolay Nikolov ([email protected])
  4. Original C++ version by Glenn Fiedler ([email protected])
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. }
  17. Type
  18. TWin32Mouse = Class(TWin32Hook)
  19. Private
  20. { window procedure }
  21. Function WndProc(hWnd : HWND; message : DWord; wParam : WPARAM; lParam : LPARAM) : LRESULT; Override;
  22. FEventQueue : TEventQueue;
  23. FFullScreen : Boolean;
  24. { the actual image area, inside the window (top left and bottom right corner) }
  25. FWindowX1, FWindowY1, FWindowX2, FWindowY2 : Integer;
  26. { console resolution
  27. - mouse cursor position as seen by the user must always be in range:
  28. [0..FConsoleWidth-1, 0..FConsoleHeight-1] }
  29. FConsoleWidth, FConsoleHeight : Integer;
  30. FPreviousMouseButtonState : TPTCMouseButtonState;
  31. FPreviousMouseX, FPreviousMouseY : Integer; { for calculating the deltas }
  32. FPreviousMousePositionSaved : Boolean; { true, if FPreviousMouseX,
  33. FPreviousMouseY and FPreviousMouseButtonState contain valid values }
  34. { flag data }
  35. FEnabled : Boolean;
  36. Public
  37. { setup }
  38. Constructor Create(window : HWND; thread : DWord; multithreaded : Boolean; EventQueue : TEventQueue; FullScreen : Boolean; ConsoleWidth, ConsoleHeight : Integer);
  39. Procedure SetWindowArea(WindowX1, WindowY1, WindowX2, WindowY2 : Integer);
  40. { control }
  41. Procedure enable;
  42. Procedure disable;
  43. End;