Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The Document Class


CDrawDoc is the document class. Its task is to accept mouse and keyboard input from the CDrawView view objects, to manage the document's data, to load and save data, to alert the view object about changes in the data, and to accept input from the menus. This implies that the class is rather large.

One central point of this application is its states. The application can be in a number of different states. For the application to keep up with them there is a set of fields. First, we have m_eNextActionState. It keeps track of the user's next move. It can be set to adding a line, adding an arrow, adding a rectangle, adding an ellipse, adding text, or modifying a figure. It has the enumeration type NextActionState.

 enum NextActionState {ADD_LINE, ADD_ARROW, ADD_RECTANGLE,
                       ADD_ELLIPSE, ADD_TEXT, MODIFY_FIGURE};

The constructor and destructor access its current value from the registry. The last parameter to GetProfileInt is the default value in case the value...