Detailed Description
- See also:
- Class ICustomControl, Custom Controls, Class
ICustToolbar,
Class FlyOffData,
Class DADMgr, Class
MAXBmpFileIcon.
- Description:
- Custom buttons may be one of two different forms. A Check
button (which stays pressed in until the user clicks on it again),
or a Pick button (which pops back out as soon as it is released).
Buttons may be implemented as a Fly offs. A fly off offers several
alternative buttons which fly out from the button after it is press
and held briefly.
The buttons may contain text or graphic images. Fly off buttons
only use graphic images. The plug-in developer has control over the
appearance of the button in each of its four states
(Enabled&Out, Enabled&In, Disabled&Out,
Disabled&In).
Note: When the user presses a button a WM_MENUSELECT message
is sent so that the client can display a status prompt describing
the function of the tool. The fuFlags parameter is set to
this value: CMF_TOOLBUTTON.
In 3dsmax version 4.0 you can remove borders from an ICustButton;
ICustButton
*cb = ();
cb->Execute(I_EXE_CB_NO_BORDER);
To initialize the pointer to the control call:
ICustButton
*GetICustButton(HWND hCtrl);
To release the control call:
ReleaseICustButton(ICustButton *ics);
The value to use in the Class field of the Custom Control Properties dialog is:
CustButton
#include <custcont.h>
List of all
members.
Public Member Functions
|
virtual
void |
GetText
(MCHAR *text, int ct)=0 |
virtual
void |
SetText
(const MCHAR *text)=0 |
virtual
void |
GetText
(MSTR &text) const
=0 |
virtual
int |
GetTextLength
() const =0 |
virtual
void |
SetImage
(HIMAGELIST hImage, int iOutEn, int iInEn, int iOutDis, int iInDis,
int w, int h)=0 |
virtual
void |
SetIcon
(MaxBmpFileIcon *pIcon, int w,
int h)=0 |
virtual
void |
SetInIcon
(MaxBmpFileIcon *pInIcon, int w,
int h)=0 |
virtual
void |
SetType
(CustButType type)=0 |
virtual
void |
SetFlyOff
(int count, FlyOffData *data, int timeOut, int
init, int dir=FLY_VARIABLE, int columns=1)=0 |
virtual
void |
SetCurFlyOff
(int f, BOOL notify=FALSE)=0 |
virtual
int |
GetCurFlyOff
()=0 |
virtual
BOOL |
IsChecked
()=0 |
virtual
void |
SetCheck
(BOOL checked)=0 |
virtual
void |
SetCheckHighlight
(BOOL highlight)=0 |
virtual
void |
SetButtonDownNotify
(BOOL notify)=0 |
virtual
void |
SetRightClickNotify
(BOOL notify)=0 |
virtual
void |
SetHighlightColor
(COLORREF clr)=0 |
virtual
COLORREF |
GetHighlightColor
()=0 |
virtual
void |
SetDADMgr
(DADMgr *dad)=0 |
virtual
DADMgr * |
GetDADMgr
()=0 |
virtual
void |
SetMacroButtonData
(MacroButtonData *md)=0 |
virtual
MacroButtonData * |
GetMacroButtonData
()=0 |
virtual
void |
SetDisplayProc
(PaintProc *proc)=0 |
virtual const
MCHAR * |
GetCaptionText
(void)=0 |
virtual
bool |
SetCaptionText
(const MCHAR *text)=0 |
Member Function Documentation
virtual void GetText |
( |
MCHAR * |
text, |
|
|
int |
ct |
|
) |
|
[pure virtual] |
- Parameters:
-
text |
Storage for the text to retrieve. |
ct |
Specifies the maximum length of the string returned. |
virtual void SetText |
( |
const MCHAR * |
text |
) |
[pure virtual] |
- Parameters:
-
text |
The text to be displayed by the button. |
virtual void GetText |
( |
MSTR & |
text |
) |
const [pure virtual] |
- Parameters:
-
text |
Storage for the text to retrieve. |
virtual int GetTextLength |
( |
|
) |
const [pure virtual] |
virtual void SetImage |
( |
HIMAGELIST |
hImage, |
|
|
int |
iOutEn, |
|
|
int |
iInEn, |
|
|
int |
iOutDis, |
|
|
int |
iInDis, |
|
|
int |
w, |
|
|
int |
h |
|
) |
|
[pure virtual] |
- Parameters:
-
hImage |
The image list. An image list is a collection of same-sized
images, each of which can be referred to by an index. Image lists
are used to efficiently manage large sets of icons or bitmaps in
Windows. All images in an image list are contained in a single,
wide bitmap in screen device format. An image list may also include
a monochrome bitmap that contains masks used to draw images
transparently (icon style). The Windows API provides image list
functions, which enable you to draw images, create and destroy
image lists, add and remove images, replace images, and merge
images.
The next four parameters (iOutEn, iInEn, iOutDis, iInDis)
are indices into the image list. They indicate which images to use
for each of the four possible button states. You may specify a
unique image for each one of these states by passing a different
index for each state. Or you may supply a single image to be used
for all the states by specifying the same index four times. |
iOutEn |
Out&Enabled. |
iInEn |
In&Enabled. |
iOutDis |
Out&Disabled. |
iInDis |
In&Disabled. |
w |
The width of the button image. |
h |
The height of the button image. |
virtual void SetIcon |
( |
MaxBmpFileIcon * |
pIcon, |
|
|
int |
w, |
|
|
int |
h |
|
) |
|
[pure virtual] |
- Parameters:
-
pIcon |
Points to the icon. |
w |
The width of the button image. |
h |
The height of the button image. |
virtual void SetInIcon |
( |
MaxBmpFileIcon * |
pInIcon, |
|
|
int |
w, |
|
|
int |
h |
|
) |
|
[pure virtual] |
- Parameters:
-
pInIcon |
Points to the icon. |
w |
The width of the button image. |
h |
The height of the button image. |
virtual void SetType |
( |
CustButType |
type |
) |
[pure virtual] |
- Parameters:
-
type |
One of the following values:
CBT_PUSH
A Push button pops back out as soon as it is released.
CBT_CHECK.
A Check button stays pressed in until the user clicks on it
again. |
virtual void SetFlyOff |
( |
int |
count, |
|
|
FlyOffData * |
data, |
|
|
int |
timeOut, |
|
|
int |
init, |
|
|
int |
dir =
FLY_VARIABLE , |
|
|
int |
columns = 1 |
|
) |
|
[pure virtual] |
- Parameters:
-
count |
The number of buttons in the fly off. |
data |
An array of instances of the class FlyOffData . This class uses four
indices into the image list to describe the button in each of the
possible states: Out&Enabled, In&Enabled, Out&Disabled
and In&Disabled.
In the simple case, where all the buttons have the same image, you
can do the following:
FlyOffData fod[3] = {
{ 0,0,0,0 },
{ 1,1,1,1 },
{ 2,2,2,2 },
};
Each button will use the same images regardless of its pressed
in / disabled state. Note the button is automatically drawn pushed
in (i.e. shaded lighter) when the user is dragging the cursor over
the button, but the actual image on the button is not
changed.
If you require different images for these states, supply different
indices into the image list for each. See the sample program
/MAXSDK/SAMPLES/HOWTO/CUSTCTRL/CUSTCTRL.CPP for an example
of how this is done.
|
timeOut |
This is the time in milliseconds the button must be held
pressed before the fly off appears. You may specify 0 if you want
the buttons to fly off immediately. To retrieve the value that 3ds
Max uses internally for its flyoffs use a method of Class Interface called
GetFlyOffTime(). This returns a value in milliseconds. |
init |
This is the initial button displayed. |
dir |
This parameter is optional. It is used to indicate which
direction the buttons should fly off. The choices for direction
are:
FLY_VARIABLE
The default. The system will determine the direction of the fly
off.
FLY_UP
The buttons fly off above.
FLY_DOWN
The buttons fly off beneath.
FLY_HVARIABLE
The buttons will fly off either left or right with the system
determining the direction.
FLY_LEFT
The buttons fly off to the left.
FLY_RIGHT
The buttons fly off to the right. |
columns |
|
virtual void SetCurFlyOff |
( |
int |
f, |
|
|
BOOL |
notify =
FALSE |
|
) |
|
[pure virtual] |
- Parameters:
-
f |
The index of the flyoff button to display. |
notify |
This indicates if the call to this method should notify the
dialog proc. If TRUE it is notified; otherwise it isn't. |
virtual int GetCurFlyOff |
( |
|
) |
[pure virtual] |
virtual BOOL IsChecked |
( |
|
) |
[pure virtual] |
virtual void SetCheck |
( |
BOOL |
checked |
) |
[pure virtual] |
- Parameters:
-
checked |
If TRUE the button is set to the checked state; if FALSE the
button is unchecked. |
virtual void SetCheckHighlight |
( |
BOOL |
highlight |
) |
[pure virtual] |
- Parameters:
-
highlight |
TRUE if you want the button to use the highlight color;
otherwise pass FALSE. |
virtual void SetButtonDownNotify |
( |
BOOL |
notify |
) |
[pure virtual] |
- Parameters:
-
notify |
TRUE if notification should be send by the button; FALSE if
notifications should not be sent. |
virtual void SetRightClickNotify |
( |
BOOL |
notify |
) |
[pure virtual] |
- Parameters:
-
notify |
If TRUE, the BN_RIGHTCLICK message is sent whenever the
users right clicks on the button. If FALSE no message are sent on
right clicks. |
virtual void SetHighlightColor |
( |
COLORREF |
clr |
) |
[pure virtual] |
- Parameters:
-
clr |
The color for the button. It may be specified using the RGB
macro, for example:
SetHighlightColor(RGB(0,0,255));
There are several pre-defined colors which may be used:
RED_WASH, BLUE_WASH and GREEN_WASH. GREEN_WASH is the
standard color used for check buttons in 3ds Max that instigate a
command mode. While the command mode is active, the button should
be displayed in GREEN_WASH. When the mode is finished the
button should be returned to normal. |
virtual COLORREF GetHighlightColor |
( |
|
) |
[pure virtual] |
virtual void SetDADMgr |
( |
DADMgr * |
dad |
) |
[pure virtual] |
- Parameters:
-
dad |
A pointer to the drag and drop manager to set. |
virtual DADMgr* GetDADMgr |
( |
|
) |
[pure virtual] |
virtual void SetDisplayProc |
( |
PaintProc * |
proc |
) |
[pure virtual] |
- Parameters:
-
proc |
Points to the callback object for displaying the button.
Note: typedef LRESULT CALLBACK PaintProc(HDC hdc, Rect rect,
BOOL in, BOOL checked, BOOL enabled); |
virtual const MCHAR* GetCaptionText |
( |
void |
|
) |
[pure virtual] |
virtual bool SetCaptionText |
( |
const MCHAR * |
text |
) |
[pure virtual] |
ICustButton ICustButton ICustButton
ICustButton ICustButton ICustButton ICustButton ICustButton
ICustButton ICustButton
ICustButton ICustButton ICustButton
ICustButton ICustButton ICustButton ICustButton ICustButton
ICustButton ICustButton