Made wxMDIDocView work
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@391
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
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;
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 );
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 );
* 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",
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;
if (frame)
frame->SetTitle(s);
if (frame)
frame->SetTitle(s);
+ SetFrame((wxFrame*)NULL);
common/cmndata.cpp \
common/config.cpp \
common/date.cpp \
common/cmndata.cpp \
common/config.cpp \
common/date.cpp \
common/docview.cpp \
common/dynarray.cpp \
common/event.cpp \
common/docview.cpp \
common/dynarray.cpp \
common/event.cpp \
#include "wx/menu.h"
#include "wx/list.h"
#include "wx/filedlg.h"
#include "wx/menu.h"
#include "wx/list.h"
#include "wx/filedlg.h"
#endif
#include "wx/msgdlg.h"
#endif
#include "wx/msgdlg.h"
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
+ // 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;
{
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);
- GetFrame()->SetTitle(name);
+ mdi_frame->SetTitle(name);
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 );
};
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)
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))
+void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
+{
+};
+
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------
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)
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))
+void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
+{
+};
+
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------