]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
remove needless casting (no real change)
[wxWidgets.git] / src / common / tbarbase.cpp
index 1e427b825fdd8ccf2f63001adfc02c3522c5f235..abb467f5ca1882ee03afe354726cc64195d8c447 100644 (file)
@@ -35,6 +35,7 @@
     #if WXWIN_COMPATIBILITY_2_8
         #include "wx/image.h"
     #endif // WXWIN_COMPATIBILITY_2_8
+    #include "wx/menu.h"
 #endif
 
 // ----------------------------------------------------------------------------
@@ -58,6 +59,12 @@ WX_DEFINE_LIST(wxToolBarToolsList)
 
 IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject)
 
+wxToolBarToolBase::~wxToolBarToolBase()
+{
+    delete m_dropdownMenu;
+}
+
+
 bool wxToolBarToolBase::Enable(bool enable)
 {
     if ( m_enabled == enable )
@@ -111,6 +118,14 @@ bool wxToolBarToolBase::SetLongHelp(const wxString& help)
     return true;
 }
 
+
+void wxToolBarToolBase::SetDropdownMenu(wxMenu* menu)
+{
+    delete m_dropdownMenu;
+    m_dropdownMenu = menu;
+}
+
+
 // ----------------------------------------------------------------------------
 // wxToolBarBase adding/deleting items
 // ----------------------------------------------------------------------------
@@ -582,6 +597,12 @@ void wxToolBarBase::SetRows(int WXUNUSED(nRows))
     // nothing
 }
 
+bool wxToolBarBase::IsVertical() const
+{
+    return HasFlag(wxTB_LEFT | wxTB_RIGHT);
+}
+
+
 // ----------------------------------------------------------------------------
 // event processing
 // ----------------------------------------------------------------------------
@@ -690,6 +711,19 @@ void wxToolBarBase::UpdateWindowUI(long flags)
     }
 }
 
+bool wxToolBarBase::SetDropdownMenu(int toolid, wxMenu* menu)
+{
+    wxToolBarToolBase * const tool = FindById(toolid);
+    wxCHECK_MSG( tool, false, _T("invalid tool id") );
+
+    wxCHECK_MSG( tool->GetKind() == wxITEM_DROPDOWN, false,
+                    _T("menu can be only associated with drop down tools") );
+
+    tool->SetDropdownMenu(menu);
+
+    return true;
+}
+
 #if WXWIN_COMPATIBILITY_2_8
 
 bool wxCreateGreyedImage(const wxImage& in, wxImage& out)
@@ -699,7 +733,6 @@ bool wxCreateGreyedImage(const wxImage& in, wxImage& out)
     if ( out.Ok() )
         return true;
 #endif // wxUSE_IMAGE
-
     return false;
 }