#endif
// next translate the individual flags
- if ( style & wxMINIMIZE_BOX )
- msflags |= WS_MINIMIZEBOX;
- if ( style & wxMAXIMIZE_BOX )
- msflags |= WS_MAXIMIZEBOX;
+
+ // WS_EX_CONTEXTHELP is incompatible with WS_MINIMIZEBOX and WS_MAXIMIZEBOX
+ // and is ignored if we specify both of them, but chances are that if we
+ // use wxFRAME_EX_CONTEXTHELP, we really do want to have the context help
+ // button while wxMINIMIZE/wxMAXIMIZE are included by default, so the help
+ // takes precedence
+ if ( !(GetExtraStyle() & wxFRAME_EX_CONTEXTHELP) )
+ {
+ if ( style & wxMINIMIZE_BOX )
+ msflags |= WS_MINIMIZEBOX;
+ if ( style & wxMAXIMIZE_BOX )
+ msflags |= WS_MAXIMIZEBOX;
+ }
#ifndef __WXWINCE__
if ( style & wxSYSTEM_MENU )
WXDWORD exflags;
WXDWORD flags = MSWGetCreateWindowFlags(&exflags);
- wxSize sz;
-
- if (IsAlwaysMaximized())
- {
- sz = wxDefaultSize;
- }
- else
- {
- sz = size;
- }
-
- bool result = MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags);
+ const wxSize sz = IsAlwaysMaximized() ? wxDefaultSize : size;
- return result;
+ return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags);
}
bool wxTopLevelWindowMSW::Create(wxWindow *parent,
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;
}
// it's shown, so return our size as it will be then in this case
if ( maximize )
{
- // unfortunately we don't know which display we're on yet so we
- // have to use the default one
- SetSize(wxGetClientDisplayRect().GetSize());
+ // we must only change pending size here, and not call SetSize()
+ // because otherwise Windows would think that this (full screen)
+ // size is the natural size for the frame and so would use it when
+ // the user clicks on "restore" title bar button instead of the
+ // correct initial frame size
+ //
+ // NB: unfortunately we don't know which display we're on yet so we
+ // have to use the default one
+ m_pendingSize = wxGetClientDisplayRect().GetSize();
}
//else: can't do anything in this case, we don't have the old size
}