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 // Things I may/may not do
// virtual void SetIcon(const wxIcon& icon); // virtual void SetIcons(const wxIconBundle& icons);
// virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
// virtual void Clear() ; // virtual void Clear() ;
// virtual void Raise(); // virtual void Raise();
// virtual void Lower(); // virtual void Lower();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -145,16 +145,16 @@ public:
virtual bool IsIconized() const = 0; virtual bool IsIconized() const = 0;
// get the frame icon // get the frame icon
wxIcon GetIcon() const { return m_icons.GetIcon( -1 ); } wxIcon GetIcon() const;
// get the frame icons // get the frame icons
const wxIconBundle& GetIcons() const { return m_icons; } const wxIconBundle& GetIcons() const { return m_icons; }
// set the frame icon // set the frame icon: implemented in terms of SetIcons()
virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); } void SetIcon(const wxIcon& icon);
// set the frame icons // set the frame icons
virtual void SetIcons(const wxIconBundle& icons ) { m_icons = icons; } virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; }
// maximize the window to cover entire screen // maximize the window to cover entire screen
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0;

View File

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

View File

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

View File

@@ -315,6 +315,26 @@ bool wxTopLevelWindowBase::IsAlwaysMaximized() const
#endif #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 // 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 ) ); 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 ) void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
{ {
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); 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 ) ); 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 ) void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
{ {
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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