Move wxThreadEvent into wxBase.

For this, it cannot derive from wxCommandEvent. Extracted the bits
from wxCommandEvent useful for passing data between threads into
wxEventBasicPayloadMixin helper class shared by both.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68076 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2011-06-28 17:24:37 +00:00
parent 4db97e24f5
commit c1b293bb8d
6 changed files with 208 additions and 148 deletions

View File

@@ -150,10 +150,10 @@ MyDllApp::MyDllApp()
Connect(wxEVT_IDLE, wxIdleEventHandler(MyDllApp::OnIdle));
Connect(CMD_SHOW_WINDOW,
wxEVT_COMMAND_THREAD,
wxEVT_THREAD,
wxThreadEventHandler(MyDllApp::OnShowWindow));
Connect(CMD_TERMINATE,
wxEVT_COMMAND_THREAD,
wxEVT_THREAD,
wxThreadEventHandler(MyDllApp::OnTerminate));
}
@@ -288,7 +288,7 @@ void run_wx_gui_from_dll(const char *title)
// Send a message to wx thread to show a new frame:
wxThreadEvent *event =
new wxThreadEvent(wxEVT_COMMAND_THREAD, CMD_SHOW_WINDOW);
new wxThreadEvent(wxEVT_THREAD, CMD_SHOW_WINDOW);
event->SetString(title);
wxQueueEvent(wxApp::GetInstance(), event);
}
@@ -303,7 +303,7 @@ void wx_dll_cleanup()
// If wx main thread is running, we need to stop it. To accomplish this,
// send a message telling it to terminate the app.
wxThreadEvent *event =
new wxThreadEvent(wxEVT_COMMAND_THREAD, CMD_TERMINATE);
new wxThreadEvent(wxEVT_THREAD, CMD_TERMINATE);
wxQueueEvent(wxApp::GetInstance(), event);
// We must then wait for the thread to actually terminate.