Public Types | Public Member Functions

IColorManager Class Reference

This reference page is linked to from the following overview topics: Icons.


Search for all occurrences

Detailed Description

See also:
Class FPStaticInterface Class Point3, COLORREF, Standard Color IDs, Generate a Class_ID, Class GUP, Getting and Setting User Preferences.

Description:
This class is available in release 4.0 and later only.

This class is an interface to the Color Manager. Within 3ds Max using the Customize pull down menu / Customize User Interface choice / Colors tab a user is able to alter the colors used for various UI elements. They can change the saturation, value and transparency of elements, and load and save color schemes.

Using the methods of this class developers can do the same (the 3ds Max color manager uses this class internally). Developers can add their own named custom colors. Developers wanting to do this need to pick a random 32-bit ColorId to identify it. (Note: typedef DWORD ColorId;). The Class_ID generator may be used for this where only one of the two DWORDS is used. See Class Class_ID for more details. The low integer ColorIds are reserved for 3ds Max internal use. These colors should be registered on startup, so a Global Utility Plug-In (GUP) is the best way to handle this. See Class GUP for details. Methods that are marked as internal should not be used.

#include <icolorman.h>

Inheritance diagram for IColorManager:
Inheritance graph
[legend]

List of all members.

Public Types

enum   ColorSchemeType { CST_CUSTOM = 0, CST_STANDARDWINDOWS, CST_WINDOWSTHEME }
enum   AppFrameColorTheme { kDarkTheme = 0, kLightTheme = 1 }
enum   IconType { kDisabledIcon, kEnabledIcon }
enum   IconColorScale {
  kSaturationScale, kValueScale, kAlphaScale, kContrastScale,
  kGradientMapScale
}
enum   RepaintType { kRepaintAll, kRepaintTrackBar, kRepaintTimeBar }
enum   {
  registerColor, loadColorFile, saveColorFile, getColorFile,
  setColor, getColor, getName, getCategory,
  getIconColorScale, setIconColorScale, getIconColorInvert, setIconColorInvert,
  getFileName, getDefaultColor, getOldUIColorCOLORREF, repaintUI,
  setIconFolder, reInitIcons, getIconFolder, resolveIconFolder,
  getColorSchemeType, setColorSchemeType
}
enum   { iconType, iconColorScale, repaintType, colorSchemeType }

Public Member Functions

virtual ColorSchemeType  GetColorSchemeType ()=0
virtual void  SetColorSchemeType (ColorSchemeType type)=0
virtual bool  RegisterColor (ColorId id, const MCHAR *pName, const MCHAR *pCategory, COLORREF defaultValue)=0
virtual BOOL  LoadColorFile (const MCHAR *pFileName)=0
virtual BOOL  SaveColorFile (const MCHAR *pFileName)=0
virtual const MCHAR *  GetColorFile ()=0
virtual bool  SetColor (ColorId id, COLORREF color)=0
virtual COLORREF  GetColor (ColorId id)=0
virtual Point3  GetColorAsPoint3 (ColorId id)=0
virtual HBRUSH  GetBrush (ColorId id)=0
virtual const MCHAR *  GetName (ColorId id)=0
virtual const MCHAR *  GetCategory (ColorId id)=0
virtual COLORREF  CustSysColor (int which)=0
virtual HBRUSH  CustSysColorBrush (int which)=0
virtual Point3  GetOldUIColor (int which)=0
virtual void  SetOldUIColor (int which, Point3 *clr)=0
virtual Point3  GetOldDefaultUIColor (int which)=0
virtual float  GetIconColorScale (IconType type, IconColorScale which)=0
virtual void  SetIconColorScale (IconType type, IconColorScale which, float value)=0
virtual bool  GetIconColorInvert (IconType type)=0
virtual void  SetIconColorInvert (IconType type, bool value)=0
virtual AppFrameColorTheme  GetAppFrameColorTheme () const =0
virtual void  SetAppFrameColorTheme (AppFrameColorTheme value)=0
virtual const MCHAR *  GetFileName ()=0
virtual COLORREF  GetDefaultColor (ColorId id)=0
virtual COLORREF  GetOldUIColorCOLORREF (int which)=0
virtual void  RepaintUI (RepaintType type)=0
virtual BOOL  SetIconFolder (const MCHAR *pFolder)=0
virtual const MCHAR *  GetIconFolder ()=0
virtual void  ReInitIcons ()=0
virtual BOOL  ResolveIconFolder (const MCHAR *pFilename, MSTR &path)=0

Member Enumeration Documentation

Enumerator:
CST_CUSTOM 

Customized color scheme.

CST_STANDARDWINDOWS 

Standard windows color scheme.

CST_WINDOWSTHEME 

Windows theme color scheme.

Enumerator:
kDarkTheme 

Dark theme.

kLightTheme 

Light theme.

                            {
        kDarkTheme  = 0,
        kLightTheme = 1
    };
enum IconType
anonymous enum
Enumerator:
registerColor 
loadColorFile 
saveColorFile 
getColorFile 
setColor 
getColor 
getName 
getCategory 
getIconColorScale 
setIconColorScale 
getIconColorInvert 
setIconColorInvert 
getFileName 
getDefaultColor 
getOldUIColorCOLORREF 
repaintUI 
setIconFolder 
reInitIcons 
getIconFolder 
resolveIconFolder 
getColorSchemeType 
setColorSchemeType 
         {
#ifndef NO_CUI  // russom - 02/12/02
        registerColor,
        loadColorFile,
        saveColorFile,
        getColorFile,
        setColor,
#endif // NO_CUI
        getColor,
        getName,
        getCategory,
        getIconColorScale,
#ifndef NO_CUI  // russom - 02/20/02
        setIconColorScale,
#endif
        getIconColorInvert,
#ifndef NO_CUI  // russom - 02/20/02
        setIconColorInvert,
#endif
        getFileName,
        getDefaultColor,
        getOldUIColorCOLORREF,
        repaintUI,
#ifndef NO_CUI  // russom - 02/20/02
        setIconFolder,
        reInitIcons,
#endif
        getIconFolder,
#ifdef USE_NEW_CUI_IO_METHODS
        saveIconFile,
 #ifndef NO_CUI // russom - 02/25/02
        loadIconFile,
        readIconFile,
 #endif // NO_CUI
#endif // USE_NEW_CUI_IO_METHODS
        resolveIconFolder,
        getColorSchemeType,
        setColorSchemeType
    };
anonymous enum

Member Function Documentation

virtual ColorSchemeType GetColorSchemeType ( ) [pure virtual]
Remarks:
Returns CST_CUSTOM if use the customized color scheme, or CST_STANDARDWINDOWS if use the Windows standard color scheme, or CST_WINDOWSTHEME if let Windows theme to control the color scheme.
virtual void SetColorSchemeType ( ColorSchemeType  type ) [pure virtual]
Remarks:
Sets which color scheme are used. This allows the developer to tell the system to use custom colors, standard Windows colors, and Windows theme.
Parameters:
ColorSchemeType type

Pass CST_CUSTOM to use the customized color scheme. Pass CST_STANDARDWINDOWS to use the Windows standard color scheme. Pass CST_WINDOWSTHEME to let Windows theme to control the color scheme
virtual bool RegisterColor ( ColorId  id,
const MCHAR *  pName,
const MCHAR *  pCategory,
COLORREF  defaultValue 
) [pure virtual]
Remarks:
This method registers a new color with the system. For plug-in developers this should be done at startup using a Global Utility Plug-in which calls this method. See the Description section above for details. If developers want to add a color of their own, they need to pick a random 32-bit integer ColorId to identify it.
Parameters:
ColorId id

The ID of the color to register. This should be generated by the developer using a single DWORD from the output of the Class_ID program. See Class Class_ID for more details.

MCHAR* pName

The name for the color.

MCHAR* pCategory

The category for the color. If the name passed matches one of the existing 3ds Max categories the color will be place in there, otherwise a new one will be created.

COLORREF defaultValue

The default value for the color. This is the value that the color will be reset to when a 3ds Max user presses "Reset" in the color customization dialog. See COLORREF.
Returns:
Returns false if the color is already registered; otherwise true.
virtual BOOL LoadColorFile ( const MCHAR *  pFileName ) [pure virtual]
Remarks:
This method will load the specified color file from the current UI directory.
Parameters:
MCHAR* pFileName

The filename of the color file to load.
Returns:
TRUE if the load was successful, otherwise FALSE.
virtual BOOL SaveColorFile ( const MCHAR *  pFileName ) [pure virtual]
Remarks:
This method will save the specified color file from the current UI directory.
Parameters:
MCHAR* pFileName

The filename of the color file to save.
Returns:
TRUE if the save process was successful, otherwise FALSE.
virtual const MCHAR* GetColorFile ( ) [pure virtual]
Remarks:
This method returns the file name of the current color file.
virtual bool SetColor ( ColorId  id,
COLORREF  color 
) [pure virtual]
Remarks:
Sets the color value of the previously registered color whose ID is passed.
Parameters:
ColorId id

Specifies which color to set.

COLORREF color

The color value to set. See COLORREF.
Returns:
Returns true if the color was set and false if the id passed could not be found.
virtual COLORREF GetColor ( ColorId  id ) [pure virtual]
Remarks:
Returns the color value of the color whose ID is passed.
Parameters:
ColorId id

Specifies which color to get.
Returns:
The color is returned or black (RGB(0,0,0)) if the ColorId passed was not found.
virtual Point3 GetColorAsPoint3 ( ColorId  id ) [pure virtual]
Remarks:
This method returns the color associated with a specified color ID as a Point3.
Parameters:
ColorId id

The ID of the color you wish to get.
virtual HBRUSH GetBrush ( ColorId  id ) [pure virtual]
Remarks:
Returns a handle to the brush for the color whose id is specified. NULL is returned if the id passed is not found. Note that the color manager does resource management for brushes, so the value returned should not be deleted.
Parameters:
ColorId id

The color whose brush handle is returned.
virtual const MCHAR* GetName ( ColorId  id ) [pure virtual]
Remarks:
Returns the name of the color whose ID is passed.
Parameters:
ColorId id

The ID of the color.
virtual const MCHAR* GetCategory ( ColorId  id ) [pure virtual]
Remarks:
Returns the category string of the color whose ID is passed.
Parameters:
ColorId id

The ID of the color.
virtual COLORREF CustSysColor ( int  which ) [pure virtual]
Remarks:
This method takes the specified windows color definition (for example COLOR_BTNHILIGHT) and returns the 3ds Max customized version of that color. Anyone writing a plug-in with custom windows code should use this call (and CustSysColorBrush() below) instead of the Win32 GetSysColor() and GetSysColorBrush() if they want to participate in the 3ds Max custom color scheme.

Note the following #define which may be used to simplify coding:

#define GetCustSysColor(which) (ColorMan()->CustSysColor(which))
Parameters:
int which

Specifies the windows color definition. See Standard Color IDs. For a full list of windows color definitions, please refer to the Win32 API, in particular the methods GetSysColor() and SetSysColor().
virtual HBRUSH CustSysColorBrush ( int  which ) [pure virtual]
Remarks:
This method returns a handle identifying a logical brush that corresponds to the specified color index. Note that the color manager does resource management for brushes, so the value returned should not be deleted.
Parameters:
int which

Specifies the windows color definition. See Standard Color IDs. For a full list of windows color definitions, please refer to the Win32 API, in particular the methods GetSysColor() and SetSysColor().

Note the following #define which may be used to simplify coding a bit:

#define GetCustSysColorBrush(which) (ColorMan()->CustSysColorBrush(which))
virtual Point3 GetOldUIColor ( int  which ) [pure virtual]
Remarks:
Returns the specified color value for drawing various items in the viewports. This is the same as the previous GetUIColor() function.
Parameters:
int which

Specifies which color to retrieve. See Viewport Drawing Color Indices.
Returns:
The color as a Point3.
virtual void SetOldUIColor ( int  which,
Point3 clr 
) [pure virtual]
Remarks:
Sets the specified color value for drawing various items in the viewports. This is the same as the previous SetUIColor() function.
Parameters:
int which

Specifies which color to retrieve. See Viewport Drawing Color Indices.

Point3 *clr

Points to the color value to set.
virtual Point3 GetOldDefaultUIColor ( int  which ) [pure virtual]
Remarks:
Returns the default color used for drawing various items in the 3ds Max user interface. The values returned are not affected by the user's color selections or those set by SetUIColor(). This is the same as the previous GetDefaultUIColor() function.
Parameters:
int which

Specifies which color to retrieve. See Viewport Drawing Color Indices.
virtual float GetIconColorScale ( IconType  type,
IconColorScale  which 
) [pure virtual]
Remarks:
Returns a floating point value (in the range 0.0f to 1.0f) that is one of the scale factors applied to the specified icon type. These scale values used to do image processing on the icons at start-up time.
Parameters:
IconType type

The icon type. One of the following values:

kDisabledIcon

The disabled icons.

kEnabledIcon

The enabled icons.

IconColorScale which

The icon color scale. One of the following values:

kSaturationScale

The saturation scale.

kValueScale

The value scale.

kAlphaScale

The alpha scale. kContrastScale

The contrast scale. kGradientMapScale

The gradient map scale.
virtual void SetIconColorScale ( IconType  type,
IconColorScale  which,
float  value 
) [pure virtual]
Remarks:
Sets the specified scale factor for the icon type passed. The color manager maintains the values for the 3ds Max icon image processing system. Developers can set values to scale the saturation, value and transparency for enabled and disabled icon images using this method.
Parameters:
IconType type

The icon type. One of the following values:

kDisabledIcon

The disabled icons.

kEnabledIcon

The enabled icons.

IconColorScale which

The icon color scale. One of the following values:

kSaturationScale

The saturation scale.

kValueScale

The value scale.

kAlphaScale

The alpha scale.

float value

The value to set (in the range 0.0f to 1.0f).
virtual bool GetIconColorInvert ( IconType  type ) [pure virtual]
Remarks:
Returns true if the invert flag is set for the specified icon type and false if not set.
Parameters:
IconType type

The icon type. One of the following values:

kDisabledIcon

The disabled icons.

kEnabledIcon

The enabled icons.
virtual void SetIconColorInvert ( IconType  type,
bool  value 
) [pure virtual]
Remarks:
Sets the invert flag for the specified icon type to on or off.
Parameters:
IconType type

The icon type. One of the following values:

kDisabledIcon

The disabled icons.

kEnabledIcon

The enabled icons.

bool value

Pass true for inverted; false for not inverted.
virtual AppFrameColorTheme GetAppFrameColorTheme ( ) const [pure virtual]
Remarks:
Returns the current color theme.

virtual void SetAppFrameColorTheme ( AppFrameColorTheme  value ) [pure virtual]
Remarks:
Sets the current color theme.
Parameters:
AppFrameColorTheme value

The value of color theme to be set.

virtual const MCHAR* GetFileName ( ) [pure virtual]
Remarks:
Returns the file name of the currently loaded color file.
virtual COLORREF GetDefaultColor ( ColorId  id ) [pure virtual]
Remarks:
Returns the default color for the specified ID. The default color is the value passed as defaultValue in RegisterColor(), regardless if a SetColor() has been done subsequently. This is used by the UI when the user presses "Reset" to reset a color to its default value.
Parameters:
ColorId id

The ID of the color.
virtual COLORREF GetOldUIColorCOLORREF ( int  which ) [pure virtual]
Remarks:
This method returns the color associated with a user interface color as a COLORREF.
Parameters:
int which

The UI color index (see gfx.h).
Remarks:
Returns the specified color value for drawing various items in the viewports as a COLORREF.
Parameters:
int which

Specifies which color to retrieve. See Viewport Drawing Color Indices.
virtual void RepaintUI ( RepaintType  type ) [pure virtual]
Remarks:
This method allows you to issue a repaint of the user interface.
Parameters:
RepaintType type

The type of repaint you wish to issue; kRepaintAll, kRepaintTrackBar, kRepaintTimeBar.
virtual BOOL SetIconFolder ( const MCHAR *  pFolder ) [pure virtual]
Remarks:
This method takes the name of a folder that must be in 3ds Max "UI" folder. If the folder exists, then it sets 3ds Max icon folder to point to it, and redraws the UI with those new icons.Warning: All of the 3ds Max standard icon BMP files must exist in that folder. If any of the standard files are missing, icons will appear blank in the UI. All the icons files needed live in the UI/icons folder, which is the default icon folder.
Parameters:
MCHAR* pFolder

The icon folder to set.
virtual const MCHAR* GetIconFolder ( ) [pure virtual]
virtual void ReInitIcons ( ) [pure virtual]
virtual BOOL ResolveIconFolder ( const MCHAR *  pFilename,
MSTR path 
) [pure virtual]

IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager
IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager IColorManager