X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6522713c7527e5f683a107dff8f40e3ea19a4745..192e6679f671a435a6276a475a57a0b8b501e0f4:/src/common/popupcmn.cpp?ds=sidebyside diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index d6319df904..ff6d0c0818 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -40,6 +40,18 @@ #include "wx/univ/renderer.h" #endif // __WXUNIVERSAL__ +// there is no src/msw/popupwin.cpp to put this in, so we do it here - BTW we +// probably could do it for all ports here just as well +#ifdef __WXMSW__ + IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) +#endif // __WXMSW__ + +IMPLEMENT_DYNAMIC_CLASS(wxPopupTransientWindow, wxPopupWindow) + +#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) + IMPLEMENT_DYNAMIC_CLASS(wxPopupComboWindow, wxPopupTransientWindow) +#endif + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -147,11 +159,11 @@ void wxPopupTransientWindow::Init() m_focus = (wxWindow *)NULL; } -wxPopupTransientWindow::wxPopupTransientWindow(wxWindow *parent) +wxPopupTransientWindow::wxPopupTransientWindow(wxWindow *parent, int style) { Init(); - (void)Create(parent); + (void)Create(parent, style); } wxPopupTransientWindow::~wxPopupTransientWindow() @@ -187,10 +199,17 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus) m_child = this; } + // we can't capture mouse before the window is shown in wxGTL +#ifdef __WXGTK__ + Show(); +#endif + m_child->CaptureMouse(); m_child->PushEventHandler(new wxPopupWindowHandler(this)); +#ifndef __WXGTK__ Show(); +#endif m_focus = winFocus ? winFocus : this; m_focus->PushEventHandler(new wxPopupFocusHandler(this)); @@ -222,7 +241,7 @@ bool wxPopupTransientWindow::ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) return FALSE; } -#if wxUSE_COMBOBOX +#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) // ---------------------------------------------------------------------------- // wxPopupComboWindow @@ -246,7 +265,7 @@ void wxPopupComboWindow::PositionNearCombo() // the origin point must be in screen coords wxPoint ptOrigin = m_combo->ClientToScreen(wxPoint(0, 0)); -#ifdef __WXUNIVERSAL__ +#if 0 //def __WXUNIVERSAL__ // account for the fact that (0, 0) is not the top left corner of the // window: there is also the border wxRect rectBorders = m_combo->GetRenderer()-> @@ -265,7 +284,7 @@ void wxPopupComboWindow::OnDismiss() m_combo->OnDismiss(); } -#endif // wxUSE_COMBOBOX +#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) // ---------------------------------------------------------------------------- // wxPopupWindowHandler @@ -293,6 +312,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) m_popup->DismissAndNotify(); break; +#ifdef __WXUNIVERSAL__ case wxHT_WINDOW_HORZ_SCROLLBAR: sbar = win->GetScrollbar(wxHORIZONTAL); break; @@ -300,6 +320,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) case wxHT_WINDOW_VERT_SCROLLBAR: sbar = win->GetScrollbar(wxVERTICAL); break; +#endif default: // forgot to update the switch after adding a new hit test code? @@ -345,3 +366,4 @@ void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event) } #endif // wxUSE_POPUPWIN +