Derive wxAuiMDIChildFrame from wxFrame for consistency

Make it easier to use AUI-based MDI child frame class instead of
normal wxMDIChildFrame itself by inheriting it from the same base class.

This also allows to get rid of duplicate stubs in wxAuiMDIChildFrame.
This commit is contained in:
Vadim Zeitlin 2018-05-12 23:40:57 +02:00
parent 826ab19ac9
commit c1bcf16eb9
2 changed files with 7 additions and 65 deletions

View File

@ -21,6 +21,7 @@
#include "wx/panel.h"
#include "wx/notebook.h"
#include "wx/icon.h"
#include "wx/mdi.h"
#include "wx/aui/auibook.h"
//-----------------------------------------------------------------------------
@ -115,7 +116,7 @@ private:
// wxAuiMDIChildFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxPanel
class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxTDIChildFrame
{
public:
wxAuiMDIChildFrame();
@ -142,7 +143,6 @@ public:
#endif // wxUSE_MENUS
virtual void SetTitle(const wxString& title);
virtual wxString GetTitle() const;
virtual void SetIcons(const wxIconBundle& icons);
virtual const wxIconBundle& GetIcons() const;
@ -155,43 +155,7 @@ public:
virtual bool Show(bool show = true) wxOVERRIDE;
#if wxUSE_STATUSBAR
// no status bars
virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1,
long WXUNUSED(style) = 1,
wxWindowID WXUNUSED(winid) = 1,
const wxString& WXUNUSED(name) = wxEmptyString)
{ return NULL; }
virtual wxStatusBar *GetStatusBar() const { return NULL; }
virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
#endif
#if wxUSE_TOOLBAR
// no toolbar bars
virtual wxToolBar* CreateToolBar(long WXUNUSED(style),
wxWindowID WXUNUSED(winid),
const wxString& WXUNUSED(name))
{ return NULL; }
virtual wxToolBar *GetToolBar() const { return NULL; }
#endif
// no maximize etc
virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
virtual void Restore() { /* Has no effect */ }
virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
virtual bool IsMaximized() const { return true; }
virtual bool IsIconized() const { return false; }
virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
virtual bool IsFullScreen() const { return false; }
virtual bool IsTopLevel() const wxOVERRIDE { return false; }
void OnMenuHighlight(wxMenuEvent& evt);
void OnActivate(wxActivateEvent& evt);
void OnCloseWindow(wxCloseEvent& evt);
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
wxAuiMDIParentFrame* GetMDIParentFrame() const;
@ -201,10 +165,6 @@ protected:
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE;
virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE;
// no size hints
virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH),
int WXUNUSED(maxW), int WXUNUSED(maxH),
int WXUNUSED(incW), int WXUNUSED(incH)) wxOVERRIDE {}
public:
// This function needs to be called when a size change is confirmed,
// we needed this function to prevent anybody from the outside
@ -216,7 +176,6 @@ protected:
wxAuiMDIParentFrame* m_pMDIParentFrame;
wxRect m_mdiNewRect;
wxRect m_mdiCurRect;
wxString m_title;
wxIcon m_icon;
wxIconBundle m_iconBundle;
bool m_activateOnCreate;

View File

@ -423,12 +423,10 @@ void wxAuiMDIParentFrame::Tile(wxOrientation orient)
// wxAuiMDIChildFrame
//-----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIChildFrame, wxPanel);
wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIChildFrame, wxFrame);
wxBEGIN_EVENT_TABLE(wxAuiMDIChildFrame, wxPanel)
wxBEGIN_EVENT_TABLE(wxAuiMDIChildFrame, wxFrame)
EVT_MENU_HIGHLIGHT_ALL(wxAuiMDIChildFrame::OnMenuHighlight)
EVT_ACTIVATE(wxAuiMDIChildFrame::OnActivate)
EVT_CLOSE(wxAuiMDIChildFrame::OnCloseWindow)
wxEND_EVENT_TABLE()
wxAuiMDIChildFrame::wxAuiMDIChildFrame()
@ -501,7 +499,7 @@ bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent,
wxSize cli_size = pClientWindow->GetClientSize();
// create the window off-screen to prevent flicker
wxPanel::Create(pClientWindow,
wxWindow::Create(pClientWindow,
id,
wxPoint(cli_size.x+1, cli_size.y+1),
size,
@ -609,11 +607,6 @@ void wxAuiMDIChildFrame::SetTitle(const wxString& title)
}
}
wxString wxAuiMDIChildFrame::GetTitle() const
{
return m_title;
}
void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons)
{
// get icon with the system icon size
@ -689,16 +682,6 @@ void wxAuiMDIChildFrame::OnMenuHighlight(wxMenuEvent& event)
#endif // wxUSE_STATUSBAR
}
void wxAuiMDIChildFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
{
// do nothing
}
void wxAuiMDIChildFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
Destroy();
}
void wxAuiMDIChildFrame::SetMDIParentFrame(wxAuiMDIParentFrame* parentFrame)
{
m_pMDIParentFrame = parentFrame;
@ -743,7 +726,7 @@ void wxAuiMDIChildFrame::DoSetSize(int x, int y, int width, int height, int size
{
m_mdiNewRect = wxRect(x, y, width, height);
#ifdef __WXGTK__
wxPanel::DoSetSize(x,y,width, height, sizeFlags);
wxWindow::DoSetSize(x,y,width, height, sizeFlags);
#else
wxUnusedVar(sizeFlags);
#endif
@ -758,7 +741,7 @@ void wxAuiMDIChildFrame::ApplyMDIChildFrameRect()
{
if (m_mdiCurRect != m_mdiNewRect)
{
wxPanel::DoMoveWindow(m_mdiNewRect.x, m_mdiNewRect.y,
wxWindow::DoMoveWindow(m_mdiNewRect.x, m_mdiNewRect.y,
m_mdiNewRect.width, m_mdiNewRect.height);
m_mdiCurRect = m_mdiNewRect;
}