]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrected handling of wxTB_HORZ_TEXT in the toolbar sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 28 Nov 2011 12:47:23 +0000 (12:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 28 Nov 2011 12:47:23 +0000 (12:47 +0000)
The value of flag could be lost when toolbar was recreated without using text
at all.

Closes #13572.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/toolbar/toolbar.cpp

index 6f8327a9113b207e4b5fc054ece35ecabcd7036c..53b7e27c5951ebbc8d7752b217bdda1801c85360 100644 (file)
@@ -925,12 +925,12 @@ void MyFrame::OnChangeToolTip(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnToolbarStyle(wxCommandEvent& event)
 {
     long style = GetToolBar()->GetWindowStyle();
-    style &= ~(wxTB_NOICONS | wxTB_TEXT);
+    style &= ~(wxTB_NOICONS | wxTB_HORZ_TEXT);
 
     switch ( event.GetId() )
     {
         case IDM_TOOLBAR_SHOW_TEXT:
-            style |= wxTB_NOICONS | wxTB_TEXT;
+            style |= wxTB_NOICONS | (m_horzText ? wxTB_HORZ_TEXT : wxTB_TEXT);
             break;
 
         case IDM_TOOLBAR_SHOW_ICONS:
@@ -938,7 +938,7 @@ void MyFrame::OnToolbarStyle(wxCommandEvent& event)
             break;
 
         case IDM_TOOLBAR_SHOW_BOTH:
-            style |= wxTB_TEXT;
+            style |= (m_horzText ? wxTB_HORZ_TEXT : wxTB_TEXT);
     }
 
     GetToolBar()->SetWindowStyle(style);