added CreateAccelTable() helper which creates the accel table for just this menu
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
058f225a44
commit
67fdb6f9af
@ -75,8 +75,8 @@ public:
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// called by wxMenuBar to build its accel table from the accels of all menus
|
||||
bool HasAccels() const { return !m_accels.IsEmpty(); }
|
||||
size_t GetAccelCount() const { return m_accels.GetCount(); }
|
||||
bool HasAccels() const { return !m_accels.empty(); }
|
||||
size_t GetAccelCount() const { return m_accels.size(); }
|
||||
size_t CopyAccels(wxAcceleratorEntry *accels) const;
|
||||
|
||||
// called by wxMenuItem when its accels changes
|
||||
@ -84,6 +84,11 @@ public:
|
||||
|
||||
// helper used by wxMenu itself (returns the index in m_accels)
|
||||
int FindAccel(int id) const;
|
||||
|
||||
// used only by wxMDIParentFrame currently but could be useful elsewhere:
|
||||
// returns a new accelerator table with accelerators for just this menu
|
||||
// (shouldn't be called if we don't have any accelerators)
|
||||
wxAcceleratorTable *CreateAccelTable() const;
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
protected:
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include "wx/ownerdrw.h"
|
||||
#endif
|
||||
|
||||
#include "wx/ptr_scpd.h"
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
|
||||
|
||||
@ -714,6 +716,15 @@ size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
|
||||
return count;
|
||||
}
|
||||
|
||||
wxAcceleratorTable *wxMenu::CreateAccelTable() const
|
||||
{
|
||||
const size_t count = m_accels.size();
|
||||
wxScopedArray<wxAcceleratorEntry> accels(new wxAcceleratorEntry[count]);
|
||||
CopyAccels(accels.get());
|
||||
|
||||
return new wxAcceleratorTable(count, accels.get());
|
||||
}
|
||||
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user