return GetLabel();
}
-void wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
+bool wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
int smX,
int smY,
int i)
if ( icon.Ok() )
{
::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
+ return true;
}
+
+ return false;
}
void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
{
wxTopLevelWindowBase::SetIcons(icons);
- DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
- DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG);
+ if ( icons.IsEmpty() )
+ {
+ // FIXME: SetIcons(wxNullIconBundle) should unset existing icons,
+ // but we currently don't do that
+ wxASSERT_MSG( m_icons.IsEmpty(), "unsetting icons doesn't work" );
+ return;
+ }
+
+ if ( !DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL) &&
+ !DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
+ {
+ wxFAIL_MSG( "icon bundle doesn't contain any suitable icon" );
+ }
}
bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)