// Created: 24.09.01
// RCS-ID: $Id$
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
-// License: wxWindows licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
nShowCmd = SW_HIDE;
}
+#if wxUSE_DEFERRED_SIZING
// we only set pending size if we're maximized before being shown, now that
// we're shown we don't need it any more (it is reset in size event handler
// for child windows but we have to do it ourselves for this parent window)
// them, not the size returned by WM_NCCALCSIZE in DoGetClientSize() which
// turns out to be wrong for maximized windows (see #11762)
m_pendingSize = wxDefaultSize;
+#endif // wxUSE_DEFERRED_SIZING
DoShowWindow(nShowCmd);
// so just remember that we should do it later in this case
m_maximizeOnShow = maximize;
+#if wxUSE_DEFERRED_SIZING
// after calling Maximize() the client code expects to get the frame
// "real" size and doesn't want to know that, because of implementation
// details, the frame isn't really maximized yet but will be only once
m_pendingSize = wxGetClientDisplayRect().GetSize();
}
//else: can't do anything in this case, we don't have the old size
+#endif // wxUSE_DEFERRED_SIZING
}
}
{
const wxSize size(::GetSystemMetrics(smX), ::GetSystemMetrics(smY));
- const wxIcon icon = icons.GetIconOfExactSize(size);
- if ( icon.Ok() )
+ // Try the exact size first.
+ wxIcon icon = icons.GetIconOfExactSize(size);
+
+ if ( !icon.IsOk() )
{
- ::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
- return true;
+ // If we didn't find any, set at least some icon: it will look scaled
+ // and ugly but in practice it's impossible to prevent this because not
+ // everyone can provide the icons in all sizes used by all versions of
+ // Windows in all DPIs (this would include creating them in at least
+ // 14, 16, 22, 32, 48, 64 and 128 pixel sizes).
+ icon = icons.GetIcon(size);
}
- return false;
+ if ( !icon.IsOk() )
+ return false;
+
+ ::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
+ return true;
}
void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
return;
}
- bool anySet =
- DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
- if ( DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
- anySet = true;
-
- if ( !anySet )
- {
- wxFAIL_MSG( "icon bundle doesn't contain any suitable icon" );
- }
+ DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
+ DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG);
}
bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)