3 /////////////////////////////////////////////////////////////////////////////
5 // Copyright (c) 2002 Iain Murray, Inference Group, Cavendish, Cambridge.
7 /////////////////////////////////////////////////////////////////////////////
18 #define MAKEPOINTS(l) (*((POINTS FAR *) & (l)))
21 /////////////////////////////////////////////////////////////////////////////
23 CSplitter::CSplitter(CSplitterOwner
* pOwner
, int iPos
)
24 : m_SplitStatus(None
), m_iPos(iPos
), m_pOwner(pOwner
)
28 int CSplitter::GetHeight()
30 // (from MSDN) SM_CYSIZEFRAME:
31 // The thickness of the sizing border around the perimeter of a
32 // window that can be resized, in pixels.
33 // SM_CXSIZEFRAME is the width of the horizontal border, and
34 // SM_CYSIZEFRAME is the height of the vertical border.
35 return std::max(6, GetSystemMetrics(SM_CYSIZEFRAME
));
38 /////////////////////////////////////////////////////////////////////////////
40 HWND
CSplitter::Create(HWND hParent
)
42 return CWindowImpl
<CSplitter
>::Create(hParent
,NULL
,NULL
,WS_CHILD
| WS_VISIBLE
);
45 /////////////////////////////////////////////////////////////////////////////
47 void CSplitter::Move(int iPos
, int Width
)
50 MoveWindow(0, m_iPos
, Width
, GetHeight(), TRUE
);
53 /////////////////////////////////////////////////////////////////////////////
55 LRESULT
CSplitter::OnLButtonDown(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
58 m_SplitStatus
= Sizing
;
63 /////////////////////////////////////////////////////////////////////////////
65 LRESULT
CSplitter::OnLButtonUp(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
68 if( m_SplitStatus
== Sizing
)
76 /////////////////////////////////////////////////////////////////////////////
78 LRESULT
CSplitter::OnMouseMove(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
82 if (m_SplitStatus
== Sizing
)
84 POINTS Tmp
= MAKEPOINTS(lParam
);
88 MapWindowPoints(GetParent(), &MousePos
, 1);
89 m_iPos
= MousePos
.y
- GetHeight() / 2;
95 /////////////////////////////////////////////////////////////////////////////