-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWinSpliter.h
69 lines (56 loc) · 1.76 KB
/
WinSpliter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* @file: AAType.h
* @brief: Window splitter used in AARFS
* @author: dongzhaoyu
* @date: 2008-4-10
*
* Copyright (c) 2008 Xi'an JiaoTong University
*/
#ifndef _WINSPLITER_H
#define _WINSPLITER_H
template <bool t_bVertical = true>
class WinSpliter : public CSplitterWindowImpl<WinSpliter<t_bVertical>, t_bVertical>
{
public:
DECLARE_WND_CLASS_EX(_T("My_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW)
WinSpliter() : m_bPatternBar(false)
{ }
// Operations
void EnablePatternBar ( bool bEnable = false )
{
if ( bEnable != m_bPatternBar )
{
m_bPatternBar = bEnable;
UpdateSplitterLayout();
}
}
// Overrideables
void DrawSplitterBar(CDCHandle dc)
{
RECT rect;
// If we're not using a colored bar, let the base class do the
// default drawing.
if ( !m_bPatternBar )
{
CSplitterWindowImpl<WinSpliter<t_bVertical>, t_bVertical>::DrawSplitterBar(dc);
return;
}
// Create a brush to paint with, if we haven't already done so.
if ( m_br.IsNull() )
m_br.CreateHatchBrush ( HS_DIAGCROSS,
t_bVertical ? RGB(255,0,0) : RGB(0,0,255) );
if ( GetSplitterBarRect ( &rect ) )
{
dc.FillRect ( &rect, m_br );
// draw 3D edge if needed
if ( (GetExStyle() & WS_EX_CLIENTEDGE) != 0)
dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM));
}
}
protected:
CBrush m_br;
bool m_bPatternBar;
};
typedef WinSpliter<true> VerSplitter;
typedef WinSpliter<false> HorSplitter;
#endif