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.

67 lines
1.6 KiB

  1. // File: splitbar.h
  2. #ifndef __SplitBar2_h__
  3. #define __SplitBar2_h__
  4. class CSplitBar2
  5. : public CWindowImpl<CSplitBar2>
  6. {
  7. public: // Datatypes
  8. typedef void (WINAPI * PFN_ADJUST)(int dxp, LPARAM lParam);
  9. private:
  10. HWND m_hwndBuddy; // Buddy window
  11. HWND m_hwndParent; // Parent window
  12. BOOL m_fCaptured; // TRUE if captured
  13. HDC m_hdcDrag; // The captured desktop hdc
  14. static int ms_dxpSplitBar; // width of a splitbar window
  15. int m_dxSplitter; // Width of the splitter bar
  16. int m_dxDragOffset; // Offset of mouse click within splitter (0 - m_dxSplitter)
  17. int m_xCurr; // Current x position of bar (m_hwndParent co-ordinates)
  18. int m_dxMin;
  19. int m_dxMax;
  20. // callback data and fn ptrs
  21. PFN_ADJUST m_pfnAdjust;
  22. LPARAM m_Context;
  23. BEGIN_MSG_MAP(CSplitBar2)
  24. MESSAGE_HANDLER( WM_LBUTTONDOWN, OnLButtonDown )
  25. END_MSG_MAP()
  26. // Message map handlers
  27. LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  28. public:
  29. CSplitBar2(void);
  30. ~CSplitBar2();
  31. HRESULT Create(HWND hwndBuddy, PFN_ADJUST pfnAdjust, LPARAM Context);
  32. int GetWidth(void) const { return ms_dxpSplitBar; }
  33. static CWndClassInfo& GetWndClassInfo();
  34. private:
  35. void _DrawBar(void);
  36. int _ConstrainDragPoint(short x);
  37. void CancelDragLoop(void);
  38. BOOL FInitDragLoop(POINT pt);
  39. void OnDragMove(POINT pt);
  40. void OnDragEnd(POINT pt);
  41. private:
  42. // Helper Fns
  43. void _TrackDrag(POINT pt);
  44. static void _UpdateSplitBar(void);
  45. };
  46. #endif // __SplitBar2_h__