]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/floatpane.cpp
Suppress harmless gcc warnings about enum elements unhandled in switch.
[wxWidgets.git] / src / aui / floatpane.cpp
index ab81810d615cad41a22cc9dae25d1edadefbdcb5..05740acecb9acdd0fef5a684f347a3756dd90d13 100644 (file)
@@ -73,11 +73,9 @@ wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent,
 wxAuiFloatingFrame::~wxAuiFloatingFrame()
 {
     // if we do not do this, then we can crash...
-    if(m_owner_mgr)
+    if (m_owner_mgr && m_owner_mgr->m_action_window == this)
     {
-        if(m_owner_mgr->m_action_window == this)
-            m_owner_mgr->m_action_window = NULL;
-        m_owner_mgr->UnregisterFloatingFrame(this);
+        m_owner_mgr->m_action_window = NULL;
     }
 
     m_mgr.UnInit();
@@ -125,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);
     }
@@ -153,17 +166,12 @@ wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const
     return m_owner_mgr;
 }
 
-void wxAuiFloatingFrame::SetOwnerManager(wxAuiManager* owner_mgr)
-{
-    // we want to allow for NULL here to avoid crashing in dtor
-    m_owner_mgr = owner_mgr;
-}
 
-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());
     }
 }
 
@@ -216,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;
     }
 
@@ -325,7 +342,7 @@ void wxAuiFloatingFrame::OnActivate(wxActivateEvent& event)
 // functionality to wxWidgets itself)
 bool wxAuiFloatingFrame::isMouseDown()
 {
-    return wxGetMouseState().LeftDown();
+    return wxGetMouseState().LeftIsDown();
 }