]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed bug in wxListCtrl
authorRobert Roebling <robert@roebling.de>
Tue, 28 Jul 1998 22:08:36 +0000 (22:08 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 28 Jul 1998 22:08:36 +0000 (22:08 +0000)
  Made wxMDIDocView work

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/docview.h
include/wx/gtk/mdi.h
include/wx/gtk1/mdi.h
samples/docvwmdi/docview.cpp
samples/docvwmdi/docview.h
samples/docvwmdi/view.cpp
src/Makefile.in
src/common/docview.cpp
src/generic/listctrl.cpp
src/gtk/mdi.cpp
src/gtk1/mdi.cpp

index add8ef0e19b90a7b1f4287f2e229c4ed80fe36d2..563e12a3d6a5b670fd1b7bd791eedfe667576a07 100644 (file)
@@ -157,6 +157,9 @@ class WXDLLEXPORT wxView: public wxEvtHandler
 
   inline wxFrame *GetFrame(void) const { return m_viewFrame ; }
   inline void SetFrame(wxFrame *frame) { m_viewFrame = frame; }
 
   inline wxFrame *GetFrame(void) const { return m_viewFrame ; }
   inline void SetFrame(wxFrame *frame) { m_viewFrame = frame; }
+#ifdef __WXGTK__
+  inline void SetFrame(wxMDIChildFrame *frame) { m_viewFrame = (wxFrame*)frame; }
+#endif
 
   virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
   virtual void OnDraw(wxDC *dc) = 0;
 
   virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
   virtual void OnDraw(wxDC *dc) = 0;
index b53e87c26f971103c89a74c95440df92eb5d169e..e56d71cdf491632fb76b0d3e21818a54d562829f 100644 (file)
@@ -130,6 +130,7 @@ class wxMDIChildFrame: public wxPanel
     bool Destroy(void);
     void OnCloseWindow( wxCloseEvent& event );
     void OnSize( wxSizeEvent &event );
     bool Destroy(void);
     void OnCloseWindow( wxCloseEvent& event );
     void OnSize( wxSizeEvent &event );
+    void OnActivate( wxActivateEvent &event );
     
   public:
   
     
   public:
   
index b53e87c26f971103c89a74c95440df92eb5d169e..e56d71cdf491632fb76b0d3e21818a54d562829f 100644 (file)
@@ -130,6 +130,7 @@ class wxMDIChildFrame: public wxPanel
     bool Destroy(void);
     void OnCloseWindow( wxCloseEvent& event );
     void OnSize( wxSizeEvent &event );
     bool Destroy(void);
     void OnCloseWindow( wxCloseEvent& event );
     void OnSize( wxSizeEvent &event );
+    void OnActivate( wxActivateEvent &event );
     
   public:
   
     
   public:
   
index b33ae584f78b816407ec71f52481b50276fe9beb..90edcf6154cc007d737565b86af5b5d4397097b2 100644 (file)
@@ -114,7 +114,7 @@ int MyApp::OnExit(void)
  * Called from view.cpp, when a view is created.
  */
  
  * Called from view.cpp, when a view is created.
  */
  
-wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas)
+wxMDIChildFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas)
 {
   //// Make a child frame
   wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame(doc, view, GetMainFrame(), -1, "Child Frame",
 {
   //// Make a child frame
   wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame(doc, view, GetMainFrame(), -1, "Child Frame",
index 30bc59fcff3f12f01add104bf0db17893a5139a6..9f9b69530043467d0af7e0fe16e8ad3dbfe2357a 100644 (file)
@@ -28,7 +28,7 @@ class MyApp: public wxApp
     bool OnInit(void);
     int OnExit(void);
 
     bool OnInit(void);
     int OnExit(void);
 
-    wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas);
+    wxMDIChildFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas);
 
   protected:
     wxDocManager* m_docManager;
 
   protected:
     wxDocManager* m_docManager;
index ea8b46df062824eb4398e52bc2bc5523fc072049..d943bb082b1a3683b19bf4db0a9ce57d88bbb61b 100644 (file)
@@ -113,7 +113,7 @@ bool DrawingView::OnClose(bool deleteWindow)
   if (frame)
     frame->SetTitle(s);
 
   if (frame)
     frame->SetTitle(s);
 
-  SetFrame(NULL);
+  SetFrame((wxFrame*)NULL);
 
   Activate(FALSE);
   
 
   Activate(FALSE);
   
index 2a0ce6cd7df464c05156d6a8aa0ec2897559418d..2f5985ebe51ddc405c98249b0a01ba17d37243b5 100644 (file)
@@ -30,6 +30,7 @@ LIB_CPP_SRC=\
  common/cmndata.cpp \
  common/config.cpp \
  common/date.cpp \
  common/cmndata.cpp \
  common/config.cpp \
  common/date.cpp \
+ common/docmdi.cpp \
  common/docview.cpp \
  common/dynarray.cpp \
  common/event.cpp \
  common/docview.cpp \
  common/dynarray.cpp \
  common/event.cpp \
index 851c909b21a5f5dd81fbf16c3ef621219e4c7836..36f36611c0d87c1f18cd7f03b1c73da0c8e53304 100644 (file)
@@ -34,6 +34,7 @@
 #include "wx/menu.h"
 #include "wx/list.h"
 #include "wx/filedlg.h"
 #include "wx/menu.h"
 #include "wx/list.h"
 #include "wx/filedlg.h"
+#include "wx/mdi.h"
 #endif
 
 #include "wx/msgdlg.h"
 #endif
 
 #include "wx/msgdlg.h"
@@ -482,27 +483,34 @@ void wxView::OnChangeFilename(void)
     wxString name;
     GetDocument()->GetPrintableName(name);
 
     wxString name;
     GetDocument()->GetPrintableName(name);
 
-    // If the frame is an MDI child, just set the title
-    // to the name.
+    // If the frame is an MDI child, just set the title to the name.
     // Otherwise, append the document name to the name of the application
     // Otherwise, append the document name to the name of the application
-#ifdef __WXMSW__
+    // I have to do an illegal cast because in wxGTK, wxMDIChildFrame
+    // doesn't inherited from wxFrame, Robert Roebling
+    
+    wxFrame *frame = NULL;
+    wxMDIChildFrame *mdi_frame = NULL;
     if (GetFrame()->IsKindOf(CLASSINFO(wxMDIChildFrame)))
     if (GetFrame()->IsKindOf(CLASSINFO(wxMDIChildFrame)))
-#else
-    if (FALSE)
-#endif
+      mdi_frame = (wxMDIChildFrame*)GetFrame();
+    else
+      frame = GetFrame();
+      
+    if (frame)
     {
     {
-      GetFrame()->SetTitle(name);
+      frame->SetTitle(name);
+      return;
     }
     }
-    else
+    
+    if (mdi_frame)
     {
       if (wxTheApp->GetAppName() != "")
       {
         char buf[400];
         sprintf(buf, "%s - %s", (const char *)wxTheApp->GetAppName(), (const char *)name);
     {
       if (wxTheApp->GetAppName() != "")
       {
         char buf[400];
         sprintf(buf, "%s - %s", (const char *)wxTheApp->GetAppName(), (const char *)name);
-        GetFrame()->SetTitle(buf);
+        mdi_frame->SetTitle(buf);
       }
       else
       }
       else
-        GetFrame()->SetTitle(name);
+        mdi_frame->SetTitle(name);
     }
   }
 }
     }
   }
 }
index 8e158cfaedee7cbee9940051238fbd2a9a40f71f..03ffc62dd6fbac84c2cb8341edb588251e11a830 100644 (file)
@@ -1755,6 +1755,7 @@ void wxListMainWindow::DeleteItem( long index )
   if (node)
   {
     wxListLineData *line = (wxListLineData*)node->Data();
   if (node)
   {
     wxListLineData *line = (wxListLineData*)node->Data();
+    if (m_current == line) m_current = NULL;
     DeleteLine( line );
     m_lines.DeleteNode( node );
   };
     DeleteLine( line );
     m_lines.DeleteNode( node );
   };
index ba49975d89a87381bdfecc4c430d9d967381bfeb..cf1408acdf673f66d6346699476b120ca085feba 100644 (file)
@@ -176,6 +176,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
   EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
   EVT_SIZE(wxMDIChildFrame::OnSize)
 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
   EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
   EVT_SIZE(wxMDIChildFrame::OnSize)
+  EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
 END_EVENT_TABLE()
 
 wxMDIChildFrame::wxMDIChildFrame(void)
 END_EVENT_TABLE()
 
 wxMDIChildFrame::wxMDIChildFrame(void)
@@ -254,6 +255,7 @@ void wxMDIChildFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
     child->SetSize( 1, 1, client_x-2, client_y);
   }
 };
     child->SetSize( 1, 1, client_x-2, client_y);
   }
 };
+
 bool wxMDIChildFrame::Destroy(void)
 {
   if (!wxPendingDelete.Member(this))
 bool wxMDIChildFrame::Destroy(void)
 {
   if (!wxPendingDelete.Member(this))
@@ -306,6 +308,10 @@ void wxMDIChildFrame::Activate(void)
 {
 };
 
 {
 };
 
+void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
+{
+};
+
 //-----------------------------------------------------------------------------
 // wxMDIClientWindow
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxMDIClientWindow
 //-----------------------------------------------------------------------------
index ba49975d89a87381bdfecc4c430d9d967381bfeb..cf1408acdf673f66d6346699476b120ca085feba 100644 (file)
@@ -176,6 +176,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
   EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
   EVT_SIZE(wxMDIChildFrame::OnSize)
 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
   EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
   EVT_SIZE(wxMDIChildFrame::OnSize)
+  EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
 END_EVENT_TABLE()
 
 wxMDIChildFrame::wxMDIChildFrame(void)
 END_EVENT_TABLE()
 
 wxMDIChildFrame::wxMDIChildFrame(void)
@@ -254,6 +255,7 @@ void wxMDIChildFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
     child->SetSize( 1, 1, client_x-2, client_y);
   }
 };
     child->SetSize( 1, 1, client_x-2, client_y);
   }
 };
+
 bool wxMDIChildFrame::Destroy(void)
 {
   if (!wxPendingDelete.Member(this))
 bool wxMDIChildFrame::Destroy(void)
 {
   if (!wxPendingDelete.Member(this))
@@ -306,6 +308,10 @@ void wxMDIChildFrame::Activate(void)
 {
 };
 
 {
 };
 
+void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
+{
+};
+
 //-----------------------------------------------------------------------------
 // wxMDIClientWindow
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxMDIClientWindow
 //-----------------------------------------------------------------------------