Graphics Reference
In-Depth Information
Source file.
Model.h file
class CModel {
in the Model
folder of
the
.
// sets the m _ pSelectedRect reference
// to either R 1 or R 2
A: void SelectRect1();
void SelectRect2();
// returns xform of m _ pSelectedRect
B: UWB _ XformInfo GetSelectedXform() const ;
// sets xform to m _ pSelectedRect
void SetSelectedXform( const UWB _ XformInfo& xform );
D3D _ XformInfoControls
project.
private :
.
C: RectWithXform m _ Rect1, m _ Rect2; // Rectangles: R 1 and R 2
D: RectWithXform * m _ pSelectedRect; // points to either R 1 or R 2
}
Listing 9.12. The CModel class of Tutorial 9.7.
Figure 9.18 is a screenshot of running Tutorial 9.7. The implementation is very
similar to that of Tutorial 9.6 with an identical CModel::DrawModel() routine.
The main differences are illustrated in Listing 9.12. At label A, the CModel
class lets its user select a rectangle. The selected rectangle is pointed to by the
m _ pSelectedRect reference defined at label D. The user of the CModel class can
call the get/set functions at label B to access the XformInfo of the selected rect-
angle. The service functions of the “Red/Green Rectangle” radio button call the
corresponding select functions at label A.
The XformInfo of the selected rectangle is controlled by the GUI elements of
the XformInfo control located at the lower-left corner of the application window.
The XformInfo control is a GUI element container window based on the idea
introduced in Tutorial 2.8 (on p. 69): related GUI elements are grouped inside a
container window for better interaction and for reuse. In this case, on the GUI
Figure 9.18.
Tutorial
9.7.
Source file.
XformInfoControl.h/cpp
in the Controls folder of the
D3D _ XformInfoControls
project.
front end, the IDD _ XFORMCONTROL _ DIALOG is created to contain all the GUI ele-
ments necessary to control each element in an XformInfo object. A placeholder
( IDD _ XFORM _ CONTROL _ PLACEHOLDER ) is created on the application window to
support run-time placing of the container window with the ReplaceDialog
Control() function. In the back-end implementation, the CXformInfoControl
class is created to implement the necessary GUI functionality. The CXformInfo
Search WWH ::




Custom Search