added support for drop down toolbar buttons (patch 1713470)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-05-11 23:35:49 +00:00
parent 884898a79a
commit a9a0ceca5b
8 changed files with 133 additions and 5 deletions

View 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,13 @@ bool wxToolBarToolBase::SetLongHelp(const wxString& help)
return true;
}
void wxToolBarToolBase::SetDropdownMenu(wxMenu* menu)
{
delete m_dropdownMenu;
m_dropdownMenu = menu;
}
// ----------------------------------------------------------------------------
// wxToolBarBase adding/deleting items
// ----------------------------------------------------------------------------
@@ -690,6 +704,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 +726,6 @@ bool wxCreateGreyedImage(const wxImage& in, wxImage& out)
if ( out.Ok() )
return true;
#endif // wxUSE_IMAGE
return false;
}