Graphics Reference
In-Depth Information
class
CTutorialDlg :
public
CDialog {
.
Source file.
TutorialDlg.h/cpp
file
in the
Source
and em-
phHeader folders of the
D3D
_
Rectangles2D
project.
// removed familiar content e.g., constructors etc.
CGrfxWindowD3D m
_
GrfxWnd;
};
.
// removed familiar content e.g., constructors etc.
BOOL
CTutorialDlg::OnInitDialog() {
.
// Replaces
IDC
_
GRFX
_
PLACEHOLDER
on the application window
m
_
GrfxWnd.ReplaceDialogControl(m
_
hWnd, IDC
_
GRFX
_
PLACEHOLDER);
.
Listing 3.1.
CTutorialDlg
class (Tutorial 3.1).
GUI layout design process. Our program code creates this GUI element during
initialization of the main application window.
Back-End Programming Code
The development project consists of a total of nine source files (four
.cpp
and five
.h
files). By now we are familiar with most of the source files, and we understand
the files that we will be working with are the following.
•
CTutorialDlg.h/.cpp
. As in all the tutorials in this topic, these two files
define the
CTutorialDlg
class, the data type that represents the main ap-
plication window. As we can see from Figure 3.6, the main application
window only contains a quit button (with default behavior) and a D3D
Quit Button.
Because the quit
button has the default behav-
ior, no special supported is re-
quired.
drawing area. Listing 3.1 shows that, as expected,
CTutorialDlg
only has
an instance of
m
_
GrfxWnd
, the control variable to the D3D drawing area.
During the initialization of the application window (in
OnInitDialog()
),
m
_
GrfxWnd
replaces itself into the
IDC
_
GRFX
_
PLACEHOLDER
position on the
application window.
•
GrfxWindowD3D.h/.cpp
. These two files define the
CGrfxWindowD3D
class, the data type that represents the D3D drawing area.
Listing 3.2
shows part of the definition of the
CGrfxWndD3D
class.
We see that the
Search WWH ::
Custom Search