Reuse base class icon-related functions in wxAuiMDIChildFrame

Don't define GetIcon(), GetIcons() and SetIcon() at all as the base
class already implements them and just keep SetIcons(), which can now be
marked as overridden as it's inherited from wxTopLevelWindow via
wxTDIChildFrame.
This commit is contained in:
Vadim Zeitlin
2018-05-13 02:15:30 +02:00
parent f7b0ec38dd
commit be696ed8a4
2 changed files with 3 additions and 27 deletions

View File

@@ -144,11 +144,7 @@ public:
virtual void SetTitle(const wxString& title); virtual void SetTitle(const wxString& title);
virtual void SetIcons(const wxIconBundle& icons); virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE;
virtual const wxIconBundle& GetIcons() const;
virtual void SetIcon(const wxIcon& icon);
virtual const wxIcon& GetIcon() const;
virtual void Activate(); virtual void Activate();
virtual bool Destroy() wxOVERRIDE; virtual bool Destroy() wxOVERRIDE;
@@ -171,8 +167,6 @@ public:
protected: protected:
wxAuiMDIParentFrame* m_pMDIParentFrame; wxAuiMDIParentFrame* m_pMDIParentFrame;
wxIcon m_icon;
wxIconBundle m_iconBundle;
bool m_activateOnCreate; bool m_activateOnCreate;
#if wxUSE_MENUS #if wxUSE_MENUS

View File

@@ -606,25 +606,13 @@ void wxAuiMDIChildFrame::SetTitle(const wxString& title)
void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons) void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons)
{ {
// get icon with the system icon size wxTDIChildFrame::SetIcons(icons);
SetIcon(icons.GetIcon(-1));
m_iconBundle = icons;
}
const wxIconBundle& wxAuiMDIChildFrame::GetIcons() const
{
return m_iconBundle;
}
void wxAuiMDIChildFrame::SetIcon(const wxIcon& icon)
{
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame(); wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame")); wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
m_icon = icon;
wxBitmap bmp; wxBitmap bmp;
bmp.CopyFromIcon(m_icon); bmp.CopyFromIcon(icons.GetIcon(-1));
wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
if (pClientWindow != NULL) if (pClientWindow != NULL)
@@ -638,12 +626,6 @@ void wxAuiMDIChildFrame::SetIcon(const wxIcon& icon)
} }
} }
const wxIcon& wxAuiMDIChildFrame::GetIcon() const
{
return m_icon;
}
void wxAuiMDIChildFrame::Activate() void wxAuiMDIChildFrame::Activate()
{ {
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame(); wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();