// Created: 24.09.01
// RCS-ID: $Id$
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
-// License: wxWindows licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
msflags |= WS_MAXIMIZE;
// Keep this here because it saves recoding this function in wxTinyFrame
- if ( style & (wxTINY_CAPTION_VERT | wxTINY_CAPTION_HORIZ) )
+ if ( style & wxTINY_CAPTION )
msflags |= WS_CAPTION;
if ( exflags )
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)
+ //
+ // make sure to reset it before actually showing the window as this will
+ // generate WM_SIZE events and we want to use the correct client size from
+ // 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);
#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
frame->GetMenuBar()->AddAdornments(GetWindowStyleFlag());
#endif
- // 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)
- m_pendingSize = wxDefaultSize;
-
return true;
}
// 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)
return (os_type == wxOS_WINDOWS_NT && ver_major >= 5);
}
+void wxTopLevelWindowMSW::DoEnable(bool enable)
+{
+ wxTopLevelWindowBase::DoEnable(enable);
+
+ // Enabling or disabling a window may change its appearance. Unfortunately,
+ // in at least some situation, toplevel windows don't repaint themselves,
+ // so we have to issue explicit refresh to avoid rendering artifacts.
+ //
+ // TODO: find out just what exactly is wrong here
+ Refresh();
+}
void wxTopLevelWindowMSW::DoFreeze()
{