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.

105 lines
3.1 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // KNOB.H
  4. //
  5. // Defines the Knob Control
  6. //
  7. // Copyright (c) Microsoft Corporation 1997
  8. //
  9. // 12/18/97 David Stewart / dstewart
  10. //
  11. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  12. #ifndef _KNOB_HEADER_
  13. #define _KNOB_HEADER_
  14. #include "windows.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //forward declaration
  19. class CKnob;
  20. //helper functions for global stuff, start up, shut down, etc.
  21. CKnob* GetKnobFromID(HWND hwndParent, int nID);
  22. CKnob* GetKnobFromHWND(HWND hwnd);
  23. class CKnob
  24. {
  25. public:
  26. /*
  27. Create a class of the knob
  28. */
  29. friend CKnob* CreateKnob(DWORD dwWindowStyle,
  30. DWORD dwRange,
  31. DWORD dwInitialPosition,
  32. int x,
  33. int y,
  34. int width,
  35. int height,
  36. HWND hwndParent,
  37. int nID,
  38. HINSTANCE hInst);
  39. CKnob(); //constructor
  40. ~CKnob(); //destructor
  41. HWND GetHWND() {return m_hwnd;}
  42. int GetID() {return m_nID;}
  43. void SetRange(DWORD dwRange) {m_dwRange = dwRange;}
  44. DWORD GetRange() {return m_dwRange;}
  45. DWORD GetPosition() {return m_dwCurPosition;}
  46. void SetPosition(DWORD dwPosition, BOOL fNotify);
  47. private:
  48. //non-static privates
  49. int m_nID;
  50. HWND m_hwnd;
  51. int m_nLightX;
  52. int m_nLightY;
  53. DWORD m_dwRange;
  54. DWORD m_dwPosition;
  55. DWORD m_dwCurPosition;
  56. double m_trackdegree;
  57. UINT_PTR m_uFlashTimerID;
  58. UINT_PTR m_uTrackTimerID;
  59. BOOL m_fDim;
  60. BOOL m_fFastKnob;
  61. void OnButtonDown(int x, int y);
  62. void OnButtonUp();
  63. BOOL ComputeCursor(int deltaX, int deltaY, int maxdist);
  64. void OnMouseMove(int x, int y);
  65. void OnTimer();
  66. void OnFlashTimer();
  67. void Draw(HDC hdc);
  68. void KMaskBlt(HDC hdcDest, int x, int y, int width, int height, HDC hdcSource, int xs, int ys, HBITMAP hMask, int xm, int xy, DWORD dwDummy);
  69. private:
  70. //static stuff for all knobs
  71. static HINSTANCE m_hInst;
  72. static DWORD m_dwKnobClassRef;
  73. static ATOM m_KnobAtom;
  74. static HANDLE m_hbmpKnob;
  75. static HANDLE m_hbmpKnobTab;
  76. static HANDLE m_hbmpLight;
  77. static HANDLE m_hbmpLightBright;
  78. static HANDLE m_hbmpLightMask;
  79. static int m_nLightWidth;
  80. static int m_nLightHeight;
  81. static LRESULT CALLBACK KnobProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
  82. static void CALLBACK TrackProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
  83. static void CALLBACK FlashProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
  84. static BOOL InitKnobs(HINSTANCE hInst);
  85. static void UninitKnobs();
  86. };
  87. #ifdef __cplusplus
  88. };
  89. #endif
  90. #endif //_KNOB_HEADER_