Objective Grid : PART I User’s Guide : Chapter 3 Technical Overview : Style Classes
Style Classes
Objective Grid implements an attribute architecture, or styles, that lets the developer manipulate grid attributes in a variety of ways. This section introduces the style classes.
Figure 35 – Objective Grid style class hierarchy
CGXStyle
The CGXStyle class contains all the information necessary for formatting a cell. A style consists of several attributes such as the text color, borders, control type and font attributes. All of these styles can be modified by the end user via the CGXStyleSheet dialog.
The CGXStyle class lets the developer extend the class at run time with specific user attributes that provide additional information about specific cells. An example of a user attribute would be an additional “Expression” attribute. The end user could modify the value for the “Expression” attribute with CGXStyleSheet, and the developer could interpret the “Expression” attribute in a subclassed control and so extend Objective Grid with some simple formula capabilities.
An advanced attribute of the CGXStyle class is the base style so that you can easily group specific kinds of cells and make them have similar attributes.
CGXStylesMap
Each grid owns one CGXStylesMap object that maintains grid-wide base styles. Base styles make it possible to group specific kinds of cells and make them have similar attributes. The predefined base styles are: row-header-style, column-header-style and standard-style. Row header cells inherit their attributes from row-header-style. Column headers inherit from column-header-style. Standard-style is the base style for all cells in the grid.
CGXStylesDialog
Class CGXStylesDialog provides a dialog that lets end users change the values of base styles found in the CGXStylesMap. The user can add new or change existing base styles through the CGXStylesDialog. For example, if the user changes the background color of the standard-style, all cells in the grid that do not have a specific background color will inherit the new background color. CGXStylesDialog also provides an option that allows the user to save/load the base styles using the registry/profile.
CGXStyleSheet
Class CGXStyleSheet encapsulates a property sheet that lets the end user specify a style. A style sheet can either apply changes to a range of selected cells or to one of the base styles. Please refer to “Pre-Built Dialogs for Accessing Objective Grid Objects” for a detailed description of this class and how to use it.
CGXFont, CGXBrush, CGXPen
These classes encapsulate Windows structures and add style features to them. For example, CGXFont encapsulates a LOGFONT structure and also adds serialization support and the ability to archive the font information to the registry/profile.
CGXAbstractUserAttribute
By deriving from CGXAbstractUserAttribute, you can store binary data into any CGXStyle object. Using a CGXAbstractUserAttribute will be much more convenient for you than using SetItemDataPtr, because you don't have to worry about deleting the objects any more.
CGXUserAttribute
CGXUserAttribute provides support for number and string user attributes in the CGXStyle class. CGXStyle::SetUserAttribute() instantiates this default CGXUserAttribute class for strings and numbers automaticallY..