-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSummaryDlg.cpp
101 lines (87 loc) · 2.45 KB
/
SummaryDlg.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
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: SUMMARYDLG.CPP
** COMPONENT: The Application
** DESCRIPTION: CSummaryDlg class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "SummaryDlg.hpp"
#include "UTSvrBrowser.hpp"
/******************************************************************************
** Method: Default constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CSummaryDlg::CSummaryDlg()
: CDialog(IDD_SUMMARY)
{
DEFINE_CTRL_TABLE
CTRL(IDC_GRID, &m_lvGrid)
END_CTRL_TABLE
DEFINE_CTRLMSG_TABLE
END_CTRLMSG_TABLE
}
/******************************************************************************
** Method: OnInitDialog()
**
** Description: Initialise the dialog.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CSummaryDlg::OnInitDialog()
{
// Set grid style.
// m_lvGrid.Font(CFont(ANSI_FIXED_FONT));
m_lvGrid.FullRowSelect(true);
// m_lvGrid.GridLines(true);
// Create grid columns.
m_lvGrid.InsertColumn(MOD_NAME, TXT("Mod"), 125, LVCFMT_LEFT);
m_lvGrid.InsertColumn(SERVERS, TXT("Servers"), 60, LVCFMT_LEFT);
m_lvGrid.InsertColumn(PLAYERS, TXT("Players"), 60, LVCFMT_LEFT);
// Extract active servers only.
CResultSet oRS = App.m_oSummary.SelectAll();
// Sort result set.
oRS.OrderBy(CSummary::NUM_SERVERS, CSortColumns::DESC);
// Load grid with data.
for (size_t i = 0; i < oRS.Count(); ++i)
{
CRow& oRow = oRS[i];
int nRow = m_lvGrid.ItemCount();
// Add to the grid.
m_lvGrid.InsertItem(nRow, oRow[CSummary::MOD_NAME]);
m_lvGrid.ItemText (nRow, SERVERS, oRow[CSummary::NUM_SERVERS].Format());
m_lvGrid.ItemText (nRow, PLAYERS, oRow[CSummary::NUM_PLAYERS].Format());
m_lvGrid.ItemPtr (nRow, &oRow);
// Set unknown mod to "(other)".
if (oRow[CSummary::MOD_NAME] == TXT(""))
m_lvGrid.ItemText(nRow, MOD_NAME, TXT("(other)"));
}
}
/******************************************************************************
** Method: OnOk()
**
** Description: The OK button was pressed.
**
** Parameters: None.
**
** Returns: true or false.
**
*******************************************************************************
*/
bool CSummaryDlg::OnOk()
{
return true;
}