Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.0 KiB

  1. /*
  2. * @doc
  3. *
  4. * @module _MAGELLN.H -- Declaration of class to handle Magellan mouse. |
  5. *
  6. * Authors: <nl>
  7. * Jon Matousek
  8. *
  9. * Copyright (c) 1995-1996 Microsoft Corporation. All rights reserved.
  10. */
  11. #if !defined(_MAGELLN_H) && !defined(NOMAGELLAN) // Win NT/95 only class.
  12. #define _MAGELLN_H
  13. #include "_edit.h"
  14. // All of the knobs for magellan mouse scrolling.
  15. const LONG DEAD_ZONE_TWIPS = 60; // 3 pixels normally
  16. const DWORD FAST_ROLL_SCROLL_TRANSITION_TICKS = 900; // in mili seconds.
  17. const INT FASTER_ROLL1_COUNT = 5;
  18. const INT FASTER_ROLL2_COUNT = 10;
  19. const WORD SMOOTH_ROLL_CLINES = 2; // multiples of rolls for roll1, roll2.
  20. const int SMOOTH_ROLL_NUM = 1;
  21. const int SMOOTH_ROLL_DENOM = 3;
  22. class CMagellan {
  23. friend class CMagellanBMPStateWrap;
  24. private:
  25. VOID CheckInstallMagellanTrackTimer (CTxtEdit &ed);
  26. VOID CheckRemoveMagellanUpdaterTimer (CTxtEdit &ed);
  27. BOOL InvertMagellanDownBMP ( CDisplay *pdp, BOOL fTurnOn, HDC repaintDC );
  28. WORD _fMagellanBitMapOn :1; // TRUE if the MDOWN bitmap is displayed.
  29. WORD _fMButtonScroll :1; // Auto scrolling initiated via magellan-mouse.
  30. WORD _fLastScrollWasRoll :1; // scroll will be wither roll or mdown.
  31. SHORT _ID_currMDownBMP; // Resource ID of _MagellanMDownBMP.
  32. HBITMAP _MagellanMDownBMP; // Loaded BMP
  33. POINTUV _ptStart; // Magellan mouse's start scroll pt.
  34. public:
  35. BOOL MagellanStartMButtonScroll(CTxtEdit &ed, POINT ptxy);
  36. VOID MagellanEndMButtonScroll( CTxtEdit &ed );
  37. VOID MagellanRollScroll(CDisplay *pdp, int direction, WORD cLines, int speedNum, int speedDenom, BOOL fAdditive );
  38. VOID TrackUpdateMagellanMButtonDown ( CTxtEdit &ed, POINT mousePt);
  39. BOOL IsAutoScrolling() {return _fMButtonScroll;}
  40. BOOL ContinueMButtonScroll(CTxtEdit *ped, INT x, INT y);
  41. ~CMagellan() { Assert( !_MagellanMDownBMP && !_fMButtonScroll /* client state problems? */); }
  42. };
  43. class CMagellanBMPStateWrap {
  44. private:
  45. BOOL _fMagellanState;
  46. HDC _repaintDC;
  47. CTxtEdit &_ed;
  48. public:
  49. CMagellanBMPStateWrap(CTxtEdit &ed, HDC repaintDC);
  50. ~CMagellanBMPStateWrap();
  51. };
  52. #endif // _MAGELLN_H