Theme Schema File - 07/20/00 ---------------------------- 1. Description: the theme schema file is a "C" header file that uses special macros defined by the file "SchemaDef.h" 2. The system schema file (for uxtheme.dll and comctl32.dll) is named "TmSchema.h". 3. Purpose: the schema file defines a common set of enums, properties, class parts, and class states to be shared between the Theme Manager drawing/info routines, the theme authoring file, and the theme-aware controls 4. File layout: a. file start - the first part of the file contains some fixed information: //----------------------------------------------------------------- #if (defined(SCHEMA_STRINGS)) || (! defined(TMSCHEMA_H)) //----------------------------------------------------------------- #define TMSCHEMA_H //----------------------------------------------------------------- #include "SchemaDef.h" //----------------------------------------------------------------- #define THEMEMGR_VERSION 1 // increment if order of props changes or // any props are deleted (will prevent loading // of controlsets that use older version //----------------------------------------------------------------- BEGIN_TM_SCHEMA(xxx) (where "xxx" is the schema name) b. enums section - this section contains one or more enum definitions - each enum definition defines an enum name and a set of named values - example: BEGIN_TM_ENUM(BGTYPE) TM_ENUM(BT, IMAGEFILE) TM_ENUM(BT, BORDERFILL) TM_ENUM(BT, NTLFILE) END_TM_ENUM() The above example declares an enum called "BGTYPE". It has 3 named values: IMAGEFILE (value=0), BORDERFILL (value=1), and NTLFILE (value=2) c. properties section - this section defines a set of properties based on the primitive property types or a previously declared enum - section starts with the line: BEGIN_TM_PROPS() - section ends with the line: END_TM_PROPS() - example property: TM_PROP(TMT, BORDERSIZE, INT) (declares a "BorderSize" property of type "int") - example property: TM_PROP(TMT, BGTYPE, ENUM) (declares a "BgType" property of type enum) d. parts/states section - this section contains one or more parts/states declarations - example: BEGIN_TM_CLASS_PARTS(BUTTON) TM_PART(BP, PUSHBUTTON) TM_PART(BP, RADIOBUTTON) TM_PART(BP, CHECKBOX) TM_PART(BP, GROUPBOX) TM_PART(BP, USERBUTTON) END_TM_CLASS_PARTS() (the above defines a class called "button" that has the 5 specified parts) - example: BEGIN_TM_PART_STATES(PUSHBUTTON) TM_STATE(PBS, NORMAL) TM_STATE(PBS, HOT) TM_STATE(PBS, PRESSED) TM_STATE(PBS, DISABLED) TM_STATE(PBS, DEFAULTED) END_TM_PART_STATES() (the above defines a part called "pushbutton" that has the 5 specified states) e. file ending - this section should look like: END_TM_SCHEMA(xxx) //--------------------------------------------------------------------------- #endif // TMSCHEMA_H //--------------------------------------------------------------------------- (where "xxx" is the schema name) 5. The system schema file (TmSchema.h) is compiled into: - uxtheme.dll (theme manager code) - comctl32.dll (common controls code) - packthem.exe (theme packaging utility) - 6. custom controls can define their own schema file that extend the system schema. This schema file should be compiled into the control's DLL and the DLL should be registered as "Path" values under the registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ThemeManager\CustomControls example: Path = "c:\program files\acme\keypad.dll" 7. during theme packaging, the "packthem.exe" will attempt to call each registered DLL to get its schema info. This call is automatically implemented when the schema file is built using the format described in this document. 8. uxtheme.dll will also load registered control DLL's for the schema during every theme load