3ds Max C++ API Reference
Loading...
Searching...
No Matches
ColorPicker.h File Reference
#include "maxheap.h"
#include "CoreExport.h"
#include <WTypes.h>
#include "geom/acolor.h"
#include "Geom/ipoint2.h"
#include "baseinterface.h"
#include "strbasic.h"
#include "paramtype.h"

Classes

class  ColorPickerCallback
 This class provides methods that are called when using the color picker. More...
class  ColorPicker
 This class represents a modeless color picker and lets developers interact with it during its lifetime. More...
class  ColPick
 This is the base class for the creation of plug-in color selectors. More...
class  IColorPickerMgr
struct  IColorPickerMgr::UnderlyingColorData
 Structure used to exchange underlying color data between the color picker and the window under the mouse cursor when the user is using the eyedropper tool to sample underlying scene colors. More...

Macros

#define WM_ADD_COLOR   (WM_USER+2321)
 Sent by the color picker to add custom colors to object color palette.

Functions

CoreExport INT_PTR ModalColorPicker (HWND hwndOwner, AColor &color, ColorPicker::Flags flags, IPoint2 *pPos, ColorPickerCallback *callBack, const MCHAR *name, ColorContext context=ColorContext::COLOR_SPACE_CONTEXT_NONE)
 This function puts up the "modal" color picker dialog box.
CoreExport ColorPickerCreateColorPicker (HWND hwndOwner, const AColor &initColor, ColorPicker::Flags flags, IPoint2 *pPos, ColorPickerCallback *callback, const MCHAR *name, ColorContext context=ColorContext::COLOR_SPACE_CONTEXT_NONE, BOOL objClr=FALSE)
 Creates and shows the modeless color picker dialog.
CoreExport Color RGBtoHSV (Color rgb)
 Converts the specified color in the HSV (hue, saturation, value) format to the RGB (red, green, blue) format.
CoreExport Color HSVtoRGB (Color hsv)
 Converts the specified color in the HSV (hue, saturation, value) format to the RGB (red, green, blue) format.

Macro Definition Documentation

◆ WM_ADD_COLOR

#define WM_ADD_COLOR   (WM_USER+2321)

Sent by the color picker to add custom colors to object color palette.


wParam will have the display-referred color packed in DWORD.
lParam is a pointer to AColor holding the scene-referred color.

Function Documentation

◆ ModalColorPicker()

CoreExport INT_PTR ModalColorPicker ( HWND hwndOwner,
AColor & color,
ColorPicker::Flags flags,
IPoint2 * pPos,
ColorPickerCallback * callBack,
const MCHAR * name,
ColorContext context = ColorContext::COLOR_SPACE_CONTEXT_NONE )
extern

This function puts up the "modal" color picker dialog box.

This is a blocking call, that means the function won't return until the user closes the color picker.

Parameters
[in]hwndOwnerOwner (parent) window handle.
[in,out]colorReference to the color to be edited. Value of this parameter will be used as the initial color. When the function returns, it will contain the color selected by the user if the user pressed OK.
[in]flagsColorPicker::Flags values controlling the look and behavior of the color picker (e.g. alpha enabled/disabled)
[in,out]pPosPointer to the starting position of the upper left corner of the dialog window. This is set to the ending position when the user is done. If null, color picker will be displayed in the current mouse position.
[in]callBackCallback object whose procs are called when user interacts with the color picker. See Class ColorPickerCallback.
[in]nameThe name of color being edited to appear in the title bar.
[in]contextThe color context to be used by the color picker. see ColorContext for details.
Returns
Returns TRUE if the user exists the dialog with OK, otherwise returns FALSE.

◆ CreateColorPicker()

CoreExport ColorPicker * CreateColorPicker ( HWND hwndOwner,
const AColor & initColor,
ColorPicker::Flags flags,
IPoint2 * pPos,
ColorPickerCallback * callback,
const MCHAR * name,
ColorContext context = ColorContext::COLOR_SPACE_CONTEXT_NONE,
BOOL objClr = FALSE )

Creates and shows the modeless color picker dialog.

This picker remains open allowing interactive color updates through the supplied callback until it is closed by the user or programmatically via ColorPicker::Destroy(). Unlike ModalColorPicker(), this call returns immediately with a pointer to the live ColorPicker instance. The returned object is owned by the system. When the picker is closed ColorPickerCallback::BeingDestroyed() is invoked and any stored pointer to it must be cleared.

Parameters
[in]hwndOwnerOwner (parent) window handle.
[in]initColorValue of this parameter will be used as the initial color, which also becomes the reset color in the UI.
[in]flagsColorPicker::Flags values controlling the look and behavior of the color picker (e.g. alpha enabled/disabled)
[in,out]pPosPointer to the starting position of the upper left corner of the dialog window. This is set to the ending position when the user is done. If null, color picker will be displayed in the current mouse position.
[in]callbackCallback object whose functions are called when user interacts with the color picker. See Class ColorPickerCallback.
[in]nameThe name of color being edited to appear in the title bar.
[in]contextThe color context to be used by the color picker. see ColorContext for details.
[in]objClrif TRUE, object color picker variant is created with "Add %Color" button.
Returns
Pointer to the modeless ColorPicker. May become dangling after ColorPickerCallback::BeingDestroyed() is called; do not delete it.