ICustToolbar Class Reference

#include <custcont.h>

Class Description

See also
Custom User Interface Controls. Class ToolItem, Class MacroButtonData, Class ICustStatusEdit, Class ICustStatus, Class ICustButton.

Description:
This control allows the creation of toolbars containing buttons (push, check, and fly-offs), status fields, separators (spacers), and other Windows or user defined controls.

\ The standard size for 3ds Max toolbar button icons is 16x15 or 16x16 pixels.

In 3ds Max 3.0 and later toolbars may have multiple rows, or appear vertically. They may also have macro buttons (added with the MacroButtonData class) which may have icons or text.

toolbar.gif
To initialize the pointer to the control call:
ICustToolbar *GetICustToolbar(HWND hCtrl);
To release the control call:
ReleaseICustToolbar(ICustToolbar *ict);
The value to use in the Class field of the Custom Control Properties dialog is: CustToolbar

Note: The TB_RIGHTCLICK message is sent when the user right clicks in open space on a toolbar:
Also Note: To add tooltips to the toolbar controls you can do so by capturing the WM_NOTIFY message in the dialog proc. For complete sample code see /MAXSDK/SAMPLES/HOWTO/CUSTCTRL/CUSTCTRL.CPP. The specific message is processed as shown below.
case WM_NOTIFY:
// This is where we provide the tooltip text for the
// toolbar buttons...
if(((LPNMHDR)lParam)->code == TTN_NEEDTEXT) {
LPTOOLTIPTEXT lpttt;
lpttt = (LPTOOLTIPTEXT)lParam;
switch (lpttt->hdr.idFrom) {
case ID_TB_1:
lpttt->lpszText = _M("Do Nothing Up");
break;
case ID_TB_2:
lpttt->lpszText = _M("Do Nothing Down");
break;
case ID_TB_3:
lpttt->lpszText = _M("Do Nothing Lock");
break;
case IDC_BUTTON1:
if (to->custCtrlButtonC->IsChecked())
lpttt->lpszText = _M("Button Checked");
else
lpttt->lpszText = _M("Button Un-Checked");
break;
};
}
break;
+ Inheritance diagram for ICustToolbar:

Public Member Functions

virtual void SetImage (HIMAGELIST hImage)=0
 
virtual void AddTool (ToolItem &entry, int pos=-1)=0
 
virtual void AddTool2 (ToolItem &entry, int pos=-1)=0
 
virtual void DeleteTools (int start, int num=-1)=0
 
virtual void SetBottomBorder (BOOL on)=0
 
virtual void SetTopBorder (BOOL on)=0
 
virtual int GetNeededWidth (int rows)=0
 
virtual void SetNumRows (int rows)=0
 
virtual ICustButtonGetICustButton (int id)=0
 
virtual ICustStatusGetICustStatus (int id)=0
 
virtual HWND GetItemHwnd (int id)=0
 
virtual int GetNumItems ()=0
 
virtual int GetItemID (int index)=0
 
virtual int FindItem (int id)=0
 
virtual void DeleteItemByID (int id)=0
 
virtual MaxSDK::QmaxDockingWinHostDelegateGetDockingDelegate ()=0
 
virtual void GetFloatingCUIFrameSize (SIZE *sz, int rows=1)=0
 
virtual ICustStatusEditGetICustStatusEdit (int id)=0
 
virtual void ResetIconImages ()=0
 
virtual void ResizeButtons (int buttonWidth, int buttonHeight, int iconWidth, int iconHeight)=0
 
- Public Member Functions inherited from ICustomControl
virtual HWND GetHwnd ()=0
 
virtual void Enable (BOOL onOff=TRUE)=0
 
virtual void Disable ()=0
 
virtual BOOL IsEnabled ()=0
 
virtual void Enable2 (BOOL onOff=TRUE)=0
 
virtual INT_PTR Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
 
virtual void SetTooltip (bool bEnable, const MCHAR *text)=0
 Sets a tooltip for the custom control. More...
 
CoreExport void UpdateEnableState (Animatable *anim, int subNum)
 Helper function to disable or enable this UI control based on whether the Animatable associated with it is keyframable or not (locked parameter or scripted parameters are not keyframable). More...
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Member Function Documentation

virtual void SetImage ( HIMAGELIST  hImage)
pure virtual
Remarks
This method establishes the image list used to display images in the toolbar.
Parameters:
HIMAGELIST 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.
virtual void AddTool ( ToolItem entry,
int  pos = -1 
)
pure virtual
Remarks
The developer calls this method once for each item in the toolbar. The items appear in the toolbar from left to right in the order that they were added using this method. (Note that this method adds tools to the custom toolbar and not the 3ds Max toolbar).
Parameters:
const ToolItem& entry

Describes the item to add to the toolbar.

int pos=-1

Controls where the added tool is inserted. The default of -1 indicates the control will be added at the right end of the toolbar.
virtual void AddTool2 ( ToolItem entry,
int  pos = -1 
)
pure virtual
Remarks
Currently this method is identical to the AddTool() method.
Parameters:
ToolItem& entry

Describes the item to add to the toolbar.

int pos=-1

Controls where the added tool is inserted. The default of -1 indicates the control will be added at the right end of the toolbar.
virtual void DeleteTools ( int  start,
int  num = -1 
)
pure virtual
Remarks
This method is used to delete tools from the toolbar.
Parameters:
int start

Specifies which tool is the first to be deleted.

int num=-1

Specifies the number of tools to delete. If this parameter is -1 (the default) it deletes 'start' through count-1 tools.
virtual void SetBottomBorder ( BOOL  on)
pure virtual
Remarks
Passing TRUE to this method draws a border beneath the toolbar. You can see the appearance of the bottom border in the sample toolbar shown above. If this is set to FALSE, the border is not drawn.
Parameters:
BOOL on

TRUE to draw the border; FALSE for no border.
virtual void SetTopBorder ( BOOL  on)
pure virtual
Remarks
Passing TRUE to this method draws a border above the toolbar. You can see the appearance of the top border in the sample toolbar shown above. If this is set to FALSE, the border is not drawn
Parameters:
BOOL on

TRUE to draw the border; FALSE for no border.
virtual int GetNeededWidth ( int  rows)
pure virtual
Remarks
Returns the width needed for specified number of rows.
Parameters:
int rows

The number of rows.
virtual void SetNumRows ( int  rows)
pure virtual
Remarks
Sets the number of rows that the toolbar may hold.
Parameters:
int rows

The number of rows to set.
virtual ICustButton* GetICustButton ( int  id)
pure virtual
Remarks
This method is used to return a pointer to one of the toolbar's buttons. Using this pointer you can call methods on the button. If you use this method, you must release the control after you are finished with it.
Parameters:
int id

Specifies the id of the toolbar button.
Returns
A pointer to one of the toolbar's buttons. If the button is not found it returns NULL. See Class ICustButton.
virtual ICustStatus* GetICustStatus ( int  id)
pure virtual
Remarks
This method is used to return a pointer to one of the toolbars status controls. Using this pointer you can call methods on the status control. If you use this method, you must release the control after you are finished with it.
Parameters:
int id

Specifies the id of the toolbar button.
Returns
A pointer to one of the toolbars status controls. See Class ICustStatus.
virtual HWND GetItemHwnd ( int  id)
pure virtual
Remarks
Returns the handle to the toolbar item whose ID is passed.
Parameters:
int id

Specifies the id of the toolbar button.
virtual int GetNumItems ( )
pure virtual
Remarks
Returns the number of items in the toolbar.
virtual int GetItemID ( int  index)
pure virtual
Remarks
Each item in the toolbar has an ID. When items are programatically added to the toolbar via Class ToolButtonItem an ID is passed to the ToolButtonItem constructor. This method returns the ID for the specified item in the toolbar.
Parameters:
int index

Specifies which toolbar item to return the id of. This is an index between 0 and GetNumItems()-1.
Returns
When the button is added using Class ToolButtonItem this is the id that is part of that structure. When the user operates a tool the dialog proc get a WM_COMMAND message and this is also the id in LOWORD(wParam).
virtual int FindItem ( int  id)
pure virtual
Remarks
Returns the index into the list of toolbar entries of the item whose id is passed.
Parameters:
int id

The id of the control to find.
virtual void DeleteItemByID ( int  id)
pure virtual
Remarks
Deletes the toolbar item whose id is passed.
Parameters:
int id

The id of the control to delete.
virtual MaxSDK::QmaxDockingWinHostDelegate* GetDockingDelegate ( )
pure virtual
virtual void GetFloatingCUIFrameSize ( SIZE *  sz,
int  rows = 1 
)
pure virtual
Remarks
Computes the required size of a floating CUI Frame which is linked to a toolbar. The values returned will be zero if the frame is not linked to a toolbar.
Parameters:
SIZE *sz

The computed size is returned here. sz.cx is the width, sz.cy is the height.

int rows=1

The number of rows for the toolbar used in the computation.
virtual ICustStatusEdit* GetICustStatusEdit ( int  id)
pure virtual
Remarks
This method is used to return a pointer to the custom status edit control whose id is passedIf you use this method, you must release the control after you are finished with it. See Class ICustStatusEdit.
Parameters:
int id

Specifies the id of the toolbar button.
virtual void ResetIconImages ( )
pure virtual
Remarks
This resets the icons in the toolbar. This tells all the buttons in this toolbar to delete their icon image cache. If a plug-in has created a toolbar with any MaxBmpFileIcons on it, it should register a callback for color changing, and call this method on the toolbar. See Structure NotifyInfo for registering the color change callback.
virtual void ResizeButtons ( int  buttonWidth,
int  buttonHeight,
int  iconWidth,
int  iconHeight 
)
pure virtual
Remarks
This method resizes all of the toolbar's buttons to follow the width and height specified.
Parameters
buttonWidthThe new width of the toolbar's buttons.
buttonHeightThe new height of the toolbar's buttons.
iconWidthThe new width of the button icons.
iconHeightThe new height of the button icons.