Leaked source code of windows server 2003
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.

131 lines
4.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1992 **/
  4. /**********************************************************************/
  5. /*
  6. bltsplit.hxx
  7. Header file for the Splitter Bar custom control
  8. FILE HISTORY:
  9. jonn 08-Oct-93 Created (loosely based on bltmeter and bltlhour)
  10. */
  11. #ifndef _BLTSPLIT_HXX_
  12. #define _BLTSPLIT_HXX_
  13. /**********************************************************\
  14. NAME: H_SPLITTER_BAR
  15. WORKBOOK:
  16. SYNOPSIS: Splitter bars can seperate the window pane into two or
  17. more parts. This splitter bar is modelled after
  18. WinWord 6's splitter bar, with visual modifications
  19. recommended by KeithL. A horizontal splitter bar is
  20. a horizontal line which can be moved vertically.
  21. INTERFACE:
  22. H_SPLITTER_BAR() - constructor
  23. QueryDesiredHeight() - returns the height which should
  24. be reserved for the splitter bar.
  25. Redefine these methods:
  26. OnDragRelease() - called when the splitter bar is moved.
  27. Param is the new position of splitter bar.
  28. QueryActiveArea() - called when splitter bar is painting
  29. or deciding whether click is in active area.
  30. Return width of scrollbar.
  31. MakeDisplayContext() - return a DISPLAY_CONTEXT in which
  32. the splitter bar can draw itself.
  33. PARENT: CUSTOM_CONTROL, CONTROL_WINDOW
  34. USES:
  35. NOTES: This could easily be generalized to allow both
  36. horizontal and vertical splitter bars.
  37. HISTORY:
  38. jonn 08-Oct-93 Created (loosely based on bltmeter and bltlhour)
  39. \**********************************************************/
  40. class H_SPLITTER_BAR : public CONTROL_WINDOW, public CUSTOM_CONTROL
  41. {
  42. private:
  43. BOOL _fCapturedMouse;
  44. INT _dxActiveArea;
  45. INT _dyLineWidth;
  46. XYRECT _xyrectHitZone;
  47. XYRECT _xyrectNotHitZone;
  48. DISPLAY_CONTEXT * _pdcDrag;
  49. BOOL _fInDrag;
  50. BOOL _fShowingDragBar;
  51. XYPOINT _xyLastDragPoint; // last drag point in client coordinates
  52. HCURSOR _hcurActive;
  53. HCURSOR _hcurSave;
  54. static const TCHAR * _pszClassName;
  55. VOID CtAux();
  56. VOID ShowSpecialCursor( BOOL fSpecialCursor );
  57. VOID ShowDragBar( const XYPOINT & xyClientCoords );
  58. VOID ClearDragBar();
  59. VOID InvertDragBar( const XYPOINT & xyClientCoords );
  60. protected:
  61. virtual BOOL OnResize( const SIZE_EVENT & );
  62. virtual BOOL OnPaintReq();
  63. virtual BOOL OnLMouseButtonDown( const MOUSE_EVENT & );
  64. virtual BOOL OnLMouseButtonUp( const MOUSE_EVENT & );
  65. virtual BOOL OnMouseMove( const MOUSE_EVENT & );
  66. virtual BOOL OnQMouseCursor( const QMOUSEACT_EVENT & );
  67. virtual ULONG OnQHitTest( const XYPOINT & xy );
  68. virtual BOOL Dispatch( const EVENT & e, ULONG * pnRes );
  69. /*
  70. * Return the width of the area of the splitter bar which can be
  71. * dragged. By default this is the width of a standard scrollbar.
  72. */
  73. virtual INT QueryActiveArea();
  74. BOOL IsWithinHitZone( const XYPOINT & xy );
  75. /*
  76. * Subclass must come up with a new DISPLAY_CONTEXT in which we can draw
  77. * the bar to show splitter bar movement. H_SPLITTER_BAR is
  78. * responsible for releasing the DISPLAY_CONTEXT. Do not pass an
  79. * ionstance of a class derived from DISPLAY_CONTEXT, since the dtor
  80. * is not virtual.
  81. */
  82. virtual VOID MakeDisplayContext( DISPLAY_CONTEXT ** ppdc ) = 0;
  83. /*
  84. * Subclasses receive this callout when the user releases from a drag.
  85. */
  86. virtual VOID OnDragRelease( const XYPOINT & xyClientCoords );
  87. public:
  88. H_SPLITTER_BAR( OWNER_WINDOW *powin, CID cid );
  89. H_SPLITTER_BAR( OWNER_WINDOW *powin, CID cid,
  90. XYPOINT pXY, XYDIMENSION dXY,
  91. ULONG flStyle );
  92. ~H_SPLITTER_BAR();
  93. INT QueryDesiredHeight();
  94. };
  95. #endif // _BLTSPLIT_HXX_