Public Member Functions

ICustToolbar Class Reference

This reference page is linked to from the following overview topics: Methods and Classes of Custom Controls.


Search for all occurrences

Detailed Description

See also:
Custom Controls. Class ToolItem, Class MacroButtonData, Class CUIFrameMsgHandler, 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;

#include <custcont.h>

Inheritance diagram for ICustToolbar:
Inheritance graph
[legend]

List of all members.

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 ICustButton GetICustButton (int id)=0
virtual ICustStatus GetICustStatus (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 void  LinkToCUIFrame (HWND hCUIFrame, CUIFrameMsgHandler *msgHandler)=0
virtual void  GetFloatingCUIFrameSize (SIZE *sz, int rows=1)=0
virtual ICustStatusEdit GetICustStatusEdit (int id)=0
virtual void  ResetIconImages ()=0

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 void LinkToCUIFrame ( HWND  hCUIFrame,
CUIFrameMsgHandler msgHandler 
) [pure virtual]
Remarks:
This method links this toolbar to the CUI frame whose window handle and message handler are passed.
Parameters:
HWND hCUIFrame

The window handle of the CUI frame to link this toolbar to.

CUIFrameMsgHandler *msgHandler

Points to the message handler for the CUI frame. See Class CUIFrameMsgHandler.
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.

ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar
ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar ICustToolbar