assert in wxTopLevelWindowMSW::SetIcon[s]() if none of the provided icons has required size

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2008-10-16 19:13:32 +00:00
parent 7abd9a0331
commit 0f278d7763
2 changed files with 16 additions and 5 deletions

View File

@ -222,7 +222,9 @@ public:
reference counting, the copy is very quick. It is safe to reference counting, the copy is very quick. It is safe to
delete @a icon after calling this function. delete @a icon after calling this function.
@see wxIcon @note In wxMSW, @a icon must be either 16x16 or 32x32 icon.
@see wxIcon, SetIcons()
*/ */
void SetIcon(const wxIcon& icon); void SetIcon(const wxIcon& icon);
@ -235,7 +237,10 @@ public:
@param icons @param icons
The icons to associate with this window. The icons to associate with this window.
@see wxIconBundle. @note In wxMSW, @a icons must contain a 16x16 or 32x32 icon,
preferably both.
@see wxIconBundle
*/ */
virtual void SetIcons(const wxIconBundle& icons); virtual void SetIcons(const wxIconBundle& icons);

View File

@ -972,7 +972,7 @@ wxString wxTopLevelWindowMSW::GetTitle() const
return GetLabel(); return GetLabel();
} }
void wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons, bool wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
int smX, int smX,
int smY, int smY,
int i) int i)
@ -983,15 +983,21 @@ void wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
if ( icon.Ok() ) if ( icon.Ok() )
{ {
::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon)); ::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
return true;
} }
return false;
} }
void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons) void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
{ {
wxTopLevelWindowBase::SetIcons(icons); wxTopLevelWindowBase::SetIcons(icons);
DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL); bool ok = DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG); if ( DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
ok = true;
wxASSERT_MSG( ok, "icon bundle doesn't contain any suitable icon" );
} }
bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)