X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/454968101428f2c2b3d836c1132572d3ef2708d9..3225a4b8b8656f25dac6cb20684a3c2c273cf796:/src/aui/floatpane.cpp diff --git a/src/aui/floatpane.cpp b/src/aui/floatpane.cpp index ef7f35e513..05740acecb 100644 --- a/src/aui/floatpane.cpp +++ b/src/aui/floatpane.cpp @@ -123,7 +123,22 @@ void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) SetTitle(pane.caption); - if (pane.floating_size != wxDefaultSize) + // This code is slightly awkward because we need to reset wxRESIZE_BORDER + // before calling SetClientSize() below as doing it after setting the + // client size would actually change it, at least under MSW, where the + // total window size doesn't change and hence, as the borders size changes, + // the client size does change. + // + // So we must call it first but doing it generates a size event and updates + // pane.floating_size from inside it so we must also record its original + // value before doing it. + const bool hasFloatingSize = pane.floating_size != wxDefaultSize; + if (pane.IsFixed()) + { + SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); + } + + if ( hasFloatingSize ) { SetSize(pane.floating_size); } @@ -144,11 +159,6 @@ void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) SetClientSize(size); } - - if (pane.IsFixed()) - { - SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); - } } wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const @@ -157,11 +167,11 @@ wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const } -void wxAuiFloatingFrame::OnSize(wxSizeEvent& event) +void wxAuiFloatingFrame::OnSize(wxSizeEvent& WXUNUSED(event)) { if (m_owner_mgr) { - m_owner_mgr->OnFloatingPaneResized(m_pane_window, event.GetSize()); + m_owner_mgr->OnFloatingPaneResized(m_pane_window, GetRect()); } } @@ -214,6 +224,15 @@ void wxAuiFloatingFrame::OnMoveEvent(wxMoveEvent& event) m_last3_rect = m_last2_rect; m_last2_rect = m_last_rect; m_last_rect = win_rect; + + // However still update the internally stored position to avoid + // snapping back to the old one later. + if (m_owner_mgr) + { + m_owner_mgr->GetPane(m_pane_window). + floating_pos = win_rect.GetPosition(); + } + return; }