Add static wxEventHashTable::ReconstructAll() to undo the effects of ClearAll().
Call it from wxEventTableEntryModule::OnInit() so that it is now symmetric with OnExit(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48332 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2347,6 +2347,8 @@ public:
|
||||
|
||||
// Clear all tables
|
||||
static void ClearAll();
|
||||
// Rebuild all tables
|
||||
static void ReconstructAll();
|
||||
|
||||
protected:
|
||||
// Init the hash table with the entries of the static event table.
|
||||
|
@@ -115,7 +115,11 @@ class wxEventTableEntryModule: public wxModule
|
||||
DECLARE_DYNAMIC_CLASS(wxEventTableEntryModule)
|
||||
public:
|
||||
wxEventTableEntryModule() {}
|
||||
bool OnInit() { return true; }
|
||||
bool OnInit()
|
||||
{
|
||||
wxEventHashTable::ReconstructAll();
|
||||
return true;
|
||||
}
|
||||
void OnExit()
|
||||
{
|
||||
wxEventHashTable::ClearAll();
|
||||
@@ -850,6 +854,23 @@ void wxEventHashTable::ClearAll()
|
||||
}
|
||||
}
|
||||
|
||||
// Rebuild all tables if they were cleared by ClearAll
|
||||
void wxEventHashTable::ReconstructAll()
|
||||
{
|
||||
wxEventHashTable* table = sm_first;
|
||||
while (table)
|
||||
{
|
||||
// This will only be true if the event table was cleared.
|
||||
// What we do here is basically what the constructor does.
|
||||
if(table->m_eventTypeTable == NULL)
|
||||
{
|
||||
table->AllocEventTypeTable(EVENT_TYPE_TABLE_INIT_SIZE);
|
||||
table->m_rebuildHash = true;
|
||||
}
|
||||
table = table->m_next;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxEventHashTable::HandleEvent(wxEvent &event, wxEvtHandler *self)
|
||||
{
|
||||
if (m_rebuildHash)
|
||||
|
@@ -53,6 +53,7 @@
|
||||
*wxAuiNotebook*SetSelectedFont*;
|
||||
*wxAuiNotebook*ShowWindowMenu*;
|
||||
*wxDocument*GetUserReadableName*;
|
||||
*wxEventHashTable*ReconstructAll*;
|
||||
*wxHtmlEasyPrinting*GetParentWindow*;
|
||||
*wxHtmlEasyPrinting*SetParentWindow*;
|
||||
*wxLog*DoCreateOnDemand*;
|
||||
|
Reference in New Issue
Block a user