-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWorkspaceBar2.cpp
91 lines (69 loc) · 2.15 KB
/
WorkspaceBar2.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// WorkspaceBar2.cpp : implementation of the CWorkspaceBar2 class
//
#include "stdafx.h"
#include "VisualADS.h"
#include "WorkspaceBar2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const int nBorderSize = 1;
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar2
BEGIN_MESSAGE_MAP(CWorkspaceBar2, CBCGPDockingControlBar)
//{{AFX_MSG_MAP(CWorkspaceBar2)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar2 construction/destruction
CWorkspaceBar2::CWorkspaceBar2()
{
// TODO: add one-time construction code here
}
CWorkspaceBar2::~CWorkspaceBar2()
{
}
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar2 message handlers
int CWorkspaceBar2::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty ();
// Create tree windows.
// TODO: create your own tab windows here:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES |
TVS_LINESATROOT | TVS_HASBUTTONS;
if (!m_wndTree.Create (dwViewStyle, rectDummy, this, 1))
{
TRACE0("Failed to create workspace view\n");
return -1; // fail to create
}
// Setup trees content:
HTREEITEM hRoot1 = m_wndTree.InsertItem (_T("Root 2"));
m_wndTree.InsertItem (_T("Item 1"), hRoot1);
m_wndTree.InsertItem (_T("Item 2"), hRoot1);
return 0;
}
void CWorkspaceBar2::OnSize(UINT nType, int cx, int cy)
{
CBCGPDockingControlBar::OnSize(nType, cx, cy);
// Tab control should cover a whole client area:
m_wndTree.SetWindowPos (NULL, nBorderSize, nBorderSize,
cx - 2 * nBorderSize, cy - 2 * nBorderSize,
SWP_NOACTIVATE | SWP_NOZORDER);
}
void CWorkspaceBar2::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rectTree;
m_wndTree.GetWindowRect (rectTree);
ScreenToClient (rectTree);
rectTree.InflateRect (nBorderSize, nBorderSize);
dc.Draw3dRect (rectTree, globalData.clrBarShadow, globalData.clrBarShadow);
}