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.

97 lines
2.7 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. intrvbar.h
  5. Abstract:
  6. Definition of the interval bar class used by the CTimeRange class.
  7. --*/
  8. #ifndef _INTRVBAR_H_
  9. #define _INTRVBAR_H_
  10. class CIntervalBar {
  11. friend LRESULT APIENTRY IntervalBarWndProc (
  12. HWND hWnd,
  13. UINT uiMsg,
  14. WPARAM wParam,
  15. LPARAM lParam
  16. );
  17. private:
  18. enum {
  19. ModeNone,
  20. ModeLeft,
  21. ModeRight,
  22. ModeCenter
  23. };
  24. HWND m_hWnd ;
  25. INT m_iBeginValue ; // user-supplied lowest range
  26. INT m_iEndValue ; // user-supplied highest range
  27. INT m_iStartValue ; // current start of selected interval
  28. INT m_iStopValue ; // current end of selected interval
  29. RECT m_rectBorder ;
  30. RECT m_rectLeftBk ;
  31. RECT m_rectLeftGrab ;
  32. RECT m_rectCenterGrab ;
  33. RECT m_rectRightGrab ;
  34. RECT m_rectRightBk ;
  35. HBRUSH m_hBrushBk ;
  36. POINTS m_ptsMouse ;
  37. INT m_iMode ; // who is being tracked?
  38. void NotifyChange ( void );
  39. BOOL GrabRect ( LPRECT lpRect );
  40. void DrawGrab (HDC hDC, LPRECT lprectGrab, BOOL bDown );
  41. INT ValueToPixel ( INT iValue );
  42. INT PixelToValue ( INT xPixel );
  43. void CalcPositions ( void );
  44. void Draw ( HDC hDC, LPRECT lprectUpdate );
  45. void MoveLeftRight ( BOOL bStart, BOOL bLeft, INT iMoveAmt );
  46. void StartGrab ( void );
  47. void EndGrab ( void );
  48. void Update ( void );
  49. BOOL OnKeyDown ( WPARAM wParam );
  50. void OnLButtonDown ( POINTS ptsMouse );
  51. void OnLButtonUp ( void );
  52. void OnMouseMove ( POINTS ptsMouse );
  53. public:
  54. CIntervalBar ( void );
  55. ~CIntervalBar ( void );
  56. BOOL Init ( HWND hWndParent );
  57. HWND Window ( void ) { return m_hWnd; }
  58. void SetRange ( INT iBegin, INT iEnd );
  59. void SetStart ( INT iStart );
  60. void SetStop ( INT iStop );
  61. INT Start ( void ) { return m_iStartValue; }
  62. INT Stop ( void ) { return m_iStopValue; }
  63. INT XStart ( void ) { return m_rectLeftGrab.left; }
  64. INT XStop ( void ) { return m_rectRightGrab.right; }
  65. };
  66. typedef CIntervalBar *PCIntervalBar ;
  67. //==========================================================================//
  68. // Constants //
  69. //==========================================================================//
  70. #define ILN_SELCHANGED (WM_USER + 0x200)
  71. #endif