Data Structures
Objective Grid maintains grid properties and attributes in separate classes. This allows several grid views to share the same data. Objective Grid provides several pre-built dialogs that allow the end user to modify properties.
Figure 36 – Objective Grid data structure class hierarchy
CGXGridParam
CGXGridParam contains shared attributes such as the row heights, the cell contents, the styles map, the printer settings and the selected ranges. By default, an instance of CGXGridParam is created in CGXGridCore::OnGridInitialUpdate(), but can also be embedded in the document and linked to the grid.
 
CGXData
The CGXData class maintains the cell contents of the grid and the row and column base styles. The grid component creates an instance of this class in CGXGridCore::OnGridInitialUpdate() and attaches it to the parameter object.
CGXProperties
The CGXProperties class maintains the display and print properties of a grid, such as margins, header/footer and colors of grid lines. Objective Grid offers some pre-built dialog classes that allow the end user to modify these settings at run time. All settings except the header/footer text can be written to and loaded from the profile.
CGXCommand
The CGXCommand class is an abstract base class for storing Undo information for commands. If you want to support Undo/Redo for your commands, you should derive a class from CGXCommand and store all information necessary for undoing the operation into the command object. A detailed discussion of this process is included in the Programmer's Guide section of this manual.
CGXAbstractControlFactory
CGXAbstractControlFactory is an abstract base class for registering new cell types together with user attributes. This class simplifies the registration of new cell types in the grid.
CGXControlFactory
CGXControlFactory is the default implementation of the Objective Grid control factory. CGXControlFactory registers all cell types, user attributes and window classes provided by Objective Grid and will force them to be linked in your application.
CGXGridDropTarget
A CGXGridDropTarget object provides the communication mechanism between a grid and the OLE libraries. Creating an object of this class allows a window to accept data through the OLE drag-and-drop mechanism.
CGXNoOleDataObjectProxy
CGXNoOleDataObjectProxy objects are used to pass COleDataObject objects to the OLE drag & drop overridables in CGXGridCore.
CGXNoOleDataSourceProxy
CGXNoOleDataSourceProxy objects used to pass COleDataSource objects to the OLE drag & drop overridables in CGXGridCore.
CGXDisplayPropertiesDialog, CGXHeaderFooterDialog, CGXPrintPropertiesDialog
These classes provide dialogs that allow the end user to change the settings maintained by the CGXProperties class. All dialogs provide an option that allows the user to save/load the settings using the registry/profile.
Saving, Restoring, and Customizing Colors
The CGXDisplayPropertiesDialog class uses CGXGridLineColorBox to display background colors. Grid gets its colors by calling GXGetVGAColor(), which has a hard-coded array of colors. An API has been added that allows you to customize this color array:
 
// in gxext.h
GRID_API void AFXAPI GXSetVGAColor(int index, COLORREF rgbColor)
// in gxdrawx.cpp
void AFXAPI GXSetVGAColor(int i, COLORREF rgbColor)
In addition, the display properties dialog did not used to have a way to back out color changes. The buttons RevertAll and Default have been added, allowing you to revert changes you have made before saving them and to restore the default colors, respectively.
CGXRange
CGXRange objects define a rectangular range of cells in the grid. A range is specified through a top and bottom row and a left and right columns. Ranges can represent a selection of cells, columns, rows or all cells.
CGXRangeList
CGXRangeList maintains a list of range objects. For example, ranges of cells selected by the user are stored in a CGXRangeList.
CGXPrintDevice
The CGXPrintDevice class maintains printer settings. These printer settings can be modified through the CPrintDialog dialog or by the programmer.