-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFCMApp.hpp
152 lines (127 loc) · 3.16 KB
/
FCMApp.hpp
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: FCMAPP.HPP
** COMPONENT: The Application.
** DESCRIPTION: The CFCMApp class declaration.
**
*******************************************************************************
*/
// Check for previous inclusion
#ifndef FCMAPP_HPP
#define FCMAPP_HPP
#if _MSC_VER > 1000
#pragma once
#endif
#include <WCL/SDIApp.hpp>
#include "FCMMainWnd.hpp"
#include "FCMCmds.hpp"
#include "FCMView.hpp"
#include "FCMDoc.hpp"
#include <WCL/IniFile.hpp>
#include <WCL/Printer.hpp>
/******************************************************************************
**
** The application class.
**
*******************************************************************************
*/
class CFCMApp : public CSDIApp
{
public:
//
// Constructors/Destructor.
//
CFCMApp();
~CFCMApp();
//
// Typed access to the doc and view.
//
CFCMDoc* Doc();
CFCMView* View();
//
// Members
//
CFCMMainWnd m_AppWnd; // Main window.
CFCMCmds m_AppCmds; // Cmd controller.
CIniFile m_oIniFile; // Ini file.
CPrinter m_oPrinter; // Default printer.
CRect m_rcAppWnd; // Last position of main window.
CSize m_dmTeamSelDlg; // Last size of team selection dialog.
//
// Template methods for getting doc and view specifics.
//
virtual CSDIDoc* CreateDoc() const;
virtual CView* CreateView(CDoc& rDoc) const;
virtual const tchar* FileExts() const;
virtual const tchar* DefFileExt() const;
//
// Misc helper functions.
//
CString FormatName(CRow& rRow, int nForename, int nSurname, bool bReverse = false) const;
CString FormatMoney(CRow& rRow, int nColumn) const;
CString FormatMoney(int nAmount) const;
CString FormatDate(CRow& rRow, int nColumn) const;
CString FormatDecimal(CRow& rRow, int nColumn, int nDecDigits) const;
//
// Constants.
//
static const tchar* VERSION;
protected:
//
// Members
//
//
// Startup and Shutdown template methods.
//
virtual bool OnOpen();
virtual bool OnClose();
//
// Internal methods.
//
void LoadDefaults();
void SaveDefaults();
};
/******************************************************************************
**
** Global variables.
**
*******************************************************************************
*/
//The application object.
extern CFCMApp App;
/******************************************************************************
**
** Implementation of inline functions.
**
*******************************************************************************
*/
inline CFCMDoc* CFCMApp::Doc()
{
return static_cast<CFCMDoc*>(m_pDoc);
}
inline CFCMView* CFCMApp::View()
{
return static_cast<CFCMView*>(m_pView);
}
inline CSDIDoc* CFCMApp::CreateDoc() const
{
return new CFCMDoc;
}
inline CView* CFCMApp::CreateView(CDoc& rDoc) const
{
return new CFCMView(static_cast<CFCMDoc&>(rDoc));
}
inline const tchar* CFCMApp::FileExts() const
{
static tchar szExts[] = { TXT("F.C. Manager Files (*.fcm)\0*.fcm\0")
TXT("All Files (*.*)\0*.*\0")
TXT("\0\0") };
return szExts;
}
inline const tchar* CFCMApp::DefFileExt() const
{
static tchar szDefExt[] = { TXT("fcm") };
return szDefExt;
}
#endif //FCMAPP_HPP