]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/tabmdi.cpp
generate middle click events (patch 1521314)
[wxWidgets.git] / src / aui / tabmdi.cpp
index d57da77f66ff23ecc603e1cb940cc1a035ec213f..0f303edf647c5394309c52e9f8fa9dcfffddb70f 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/generic/mdig.cpp
+// Name:        src/generic/tabmdi.cpp
 // Purpose:     Generic MDI (Multiple Document Interface) classes
 // Author:      Hans Van Leemputten
 // Modified by: Benjamin I. Williams / Kirix Corporation
@@ -33,6 +33,7 @@
     #include "wx/menu.h"
     #include "wx/intl.h"
     #include "wx/log.h"
+    #include "wx/settings.h"
 #endif //WX_PRECOMP
 
 #include "wx/stockitem.h"
@@ -131,14 +132,14 @@ void wxTabMDIParentFrame::SetWindowMenu(wxMenu* pMenu)
     }
 }
 
-void wxTabMDIParentFrame::SetMenuBar(wxMenuBar *pMenuBar)
+void wxTabMDIParentFrame::SetMenuBar(wxMenuBarpMenuBar)
 {
     // Remove the Window menu from the old menu bar
     RemoveWindowMenu(GetMenuBar());
-    
+
     // Add the Window menu to the new menu bar.
     AddWindowMenu(pMenuBar);
-    
+
     wxFrame::SetMenuBar(pMenuBar);
     m_pMyMenuBar = GetMenuBar();
 }
@@ -153,13 +154,13 @@ void wxTabMDIParentFrame::SetChildMenuBar(wxTabMDIChildFrame* pChild)
         SetMenuBar(m_pMyMenuBar);
 
         // Make sure we know our menu bar is in use
-        m_pMyMenuBar = NULL;
+        //m_pMyMenuBar = NULL;
     }
      else
     {
         if (pChild->GetMenuBar() == NULL)
             return;
-
+            
         // Do we need to save the current bar?
         if (m_pMyMenuBar == NULL)
             m_pMyMenuBar = GetMenuBar();
@@ -229,7 +230,7 @@ wxTabMDIClientWindow *wxTabMDIParentFrame::OnCreateClient()
 
 void wxTabMDIParentFrame::ActivateNext()
 {
-    if (m_pClientWindow && m_pClientWindow->GetSelection() != -1)
+    if (m_pClientWindow && m_pClientWindow->GetSelection() != wxNOT_FOUND)
     {
         size_t active = m_pClientWindow->GetSelection() + 1;
         if (active >= m_pClientWindow->GetPageCount())
@@ -241,7 +242,7 @@ void wxTabMDIParentFrame::ActivateNext()
 
 void wxTabMDIParentFrame::ActivatePrevious()
 {
-    if (m_pClientWindow && m_pClientWindow->GetSelection() != -1)
+    if (m_pClientWindow && m_pClientWindow->GetSelection() != wxNOT_FOUND)
     {
         int active = m_pClientWindow->GetSelection() - 1;
         if (active < 0)
@@ -394,10 +395,10 @@ bool wxTabMDIChildFrame::Destroy()
 {
     wxTabMDIParentFrame* pParentFrame = GetMDIParentFrame();
     wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
-    
+
     wxTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
     wxASSERT_MSG(pClientWindow, wxT("Missing MDI Client Window"));
-    
+
     bool bActive = false;
     if (pParentFrame->GetActiveChild() == this)
     {
@@ -405,66 +406,17 @@ bool wxTabMDIChildFrame::Destroy()
         pParentFrame->SetChildMenuBar(NULL);
         bActive = true;
     }
-    
+
     size_t pos, page_count = pClientWindow->GetPageCount();
     for (pos = 0; pos < page_count; pos++)
     {
         if (pClientWindow->GetPage(pos) == this)
             return pClientWindow->DeletePage(pos);
     }
-    
+
     return false;
 }
 
-/*
-    wxTabMDIParentFrame* pParentFrame = GetMDIParentFrame();
-    wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
-    
-    bool bActive = false;
-    if (pParentFrame->GetActiveChild() == this)
-    {
-        pParentFrame->SetActiveChild(NULL);
-        pParentFrame->SetChildMenuBar(NULL);
-        bActive = true;
-    }
-
-    wxTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
-
-    // remove page if it is still there
-    size_t pos;
-    for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
-    {
-        if (pClientWindow->GetPage(pos) == this)
-        {
-            if (pClientWindow->RemovePage(pos))
-                pClientWindow->Refresh();
-            break;
-        }
-    }
-
-    if (bActive)
-    {
-        // Set the new selection to the a remaining page
-        if (pos < pClientWindow->GetPageCount())
-        {
-            pClientWindow->SetSelection(pos);
-        }
-         else
-        {
-            if (pClientWindow->GetPageCount() >= 1)
-                pClientWindow->SetSelection(pClientWindow->GetPageCount() - 1);
-        }
-    }
-
-    // delete the child frame with pending delete, as is
-    // customary with frame windows
-    if (!wxPendingDelete.Member(this))
-        wxPendingDelete.Append(this);
-        
-    return true;
-*/
-
-
 #if wxUSE_MENUS
 void wxTabMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
 {
@@ -622,7 +574,7 @@ void wxTabMDIChildFrame::ApplyMDIChildFrameRect()
 IMPLEMENT_DYNAMIC_CLASS(wxTabMDIClientWindow, wxAuiMultiNotebook)
 
 BEGIN_EVENT_TABLE(wxTabMDIClientWindow, wxAuiMultiNotebook)
-    EVT_AUINOTEBOOK_PAGE_CHANGED(-1, wxTabMDIClientWindow::OnPageChanged)
+    EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxTabMDIClientWindow::OnPageChanged)
     EVT_SIZE(wxTabMDIClientWindow::OnSize)
 END_EVENT_TABLE()
 
@@ -645,19 +597,19 @@ bool wxTabMDIClientWindow::CreateClient(wxTabMDIParentFrame* parent, long style)
     SetWindowStyleFlag(style);
 
     if (!wxAuiMultiNotebook::Create(parent,
-                                    -1,
+                                    wxID_ANY,
                                     wxPoint(0,0),
                                     wxSize(100, 100),
                                     wxNO_BORDER))
     {
         return false;
     }
-    
+
     wxColour bkcolour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
     SetBackgroundColour(bkcolour);
-    
+
     m_mgr.GetArtProvider()->SetColour(wxAUI_ART_BACKGROUND_COLOUR, bkcolour);
-    
+
     return true;
 }
 
@@ -671,7 +623,7 @@ void wxTabMDIClientWindow::PageChanged(int old_selection, int new_selection)
     // don't do anything if the page doesn't actually change
     if (old_selection == new_selection)
         return;
-        
+
     // don't do anything if the new page is already active
     if (new_selection != -1)
     {
@@ -685,7 +637,7 @@ void wxTabMDIClientWindow::PageChanged(int old_selection, int new_selection)
     {
         wxTabMDIChildFrame* old_child = (wxTabMDIChildFrame*)GetPage(old_selection);
         wxASSERT_MSG(old_child, wxT("wxTabMDIClientWindow::PageChanged - null page pointer"));
-        
+
         wxActivateEvent event(wxEVT_ACTIVATE, false, old_child->GetId());
         event.SetEventObject(old_child);
         old_child->GetEventHandler()->ProcessEvent(event);
@@ -696,7 +648,7 @@ void wxTabMDIClientWindow::PageChanged(int old_selection, int new_selection)
     {
         wxTabMDIChildFrame* active_child = (wxTabMDIChildFrame*)GetPage(new_selection);
         wxASSERT_MSG(active_child, wxT("wxTabMDIClientWindow::PageChanged - null page pointer"));
-        
+
         wxActivateEvent event(wxEVT_ACTIVATE, true, active_child->GetId());
         event.SetEventObject(active_child);
         active_child->GetEventHandler()->ProcessEvent(event);
@@ -716,7 +668,7 @@ void wxTabMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt)
 }
 
 void wxTabMDIClientWindow::OnSize(wxSizeEvent& evt)
-{  
+{
     wxAuiMultiNotebook::OnSize(evt);
 
     for (size_t pos = 0; pos < GetPageCount(); pos++)