A SERVICE OF

logo

og is the number of menu groups in the Object menu.
wg is the number of menu groups in the Window menu.
hg is the number of menu groups in the Help menu.
Although the groups have particular names, these names just
represent a common name for the menu group. The menu
represented by each group does not necessarily have that name. The
document manager provides a default File menu, but the other menu
names can be set in the menu resource.
When one of the menu group parameters is 0, that indicates that the
menu resource has no menu for that group. The total number of
menu groups indicated by all the menu group parameters must be
equal to or less than the number of menu groups available in the
menu resource.
In this case, the view supplies a menu resource called
IDM_DRAWVIEW which is contained in the file STEP11DV.RC. This,
menu is called T ols, which has the same choices on it as the T olso o
menu in earlier steps: P n Size and P n Color T insert the T olse e . o o
menu as the second menu on the menu bar the eg parameter the, ,
second menu group parameter should be 1, while the rest of the,
menu group parameters are 0.
Y u can install the menu descriptor as the view menu using theo
TView function SetViewMenu function, which takes a single
parameter a TMenuDescr
*. SetViewMenu sets the menu descriptor as,
the view’ menu. When the view is created, this menu is merged withs
the application menu.
Here’ how the call to set up the view menu should look:s
SetViewMenu(new TMenuDescr(IDM_DRAWVIEW,0,1,0,0,0,0));
The destructor for the view deletes the device context referenced by
DragDC and the TLine object referenced by Line.
Every view class should define the function StaticName, which takes
Naming the class
no parameters and returns a static const char far *. This function
should return the name of the view class. Here’ how the StaticNames
function might look:
static const char far* StaticName() {return "Draw View";}
TDrawView has a couple of protected access functions to provide
P otected functionsr
functionality for the class.
Chapter 2, Learning ObjectWindows
85