Fixed bug in wxListCtrl

Made wxMDIDocView work


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-07-28 22:08:36 +00:00
parent 32a4b1d57c
commit 9746a2ba50
11 changed files with 41 additions and 14 deletions

View File

@@ -157,6 +157,9 @@ class WXDLLEXPORT wxView: public wxEvtHandler
inline wxFrame *GetFrame(void) const { return m_viewFrame ; } inline wxFrame *GetFrame(void) const { return m_viewFrame ; }
inline void SetFrame(wxFrame *frame) { m_viewFrame = frame; } 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 OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
virtual void OnDraw(wxDC *dc) = 0; virtual void OnDraw(wxDC *dc) = 0;

View File

@@ -130,6 +130,7 @@ class wxMDIChildFrame: public wxPanel
bool Destroy(void); bool Destroy(void);
void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );
void OnActivate( wxActivateEvent &event );
public: public:

View File

@@ -130,6 +130,7 @@ class wxMDIChildFrame: public wxPanel
bool Destroy(void); bool Destroy(void);
void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );
void OnActivate( wxActivateEvent &event );
public: public:

View 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 //// Make a child frame
wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame(doc, view, GetMainFrame(), -1, "Child Frame", wxDocMDIChildFrame *subframe = new wxDocMDIChildFrame(doc, view, GetMainFrame(), -1, "Child Frame",

View File

@@ -28,7 +28,7 @@ class MyApp: public wxApp
bool OnInit(void); bool OnInit(void);
int OnExit(void); int OnExit(void);
wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas); wxMDIChildFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas);
protected: protected:
wxDocManager* m_docManager; wxDocManager* m_docManager;

View File

@@ -113,7 +113,7 @@ bool DrawingView::OnClose(bool deleteWindow)
if (frame) if (frame)
frame->SetTitle(s); frame->SetTitle(s);
SetFrame(NULL); SetFrame((wxFrame*)NULL);
Activate(FALSE); Activate(FALSE);

View File

@@ -30,6 +30,7 @@ LIB_CPP_SRC=\
common/cmndata.cpp \ common/cmndata.cpp \
common/config.cpp \ common/config.cpp \
common/date.cpp \ common/date.cpp \
common/docmdi.cpp \
common/docview.cpp \ common/docview.cpp \
common/dynarray.cpp \ common/dynarray.cpp \
common/event.cpp \ common/event.cpp \

View File

@@ -34,6 +34,7 @@
#include "wx/menu.h" #include "wx/menu.h"
#include "wx/list.h" #include "wx/list.h"
#include "wx/filedlg.h" #include "wx/filedlg.h"
#include "wx/mdi.h"
#endif #endif
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
@@ -482,27 +483,34 @@ void wxView::OnChangeFilename(void)
wxString name; wxString name;
GetDocument()->GetPrintableName(name); GetDocument()->GetPrintableName(name);
// If the frame is an MDI child, just set the title // If the frame is an MDI child, just set the title to the name.
// 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 mdi_frame = (wxMDIChildFrame*)GetFrame();
if (FALSE)
#endif
{
GetFrame()->SetTitle(name);
}
else else
frame = GetFrame();
if (frame)
{
frame->SetTitle(name);
return;
}
if (mdi_frame)
{ {
if (wxTheApp->GetAppName() != "") if (wxTheApp->GetAppName() != "")
{ {
char buf[400]; char buf[400];
sprintf(buf, "%s - %s", (const char *)wxTheApp->GetAppName(), (const char *)name); 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);
} }
} }
} }

View File

@@ -1755,6 +1755,7 @@ void wxListMainWindow::DeleteItem( long index )
if (node) if (node)
{ {
wxListLineData *line = (wxListLineData*)node->Data(); wxListLineData *line = (wxListLineData*)node->Data();
if (m_current == line) m_current = NULL;
DeleteLine( line ); DeleteLine( line );
m_lines.DeleteNode( node ); m_lines.DeleteNode( node );
}; };

View File

@@ -176,6 +176,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow) EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
EVT_SIZE(wxMDIChildFrame::OnSize) EVT_SIZE(wxMDIChildFrame::OnSize)
EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
END_EVENT_TABLE() END_EVENT_TABLE()
wxMDIChildFrame::wxMDIChildFrame(void) 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) bool wxMDIChildFrame::Destroy(void)
{ {
if (!wxPendingDelete.Member(this)) if (!wxPendingDelete.Member(this))
@@ -306,6 +308,10 @@ void wxMDIChildFrame::Activate(void)
{ {
}; };
void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
{
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMDIClientWindow // wxMDIClientWindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -176,6 +176,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow) EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
EVT_SIZE(wxMDIChildFrame::OnSize) EVT_SIZE(wxMDIChildFrame::OnSize)
EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
END_EVENT_TABLE() END_EVENT_TABLE()
wxMDIChildFrame::wxMDIChildFrame(void) 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) bool wxMDIChildFrame::Destroy(void)
{ {
if (!wxPendingDelete.Member(this)) if (!wxPendingDelete.Member(this))
@@ -306,6 +308,10 @@ void wxMDIChildFrame::Activate(void)
{ {
}; };
void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
{
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMDIClientWindow // wxMDIClientWindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------