X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bca8c756a30d54ee4fade96a091d78ad8988fd23..42604e44bec70f5a26cabb26653f7ca1490fb04e:/src/common/mousemanager.cpp?ds=sidebyside diff --git a/src/common/mousemanager.cpp b/src/common/mousemanager.cpp index c373955038..20849a0167 100644 --- a/src/common/mousemanager.cpp +++ b/src/common/mousemanager.cpp @@ -24,6 +24,8 @@ #endif #ifndef WX_PRECOMP + #include "wx/settings.h" + #include "wx/window.h" #endif // WX_PRECOMP #include "wx/mousemanager.h" @@ -43,18 +45,27 @@ END_EVENT_TABLE() // wxMouseEventsManager implementation // ============================================================================ -wxMouseEventsManager::wxMouseEventsManager(wxWindow *win) - : m_win(win) +void wxMouseEventsManager::Init() { + m_win = NULL; m_state = State_Normal; m_item = wxNOT_FOUND; +} + +bool wxMouseEventsManager::Create(wxWindow *win) +{ + wxASSERT_MSG( !m_win, "Create() must not be called twice" ); + m_win = win; win->PushEventHandler(this); + + return true; } wxMouseEventsManager::~wxMouseEventsManager() { - m_win->RemoveEventHandler(this); + if ( m_win ) + m_win->RemoveEventHandler(this); } void wxMouseEventsManager::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) @@ -92,6 +103,7 @@ void wxMouseEventsManager::OnLeftDown(wxMouseEvent& event) } m_state = State_Pressed; + m_win->SetFocus(); m_win->CaptureMouse(); MouseClickBegin(m_item); }