]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/toolbar/toolbar.cpp
The UIProgressView is somehow not doing layout :(.
[wxWidgets.git] / samples / toolbar / toolbar.cpp
index 53b7e27c5951ebbc8d7752b217bdda1801c85360..81698c35f0a4ece22d62c27073b17c83a53be4f7 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Julian Smart
 // Modified by:
 // Created:     04/01/98
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // define this to use XPMs everywhere (by default, BMPs are used under Win)
 // BMPs use less space, but aren't compiled into the executable on other platforms
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
     #define USE_XPM_BITMAPS 0
 #else
     #define USE_XPM_BITMAPS 1
 #endif
 
-#if USE_XPM_BITMAPS && defined(__WXMSW__) && !wxUSE_XPM_IN_MSW
-    #error You need to enable XPM support to use XPM bitmaps with toolbar!
-#endif // USE_XPM_BITMAPS
-
 // If this is 1, the sample will test an extra toolbar identical to the
 // main one, but not managed by the frame. This can test subtle differences
 // in the way toolbars are handled, especially on Mac where there is one
@@ -60,7 +55,7 @@
 // resources
 // ----------------------------------------------------------------------------
 
-#if !defined(__WXMSW__) && !defined(__WXPM__)
+#ifndef wxHAS_IMAGES_IN_RESOURCES
     #include "../sample.xpm"
 #endif
 
@@ -508,7 +503,8 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
     // the changes
     toolBar->Realize();
 
-    toolBar->SetRows(!(toolBar->IsVertical()) ? m_rows : 10 / m_rows);
+    toolBar->SetRows(toolBar->IsVertical() ? toolBar->GetToolsCount() / m_rows
+                                           : m_rows);
 }
 
 // ----------------------------------------------------------------------------
@@ -762,7 +758,9 @@ void MyFrame::OnToggleToolbarRows(wxCommandEvent& WXUNUSED(event))
     // m_rows may be only 1 or 2
     m_rows = 3 - m_rows;
 
-    GetToolBar()->SetRows(!(GetToolBar()->IsVertical()) ? m_rows : 10 / m_rows);
+    wxToolBar* const toolBar = GetToolBar();
+    toolBar->SetRows(toolBar->IsVertical() ? toolBar->GetToolsCount() / m_rows
+                                           : m_rows);
 
     //RecreateToolbar(); -- this is unneeded
 }