]> git.saurik.com Git - wxWidgets.git/commitdiff
added support for the multiline button labels
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 9 Apr 2002 22:25:57 +0000 (22:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 9 Apr 2002 22:25:57 +0000 (22:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/button.cpp

index 8ae00ccaa91562145d509e13f44ceccd9d596d43..be561d78ff2fb050013dcd8e28cd43525a7d3dc1 100644 (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:
 
index 5cb83273d77c78e44c53b521f4dd2967a1751951..2cafeca17ec76c63158349cf24ff0685423177c4 100644 (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()