made wxTLW::SetIcon() non-virtual, it was already implemented in terms of

SetIcons() in most of the ports, now do it in all of them


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-07 23:40:55 +00:00
parent 6a7d4d7190
commit ea098413d0
24 changed files with 31 additions and 79 deletions

View File

@@ -108,8 +108,7 @@ public:
// Things I may/may not do
// virtual void SetIcon(const wxIcon& icon);
// virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
// virtual void SetIcons(const wxIconBundle& icons);
// virtual void Clear() ;
// virtual void Raise();
// virtual void Lower();

View File

@@ -170,8 +170,7 @@ public:
#endif
// no icon
void SetIcon( const wxIcon& WXUNUSED(icon) ) { }
void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { }
virtual void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { }
// no maximize etc
virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ }

View File

@@ -133,8 +133,6 @@ public:
#endif // wxUSE_TOOLBAR
// no icon
virtual void SetIcon(const wxIcon& icon)
{ wxTopLevelWindowBase::SetIcon(icon); }
virtual void SetIcons(const wxIconBundle& icons )
{ wxTopLevelWindowBase::SetIcons(icons); }

View File

@@ -47,7 +47,6 @@ public:
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();

View File

@@ -155,8 +155,6 @@ public:
#endif // wxUSE_TOOLBAR
// no icon
virtual void SetIcon(const wxIcon& icon)
{ wxTopLevelWindowBase::SetIcon(icon); }
virtual void SetIcons(const wxIconBundle& icons )
{ wxTopLevelWindowBase::SetIcons(icons); }

View File

@@ -47,7 +47,6 @@ public:
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();

View File

@@ -60,8 +60,6 @@ public:
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
virtual void Restore();
virtual bool SetShape(const wxRegion& region);

View File

@@ -48,7 +48,6 @@ public:
void SetTitle(const wxString& title);
// Set icon
virtual void SetIcon(const wxIcon& icon);
virtual void SetIcons(const wxIconBundle& icons);
#if wxUSE_STATUSBAR

View File

@@ -52,7 +52,6 @@ public:
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void SetIcons(const wxIconBundle& icons );
virtual void Restore();

View File

@@ -67,7 +67,6 @@ public:
virtual void Maximize(bool bMaximize = true);
virtual void Restore(void);
virtual void SendSizeEvent(void);
virtual void SetIcon(const wxIcon& rIcon);
virtual void SetIcons(const wxIconBundle& rIcons);
virtual bool Show(bool bShow = true);

View File

@@ -54,7 +54,6 @@ public:
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();

View File

@@ -145,13 +145,13 @@ public:
virtual bool IsIconized() const = 0;
// get the frame icon
wxIcon GetIcon() const { return m_icons.GetIcon( -1 ); }
wxIcon GetIcon() const;
// get the frame icons
const wxIconBundle& GetIcons() const { return m_icons; }
// set the frame icon
virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); }
// set the frame icon: implemented in terms of SetIcons()
void SetIcon(const wxIcon& icon);
// set the frame icons
virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; }

View File

@@ -130,7 +130,6 @@ public:
// implement base class pure virtuals
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual wxPoint GetClientAreaOrigin() const;
virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); }
virtual void SetIcons(const wxIconBundle& icons);
// implementation from now on

View File

@@ -50,7 +50,6 @@ public:
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); }
virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();

View File

@@ -315,6 +315,26 @@ bool wxTopLevelWindowBase::IsAlwaysMaximized() const
#endif
}
// ----------------------------------------------------------------------------
// icons
// ----------------------------------------------------------------------------
wxIcon wxTopLevelWindowBase::GetIcon() const
{
return m_icons.IsEmpty() ? wxIcon() : m_icons.GetIcon( -1 );
}
void wxTopLevelWindowBase::SetIcon(const wxIcon& icon)
{
// passing wxNullIcon to SetIcon() is possible (it means that we shouldn't
// have any icon), but adding an invalid icon to wxIconBundle is not
wxIconBundle icons;
if ( icon.Ok() )
icons.AddIcon(icon);
SetIcons(icons);
}
// ----------------------------------------------------------------------------
// event handlers
// ----------------------------------------------------------------------------

View File

@@ -1173,17 +1173,6 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
}
void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
{
// passing wxNullIcon to SetIcon() is possible (it means that we shouldn't
// have any icon), but adding an invalid icon to wxIconBundle is not
wxIconBundle icons;
if ( icon.Ok() )
icons.AddIcon(icon);
SetIcons(icons);
}
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );

View File

@@ -1086,17 +1086,6 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
}
void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
{
// passing wxNullIcon to SetIcon() is possible (it means that we shouldn't
// have any icon), but adding an invalid icon to wxIconBundle is not
wxIconBundle icons;
if ( icon.Ok() )
icons.AddIcon(icon);
SetIcons(icons);
}
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );

View File

@@ -1031,12 +1031,6 @@ wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
return wxPoint(0, 0) ;
}
void wxTopLevelWindowMac::SetIcon(const wxIcon& icon)
{
// this sets m_icon
wxTopLevelWindowBase::SetIcon(icon);
}
void wxTopLevelWindowMac::MacSetBackgroundBrush( const wxBrush &brush )
{
wxTopLevelWindowBase::MacSetBackgroundBrush( brush ) ;

View File

@@ -470,11 +470,6 @@ void wxFrame::DoSetIcon(const wxIcon& icon)
NULL);
}
void wxFrame::SetIcon(const wxIcon& icon)
{
SetIcons( wxIconBundle( icon ) );
}
void wxFrame::SetIcons(const wxIconBundle& icons)
{
wxFrameBase::SetIcons( icons );

View File

@@ -72,8 +72,6 @@ void wxTopLevelWindowMotif::PreDestroy()
{
wxModelessWindows.DeleteObject(this);
m_icons.m_icons.Empty();
DestroyChildren();
// MessageDialog and FileDialog do not have a client widget

View File

@@ -977,24 +977,19 @@ wxString wxTopLevelWindowMSW::GetTitle() const
return GetLabel();
}
void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon)
{
SetIcons( wxIconBundle( icon ) );
}
void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
{
wxTopLevelWindowBase::SetIcons(icons);
#if !defined(__WXMICROWIN__)
const wxIcon& sml = icons.GetIcon( wxSize( 16, 16 ) );
const wxIcon& sml = icons.GetIcon(16);
if( sml.Ok() && sml.GetWidth() == 16 && sml.GetHeight() == 16 )
{
::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_SMALL,
(LPARAM)GetHiconOf(sml) );
}
const wxIcon& big = icons.GetIcon( wxSize( 32, 32 ) );
const wxIcon& big = icons.GetIcon(32);
if( big.Ok() && big.GetWidth() == 32 && big.GetHeight() == 32 )
{
::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_BIG,

View File

@@ -995,13 +995,6 @@ bool wxTopLevelWindowOS2::ShowFullScreen( bool bShow,
// wxTopLevelWindowOS2 misc
// ----------------------------------------------------------------------------
void wxTopLevelWindowOS2::SetIcon(
const wxIcon& rIcon
)
{
SetIcons(wxIconBundle(rIcon));
} // end of wxTopLevelWindowOS2::SetIcon
void wxTopLevelWindowOS2::SetIcons(
const wxIconBundle& rIcons
)
@@ -1011,7 +1004,7 @@ void wxTopLevelWindowOS2::SetIcons(
//
wxTopLevelWindowBase::SetIcons(rIcons);
const wxIcon& vIcon = rIcons.GetIcon(wxSize(32, 32));
const wxIcon& vIcon = rIcons.GetIcon(32);
if (vIcon.Ok() && vIcon.GetWidth() == 32 && vIcon.GetHeight() == 32)
{

View File

@@ -234,10 +234,6 @@ wxString wxTopLevelWindowPalm::GetTitle() const
return wxEmptyString;
}
void wxTopLevelWindowPalm::SetIcon(const wxIcon& icon)
{
}
void wxTopLevelWindowPalm::SetIcons(const wxIconBundle& icons)
{
}

View File

@@ -373,8 +373,7 @@ void wxTopLevelWindowX11::DoSetIcon(const wxIcon& icon)
{
if (icon.Ok() && GetMainWindow())
{
#if wxUSE_NANOX
#else
#if !wxUSE_NANOX
XWMHints *wmHints = XAllocWMHints();
wmHints->icon_pixmap = (Pixmap) icon.GetPixmap();