-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathArenaBar.cpp
More file actions
90 lines (66 loc) · 2.25 KB
/
ArenaBar.cpp
File metadata and controls
90 lines (66 loc) · 2.25 KB
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
// ArenaBar.cpp : implementation file
//
#include "stdafx.h"
#include "Daggerfall Cartographer.h"
#include "ArenaBar.h"
// CArenaBar
CArenaBar::CArenaBar()
{
// Initialise
m_bIsCreated = FALSE;
}
CArenaBar::~CArenaBar()
{
}
BEGIN_MESSAGE_MAP(CArenaBar, baseCViewBar)
ON_WM_CREATE()
ON_WM_SIZE()
// ON_WM_KEYDOWN()
END_MESSAGE_MAP()
// CArenaBar message handlers
int CArenaBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CSizingControlBarG::OnCreate(lpCreateStruct) == -1)
return -1;
if ( !m_wndArenaDlg.Create( IDD_ARENA_DIALOG, this ) )
return -1;
// Add a column to the list view
LVCOLUMN lvc;
ZeroMemory( &lvc, sizeof(LVCOLUMN) );
lvc.mask = LVCF_WIDTH;
lvc.cx = 190;
m_wndArenaDlg.m_ctrlArenaList.InsertColumn( 0, &lvc );
// Create image list
if ( !m_ilLocations.Create( IDB_LOCATION_TYPES_BITMAP, 16, 1, RGB(0,0,128) ) ) return FALSE;
// Set image list for the tab controls and list control
m_wndArenaDlg.m_ctrlRegionCombo.SetImageList( &m_ilLocations );
m_wndArenaDlg.m_ctrlLocationCombo.SetImageList( &m_ilLocations );
m_wndArenaDlg.m_ctrlArenaList.SetImageList( &m_ilLocations, LVSIL_SMALL );
// Set created flag
m_bIsCreated = TRUE;
return 0;
}
void CArenaBar::OnSize(UINT nType, int cx, int cy)
{
CSizingControlBarG::OnSize(nType, cx, cy);
if ( m_bIsCreated ) {
// Get size of this bar
CRect rct;
GetClientRect( rct );
// Size the underlying dialog
m_wndArenaDlg.SetWindowPos( NULL, 0, 0, rct.Width(), rct.Height(), SWP_DEFERERASE|SWP_NOZORDER );
// Size region combo
CRect win;
m_wndArenaDlg.m_ctrlRegionCombo.GetWindowRect( win );
m_wndArenaDlg.ScreenToClient( win );
m_wndArenaDlg.m_ctrlRegionCombo.SetWindowPos( NULL, win.left, win.top, rct.Width(), win.Height(), SWP_DEFERERASE|SWP_NOZORDER );
// Size location combo
m_wndArenaDlg.m_ctrlLocationCombo.GetWindowRect( win );
m_wndArenaDlg.ScreenToClient( win );
m_wndArenaDlg.m_ctrlLocationCombo.SetWindowPos( NULL, win.left, win.top, rct.Width(), win.Height(), SWP_DEFERERASE|SWP_NOZORDER );
// Size location list
m_wndArenaDlg.m_ctrlArenaList.GetWindowRect( win );
m_wndArenaDlg.ScreenToClient( win );
m_wndArenaDlg.m_ctrlArenaList.SetWindowPos( NULL, win.left, win.top, rct.Width(), rct.Height() - win.top, SWP_DEFERERASE|SWP_NOZORDER );
}
}