-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWorkspaceView.cpp
executable file
·120 lines (86 loc) · 2.15 KB
/
WorkspaceView.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// WorkspaceView.cpp : implementation of the CWorkspaceView class
//
#include "stdafx.h"
#include "VEditor.h"
#include "tools.h"
#include "WorkspaceView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceView
CWorkspaceView::CWorkspaceView()
{
}
CWorkspaceView::~CWorkspaceView()
{
}
BEGIN_MESSAGE_MAP(CWorkspaceView,CWnd )
//{{AFX_MSG_MAP(CWorkspaceView)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceView message handlers
BOOL CWorkspaceView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;
cs.dwExStyle |= WS_EX_LEFT | WS_EX_LTRREADING;
cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_APPWORKSPACE + 1), NULL);
return TRUE;
}
void CWorkspaceView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CWnd::OnPaint() for painting messages
}
void CWorkspaceView::TileWindows(UINT type)
{
RECT rect;
CWnd *pWnd;
int count;
int i;
int width;
int height;
int pos;
GetWindowRect(&rect);
pWnd = GetWindow(GW_CHILD);
count = 0;
while (pWnd)
{
count++;
pWnd = pWnd->GetNextWindow();
}
if (!count)
return;
pWnd = GetWindow(GW_CHILD);
pos = 0;
switch(type)
{
case MDITILE_VERTICAL:
height = rect.bottom - rect.top;
width = (rect.right - rect.left + 1) / count;
for (i = 0; i < count; i++)
{
pWnd->SetWindowPos(NULL, pos, 0, width, height, SWP_NOZORDER);
pos += width;
pWnd = pWnd->GetNextWindow();
}
break;
case MDITILE_HORIZONTAL:
height = (rect.bottom - rect.top + 1) / count;
width = rect.right - rect.left;
for (i = 0; i < count; i++)
{
pWnd->SetWindowPos(NULL, 0, pos, width, height, SWP_NOZORDER);
pos += height;
pWnd = pWnd->GetNextWindow();
}
break;
}
}