Creating a custom graphic

This chapter describes how to derive directly from MGraphic to create your own 2-D graphics class. You cold also derive from an existing 2D graphics class if you want to inherit all of the member functions and add a few of your own. However, if you need functionality that is very different from that implemented in the existing MGraphic derived classes, you will want to derive from MGraphic directly as described in this chapter and implement the member functions the way you need them and add a few member functions of your own.

The custom MGraphic described in this chapter is taken from a monthly calendar program adapted to the CommonPoint application system. This program implements the Gregorian calendar.

You can compile and run this program by checking out the files from the following directory:

    ~/Taligent/Portable/AES/Collaboration/GUIMonthCal
This chapter presents the code in GMCGraphics.h and GMCGraphics.C, which declare and implements the AMonthGraphic class that descends from MGraphic.

First compile the code by typing Makeit at the command line:

    Makeit
To run the calendar, type the following command line and supply a document name in place of <Document_Name>.

    CreateGUIMonth <Document_Name>
Figure 134 shows the monthly calendar and its menu. When you select Forward, the next month displays (for example, August changes to September), and when you select Backward, the previous month displays.


MGraphic constructors
GMCGraphics.h
GMCGraphics.C

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker