- Style Scheme
- A style scheme is a data structure which determines how an object will be rendered on the screen. Style schemes contain all the colors, images, fonts, and text used in displaying an object. Style schemes are defined independently of objects. Upon the object’s creation, a user defined Style scheme is assigned to the object. A single style scheme may be assigned to many different objects.
Structure of a Style Scheme
The structure GFX_GOL_OBJ_SCHEME is used to hold instances of style schemes. GFX_GOL_OBJ_SCHEME is defined in GFX_GOL_SCHEME.h.
Styles schemes contain at least 16 items. Additional items will be added if Alpha Blending Defined in GFX_CONFIG.h or Gradient Color Filling Defined in GFX_CONFIG.his enabled.
When an object is displayed, elements from the style scheme are applied to object based upon the state bits of the object.
|EmbossDkColor||Dark color used for the 3-D effect of the object.|
|EmbossLtColor||Light color used for the 3-D effect of the object.|
|TextColor0||Generic text colors used by the objects. Usage may vary from one object type to another|
|TextColor1||Generic text colors used by the objects. Usage may vary from one object type to another|
|TextColorDisabled||Text color used when the object state bit is set to "disabled"|
|Color0||Generic color used to render objects. Usage may vary from one object type to another|
|Color1||Generic color used to render objects. Usage may vary from one object type to another|
|ColorDisabled||Color used to render objects that are disabled|
|pFont||Pointer to the font table used by the object|
|fillStyle||Determines gradient type. Only used when Color Gradients are enabled|
|ComonBkColor||Used to hide objects from view without deleting them.|
|ComonBkLeft||Horizontal starting point of the background|
|ComonBkTop||Vertical starting point of the background|
|ComonBkType||Specifies the type of background to use.|
|*ComonBkImage||pointer to an image used as the background image|
|EmbossSize||Size of the pannel for 3-D effects. Will be set to 0 if 3D is not used.|
|AlphaValue||Alpha value used for alpha blending, this is only available only when GFX_CONFIG_ALPHABLEND_DISABLE is NOT "commented" out in gfx_config.h|
|gradientStartColor||Starting color for gradient color scheme. Only exists when GFX_CONFIG_GRADIENT_DISABLE is NOT "commented" out in gfx_config.h|
|gradientEndColor||Ending color for gradient color scheme. Only exists when GFX_CONFIG_GRADIENT_DISABLE is NOT "commented" out in gfx_config.h|
Default Style Scheme
If the file gfx_gol_scheme_default.c is added to a project, it will create a style scheme called GOLSchemeDefault. The default scheme will be populated with the colors defined in gfx_gol_scheme_default.c. This default scheme maybe used as is, or may be modified to meet the application needs.
Creating and Using Style Schemes
It is quite common for an application to use several different style schemes. To create a style style scheme several steps must be taken:
- Create an instance of the style scheme structure and give it a name.
- Populate the newly created structure with the desired style scheme elements.
- Assign the new style scheme as graphic objects are created.
For instances where only a few elements of new style scheme differ from an existing style scheme, many programmers find it more convenient to copy an existing scheme into a newly defined scheme, then edit the few different elements
Example: Creating and using a Custom Style Scheme
The following steps presume the file gfx_gol_scheme_default has been added to the project resulting in the creation of a default scheme GOLSchemeDefault
Create a pointer to a style scheme structure.
In this example the pointer is called MyNewScheme
Copy the content of the exisitng default
scheme to the newly create scheme.
Modify the contents of the scheme as needed to
meet the application requirements. For this example
several of the elements of the new scheme have
Asssign the newly created style scheme to an object.