BOOL CDropDownButton::Init(bool bSingleDropDownBtn, bool bWholeDropDown)
{
	DeleteAllButtons();
	m_bSingleDropDownBtn = bSingleDropDownBtn;

	// If a toolbar control was created indirectly via a dialog resource one can not
	// add any buttons without setting an image list before. (?)
	// So, for this to work, we have to attach an image list to the toolbar control!
	// The image list can be empty, and it does not need to be used at all, but it has
	// to be attached.
	CImageList* piml = GetImageList();
	if (piml == NULL || piml->m_hImageList == NULL)
	{
		CImageList iml;
		iml.Create(16, 16, ILC_COLOR, 0, 0);
		SetImageList(&iml);
		iml.Detach();
	}
	if (m_bSingleDropDownBtn)
	{
		TBBUTTON atb[1] = {0};
		atb[0].iBitmap = -1;
		atb[0].idCommand = GetWindowLong(m_hWnd, GWL_ID);
		atb[0].fsState = TBSTATE_ENABLED;
		atb[0].fsStyle = m_bSingleDropDownBtn ? (bWholeDropDown ? BTNS_WHOLEDROPDOWN : BTNS_DROPDOWN) : BTNS_BUTTON;
		atb[0].iString = -1;
		VERIFY( AddButtons(1, atb) );

		ResizeToMaxWidth();
		SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
	}
	return TRUE;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : cellsize - 
//-----------------------------------------------------------------------------
void mxExpressionTray::SetCellSize( int cellsize )
{
	m_nSnapshotWidth = cellsize;
	m_nSnapshotHeight = cellsize + m_nDescriptionHeight;

	DeleteAllButtons();
	CreateButtons();

	redraw();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Output : mxExpressionTray::~mxExpressionTray
//-----------------------------------------------------------------------------
mxExpressionTray::~mxExpressionTray ( void )
{
	DeleteAllButtons();
	g_pExpressionTrayTool = NULL;
}
CButtonManager::~CButtonManager()
{
	DeleteAllButtons() ;
}