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(); }
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); }
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(); } }