tagging release
[dasher.git] / trunk / Src / Win32 / Widgets / Splitter.h
blobc9750422623008aa83aa68511cb13c72840a83a5
1 // Splitter.h
2 //
3 /////////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (c) 2002-2006 Iain Murray, Inference Group, Cavendish, Cambridge.
6 //
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef __Splitter_h__
10 #define __Splitter_h__
12 /////////////////////////////////////////////////////////////////////////////
14 // Abstract interface - callback for resize of splitter
16 class CSplitterOwner
18 public:
19 virtual void Layout() = 0;
22 /////////////////////////////////////////////////////////////////////////////
24 class CSplitter :public ATL::CWindowImpl<CSplitter>
27 public:
29 CSplitter(CSplitterOwner* pOwner,int Pos);
31 HWND Create(HWND Parent);
33 void Move(int Pos, int Width);
35 int GetHeight()
37 return GetSystemMetrics(SM_CYSIZEFRAME);
40 int GetPos()
42 return m_iPos;
45 static ATL::CWndClassInfo& GetWndClassInfo()
47 static ATL::CWndClassInfo wc = \
48 { \
49 { sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW , StartWindowProc, \
50 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_ACTIVEBORDER + 1), NULL, _T("HSplitter"), NULL }, \
51 NULL, NULL, MAKEINTRESOURCE(IDC_SIZENS), TRUE, 0, _T("") \
52 }; \
53 return wc;
56 BEGIN_MSG_MAP( CSplitter )
57 MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
58 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
59 MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
60 END_MSG_MAP()
62 protected:
64 enum SplitStatus
66 None,
67 Sizing
70 LRESULT OnLButtonDown(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
71 LRESULT OnLButtonUp(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
72 LRESULT OnMouseMove(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
74 private:
75 CSplitterOwner* m_pOwner;
76 int m_iPos;
77 SplitStatus m_SplitStatus;
80 #endif /* #ifndef __Splitter_h__ */