Ejemplo n.º 1
0
void CToolBarCtrlEx::ChangeTextLabelStyle(EToolbarLabelType eLabelType, bool bRefresh, bool bForceUpdateButtons)
{
	
	if(m_eLabelType == eLabelType && !bForceUpdateButtons)
	{
		return;
	}
	switch (eLabelType)
	{
	case NoLabels:
		SetStyle(GetStyle() & ~TBSTYLE_LIST);
		SetMaxTextRows(0);
		break;
	case LabelsBelow:
		SetStyle(GetStyle() & ~TBSTYLE_LIST);

		SetMaxTextRows(1);
		break;
	case LabelsRight:
		SetStyle(GetStyle() | TBSTYLE_LIST);
		SetMaxTextRows(1);
		break;
	}
	m_eLabelType = eLabelType;	
	
	if (bRefresh)
		Refresh();
}
Ejemplo n.º 2
0
void CToolBarCtrlX::RecalcLayout()
{
	// Force a recalc of the toolbar's layout to work around a comctl bug
	int iTextRows = GetMaxTextRows();
	SetRedraw(FALSE);
	SetMaxTextRows(iTextRows+1);
	SetMaxTextRows(iTextRows);
	SetRedraw(TRUE);
}
Ejemplo n.º 3
0
void CMuleToolbarCtrl::ChangeTextLabelStyle(EToolbarLabelType eLabelType, bool bRefresh, bool bForceUpdateButtons)
{
	if (m_eLabelType != eLabelType || bForceUpdateButtons)
	{
		switch (eLabelType)
		{
			case NoLabels:
				SetStyle(GetStyle() & ~TBSTYLE_LIST);
				SetMaxTextRows(0);
				break;
			case LabelsBelow:
				SetStyle(GetStyle() & ~TBSTYLE_LIST);
				SetMaxTextRows(1);
				break;
			case LabelsRight:
				SetStyle(GetStyle() | TBSTYLE_LIST);
				SetMaxTextRows(1);
				break;
		}

		for (int i = 0; i < m_buttoncount; i++)
		{	
			TBBUTTONINFO tbbi = {0};
			tbbi.cbSize = sizeof(tbbi);
			tbbi.dwMask = TBIF_STYLE;
			GetButtonInfo(IDC_TOOLBARBUTTON + i, &tbbi);
			if (eLabelType == LabelsRight)
				tbbi.fsStyle |= TBSTYLE_AUTOSIZE;
			else
				tbbi.fsStyle &= ~TBSTYLE_AUTOSIZE;
			SetButtonInfo(IDC_TOOLBARBUTTON + i, &tbbi);
		}

		m_eLabelType = eLabelType;
		if (bRefresh)
			Refresh();
	}
}