#if WXWIN_COMPATIBILITY_2_8
#include "wx/image.h"
#endif // WXWIN_COMPATIBILITY_2_8
+ #include "wx/menu.h"
#endif
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject)
+wxToolBarToolBase::~wxToolBarToolBase()
+{
+ delete m_dropdownMenu;
+}
+
+
bool wxToolBarToolBase::Enable(bool enable)
{
if ( m_enabled == enable )
return true;
}
+
+void wxToolBarToolBase::SetDropdownMenu(wxMenu* menu)
+{
+ delete m_dropdownMenu;
+ m_dropdownMenu = menu;
+}
+
// ----------------------------------------------------------------------------
// wxToolBarBase adding/deleting items
// ----------------------------------------------------------------------------
event.SetInt(id);
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
- if( frame )
+ if ( frame )
{
wxString help;
if ( id != wxID_ANY )
help = tool->GetLongHelp();
}
- // do it even if help string is empty to avoid showing the help for the
- // previously selected tool when another one is selected
- frame->DoGiveHelp(help);
+ // call DoGiveHelp() even if help string is empty to avoid showing the
+ // help for the previously selected tool when another one is selected
+ frame->DoGiveHelp(help, id != wxID_ANY);
}
(void)GetEventHandler()->ProcessEvent(event);
}
}
+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)
if ( out.Ok() )
return true;
#endif // wxUSE_IMAGE
-
return false;
}