added support for the multiline button labels

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-04-09 22:25:57 +00:00
parent c8b34a16f7
commit 8292017ce0
2 changed files with 20 additions and 3 deletions

View File

@ -170,8 +170,8 @@ wxMSW:
- the separators are not seen behind the controls added to the toolbar any more
- wxLB_SORT style can be used with wxCheckListBox
- wxWindowDC and wxClientDC::GetSize() works correctly now
- Added wxTB_NODIVIDER and wxTB_NOALIGN so native toolbar can
be used in FL
- Added wxTB_NODIVIDER and wxTB_NOALIGN so native toolbar can be used in FL
- Multiline labels in buttons are now supoprted (simply use "\n" in the label)
wxGTK:

View File

@ -71,7 +71,24 @@ bool wxButton::Create(wxWindow *parent,
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
return FALSE;
return MSWCreateControl(_T("BUTTON"), label, pos, size, style);
WXDWORD exstyle;
WXDWORD msStyle = MSWGetStyle(style, &exstyle);
#ifdef __WIN32__
// if the label contains several lines we must explicitly tell the button
// about it or it wouldn't draw it correctly ("\n"s would just appear as
// black boxes)
//
// NB: we do it here and not in MSWGetStyle() because we need the label
// value and m_label is not set yet when MSWGetStyle() is called;
// besides changing BS_MULTILINE during run-time is pointless anyhow
if ( label.find(_T('\n')) != wxString::npos )
{
msStyle |= BS_MULTILINE;
}
#endif // __WIN32__
return MSWCreateControl(_T("BUTTON"), msStyle, pos, size, label, exstyle);
}
wxButton::~wxButton()