X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b016a65b3e58c4ded18b2cc20ddabfee67ca26ee..d7926e0b761b782b82f9ef01ff542251b2ef5ae7:/src/msw/frame.cpp?ds=sidebyside diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 0a453aba9a..c67dd43753 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -139,15 +139,6 @@ bool wxFrameMSW::Create(wxWindow *parent, { SetName(name); m_windowStyle = style; -#if wxUSE_MENUS - m_frameMenuBar = NULL; -#endif // wxUSE_MENUS -#if wxUSE_TOOLBAR - m_frameToolBar = NULL; -#endif // wxUSE_TOOLBAR -#if wxUSE_STATUSBAR - m_frameStatusBar = NULL; -#endif // wxUSE_STATUSBAR SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); @@ -167,7 +158,10 @@ bool wxFrameMSW::Create(wxWindow *parent, wxTopLevelWindows.Append(this); - MSWCreate(m_windowId, parent, wxFrameClassName, this, title, + // the frame must have NULL parent HWND or it would be always on top of its + // parent which is not what we usually want (in fact, we only want it for + // frames with the special wxFRAME_TOOL_WINDOW style handled elsewhere) + MSWCreate(m_windowId, NULL, wxFrameClassName, this, title, x, y, width, height, style); wxModelessWindows.Append(this); @@ -486,24 +480,12 @@ void wxFrameMSW::PositionStatusBar() } #endif // wxUSE_STATUSBAR -void wxFrameMSW::DetachMenuBar() -{ -#if wxUSE_MENUS - if ( m_frameMenuBar ) - { - m_frameMenuBar->Detach(); - m_frameMenuBar = NULL; - } -#endif // wxUSE_MENUS -} +#if wxUSE_MENUS_NATIVE -void wxFrameMSW::SetMenuBar(wxMenuBar *menubar) +void wxFrameMSW::AttachMenuBar(wxMenuBar *menubar) { -#if wxUSE_MENUS - // detach the old menu bar in any case - DetachMenuBar(); + wxFrameBase::AttachMenuBar(menubar); -#if wxUSE_MENUS_NATIVE if ( !menubar ) { // actually remove the menu from the frame @@ -517,31 +499,21 @@ void wxFrameMSW::SetMenuBar(wxMenuBar *menubar) { m_hMenu = menubar->GetHMenu(); } - else + else // no HMENU yet { - if (menubar->IsAttached()) - menubar->Detach(); - m_hMenu = menubar->Create(); if ( !m_hMenu ) + { + wxFAIL_MSG( _T("failed to create menu bar") ); return; + } } InternalSetMenuBar(); } -#endif // wxUSE_MENUS_NATIVE - - if ( menubar ) - { - m_frameMenuBar = menubar; - menubar->Attach((wxFrame *)this); - } -#endif // wxUSE_MENUS } -#if wxUSE_MENUS_NATIVE - void wxFrameMSW::InternalSetMenuBar() { #ifndef __WXMICROWIN__