]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/mdig.cpp
Fixed bug in optimization for character input, affecting first paragraph in the buffer.
[wxWidgets.git] / src / generic / mdig.cpp
index 7919782ea51df15fecb84f009b7497c07dc48b87..a1cdc3b08979a8b5a0753b99001572b7159c61ec 100644 (file)
 // headers
 // ---------------------------------------------------------------------------
 
-#ifdef __GNUG__
-    #pragma implementation "mdig.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
     #pragma hdrstop
 #endif
 
+#if wxUSE_MDI
+
+#include "wx/generic/mdig.h"
+
 #ifndef WX_PRECOMP
     #include "wx/panel.h"
     #include "wx/menu.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
-#include "wx/generic/mdig.h"
+#include "wx/stockitem.h"
 
 enum MDI_MENU_ID
 {
@@ -52,7 +53,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericMDIParentFrame, wxFrame)
 
 BEGIN_EVENT_TABLE(wxGenericMDIParentFrame, wxFrame)
 #if wxUSE_MENUS
-    EVT_MENU (-1, wxGenericMDIParentFrame::DoHandleMenu)
+    EVT_MENU (wxID_ANY, wxGenericMDIParentFrame::DoHandleMenu)
 #endif
 END_EVENT_TABLE()
 
@@ -123,7 +124,7 @@ bool wxGenericMDIParentFrame::Create(wxWindow *parent,
 
   OnCreateClient();
 
-  return TRUE;
+  return true;
 }
 
 #if wxUSE_MENUS
@@ -192,12 +193,12 @@ bool wxGenericMDIParentFrame::ProcessEvent(wxEvent& event)
     // Stops the same event being processed repeatedly
     static wxEventType inEvent = wxEVT_NULL;
     if (inEvent == event.GetEventType())
-        return FALSE;
+        return false;
 
     inEvent = event.GetEventType();
 
     // Let the active child (if any) process the event first.
-    bool res = FALSE;
+    bool res = false;
     if (m_pActiveChild && event.IsKindOf(CLASSINFO(wxCommandEvent))
 #if 0
         /* This is sure to not give problems... */
@@ -258,7 +259,7 @@ void wxGenericMDIParentFrame::ActivateNext()
 {
     if (m_pClientWindow && m_pClientWindow->GetSelection() != -1)
     {
-        int active = m_pClientWindow->GetSelection() + 1;
+        size_t active = m_pClientWindow->GetSelection() + 1;
         if (active >= m_pClientWindow->GetPageCount())
             active = 0;
 
@@ -307,7 +308,7 @@ void wxGenericMDIParentFrame::AddWindowMenu(wxMenuBar *pMenuBar)
 {
     if (pMenuBar && m_pWindowMenu)
     {
-        int pos = pMenuBar->FindMenu(_("Help"));
+        int pos = pMenuBar->FindMenu(wxGetStockLabel(wxID_HELP,false));
         if (pos == wxNOT_FOUND)
         {
             pMenuBar->Append(m_pWindowMenu, _("&Window"));
@@ -344,6 +345,7 @@ void wxGenericMDIParentFrame::DoHandleMenu(wxCommandEvent &event)
                 {
 #if 1   // What's best? Delayed deleting or immediate deleting?
                     delete m_pActiveChild;
+                    m_pActiveChild = NULL;
 #else
                     ActivateNext();
 
@@ -401,25 +403,24 @@ wxGenericMDIChildFrame::wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent,
     Create( parent, id, title, wxDefaultPosition, size, style, name );
 }
 
-#include "wx/log.h"
 wxGenericMDIChildFrame::~wxGenericMDIChildFrame()
 {
     wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame();
 
     if (pParentFrame != NULL)
     {
-        bool bActive = FALSE;
+        bool bActive = false;
         if (pParentFrame->GetActiveChild() == this)
         {
             pParentFrame->SetActiveChild((wxGenericMDIChildFrame*) NULL);
             pParentFrame->SetChildMenuBar((wxGenericMDIChildFrame*) NULL);
-            bActive = TRUE;
+            bActive = true;
         }
 
         wxGenericMDIClientWindow *pClientWindow = pParentFrame->GetClientWindow();
 
         // Remove page if still there
-        int pos;
+        size_t pos;
         for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
         {
             if (pClientWindow->GetPage(pos) == this)
@@ -439,7 +440,7 @@ wxGenericMDIChildFrame::~wxGenericMDIChildFrame()
             }
             else
             {
-                if (pClientWindow->GetPageCount() - 1 >= 0)
+                if ((int)pClientWindow->GetPageCount() - 1 >= 0)
                     pClientWindow->SetSelection(pClientWindow->GetPageCount() - 1);
             }
         }
@@ -468,11 +469,11 @@ bool wxGenericMDIChildFrame::Create( wxGenericMDIParentFrame *parent,
 
     m_Title = title;
 
-    pClientWindow->AddPage(this, title, TRUE);
+    pClientWindow->AddPage(this, title, true);
     ApplyMDIChildFrameRect();   // Ok confirme the size change!
     pClientWindow->Refresh();
 
-    return TRUE;
+    return true;
 }
 
 #if wxUSE_MENUS
@@ -518,7 +519,7 @@ void wxGenericMDIChildFrame::SetTitle(const wxString& title)
 
         if (pClientWindow != NULL)
         {
-            int pos;
+            size_t pos;
             for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
             {
                 if (pClientWindow->GetPage(pos) == this)
@@ -546,7 +547,7 @@ void wxGenericMDIChildFrame::Activate()
 
         if (pClientWindow != NULL)
         {
-            int pos;
+            size_t pos;
             for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
             {
                 if (pClientWindow->GetPage(pos) == this)
@@ -568,10 +569,12 @@ void wxGenericMDIChildFrame::OnMenuHighlight(wxMenuEvent& event)
         // but may be the MDI frame does?
         m_pMDIParentFrame->OnMenuHighlight(event);
     }
+#else
+    wxUnusedVar(event);
 #endif // wxUSE_STATUSBAR
 }
 
-void wxGenericMDIChildFrame::OnActivate(wxActivateEvent& event)
+void wxGenericMDIChildFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
 {
     // Do mothing.
 }
@@ -590,7 +593,7 @@ void wxGenericMDIChildFrame::OnSize(wxSizeEvent& WXUNUSED(event))
     {
         // do we have _exactly_ one child?
         wxWindow *child = (wxWindow *)NULL;
-        for ( wxWindowList::Node *node = GetChildren().GetFirst();
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
               node;
               node = node->GetNext() )
         {
@@ -697,7 +700,7 @@ bool wxGenericMDIClientWindow::CreateClient( wxGenericMDIParentFrame *parent, lo
 {
     SetWindowStyleFlag(style);
 
-    bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
+    bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0,0), wxSize(100, 100), 0);
     if (success)
     {
         /*
@@ -708,13 +711,13 @@ bool wxGenericMDIClientWindow::CreateClient( wxGenericMDIParentFrame *parent, lo
         GetTabView()->SetTabSize(120, 18);
         GetTabView()->SetTabSelectionHeight(20);
         */
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
-int wxGenericMDIClientWindow::SetSelection(int nPage)
+int wxGenericMDIClientWindow::SetSelection(size_t nPage)
 {
     int oldSelection = wxNotebook::SetSelection(nPage);
 
@@ -747,7 +750,7 @@ void wxGenericMDIClientWindow::PageChanged(int OldSelection, int newSelection)
         wxGenericMDIChildFrame* oldChild = (wxGenericMDIChildFrame *)GetPage(OldSelection);
         if (oldChild)
         {
-            wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldChild->GetId());
+            wxActivateEvent event(wxEVT_ACTIVATE, false, oldChild->GetId());
             event.SetEventObject( oldChild );
             oldChild->GetEventHandler()->ProcessEvent(event);
         }
@@ -759,7 +762,7 @@ void wxGenericMDIClientWindow::PageChanged(int OldSelection, int newSelection)
         wxGenericMDIChildFrame* activeChild = (wxGenericMDIChildFrame *)GetPage(newSelection);
         if (activeChild)
         {
-            wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
+            wxActivateEvent event(wxEVT_ACTIVATE, true, activeChild->GetId());
             event.SetEventObject( activeChild );
             activeChild->GetEventHandler()->ProcessEvent(event);
 
@@ -783,7 +786,7 @@ void wxGenericMDIClientWindow::OnSize(wxSizeEvent& event)
 {
     wxNotebook::OnSize(event);
 
-    int pos;
+    size_t pos;
     for (pos = 0; pos < GetPageCount(); pos++)
     {
         ((wxGenericMDIChildFrame *)GetPage(pos))->ApplyMDIChildFrameRect();
@@ -811,5 +814,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxGenericMDIParentFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxGenericMDIChildFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxGenericMDIClientWindow)
 
-#endif
+#endif // wxUSE_GENERIC_MDI_AS_NATIVE
+
+#endif // wxUSE_MDI