X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ff8b6290e9b7d0c604c35ca938d87cbd1fd157ed..e72aa7f5ac0347b1115ffce7eafa58ddc2936ebc:/src/msw/frame.cpp diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 6ff16e1ff8..d766cb0992 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -64,7 +64,6 @@ // ---------------------------------------------------------------------------- extern wxWindowList wxModelessWindows; -extern wxList WXDLLEXPORT wxPendingDelete; extern const wxChar *wxFrameClassName; #if wxUSE_MENUS_NATIVE @@ -80,7 +79,9 @@ BEGIN_EVENT_TABLE(wxFrameMSW, wxFrameBase) EVT_SYS_COLOUR_CHANGED(wxFrameMSW::OnSysColourChanged) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxFrameMSW, wxWindow) +#ifndef __WXUNIVERSAL__ + IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) +#endif // ============================================================================ // implementation @@ -137,15 +138,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)); @@ -165,7 +157,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); @@ -352,6 +347,16 @@ bool wxFrameMSW::Show(bool show) return TRUE; } +void wxFrameMSW::Raise() +{ +#ifdef __WIN16__ + // no SetForegroundWindow() in Win16 + wxFrameBase::Raise(); +#else // Win32 + ::SetForegroundWindow(GetHwnd()); +#endif // Win16/32 +} + void wxFrameMSW::Iconize(bool iconize) { DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE); @@ -379,21 +384,31 @@ void wxFrameMSW::Restore() bool wxFrameMSW::IsIconized() const { +#ifdef __WXMICROWIN__ + // TODO + return FALSE; +#else ((wxFrameMSW *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0); return m_iconized; +#endif } // Is it maximized? bool wxFrameMSW::IsMaximized() const { +#ifdef __WXMICROWIN__ + // TODO + return FALSE; +#else return (::IsZoomed(GetHwnd()) != 0); +#endif } void wxFrameMSW::SetIcon(const wxIcon& icon) { wxFrameBase::SetIcon(icon); -#if defined(__WIN95__) +#if defined(__WIN95__) && !defined(__WXMICROWIN__) if ( m_icon.Ok() ) { SendMessage(GetHwnd(), WM_SETICON, @@ -403,7 +418,7 @@ void wxFrameMSW::SetIcon(const wxIcon& icon) } // generate an artificial resize event -void wxFrame::SendSizeEvent() +void wxFrameMSW::SendSizeEvent() { RECT r; #ifdef __WIN16__ @@ -474,24 +489,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 @@ -505,37 +508,29 @@ 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__ if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) { wxLogLastError(wxT("SetMenu")); } +#endif } #endif // wxUSE_MENUS_NATIVE @@ -584,8 +579,10 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style) } #endif // wxUSE_TOOLBAR +#ifndef __WXMICROWIN__ if (style & wxFULLSCREEN_NOMENUBAR) SetMenu((HWND)GetHWND(), (HMENU) NULL); +#endif #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); @@ -618,7 +615,7 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style) LONG offFlags = 0; if (style & wxFULLSCREEN_NOBORDER) - offFlags |= WS_BORDER; + offFlags |= WS_BORDER | WS_THICKFRAME; if (style & wxFULLSCREEN_NOCAPTION) offFlags |= (WS_CAPTION | WS_SYSMENU); @@ -675,8 +672,10 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style) } #endif // wxUSE_STATUSBAR +#ifndef __WXMICROWIN__ if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) SetMenu((HWND)GetHWND(), (HMENU)m_hMenu); +#endif Maximize(m_fsIsMaximized); SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle); @@ -908,7 +907,7 @@ void wxFrameMSW::IconizeChildFrames(bool bIconize) // the child MDI frames are a special case and should not be touched by // the parent frame - instead, they are managed by the user - wxFrameMSW *frame = wxDynamicCast(win, wxFrameMSW); + wxFrameMSW *frame = wxDynamicCast(win, wxFrame); if ( frame #if wxUSE_MDI_ARCHITECTURE && !wxDynamicCast(frame, wxMDIChildFrame) @@ -955,6 +954,7 @@ bool wxFrameMSW::HandlePaint() RECT rect; if ( GetUpdateRect(GetHwnd(), &rect, FALSE) ) { +#ifndef __WXMICROWIN__ if ( m_iconized ) { HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) @@ -988,6 +988,7 @@ bool wxFrameMSW::HandlePaint() return TRUE; } else + #endif { return wxWindow::HandlePaint(); } @@ -1002,6 +1003,7 @@ bool wxFrameMSW::HandlePaint() bool wxFrameMSW::HandleSize(int x, int y, WXUINT id) { bool processed = FALSE; +#ifndef __WXMICROWIN__ switch ( id ) { @@ -1032,6 +1034,7 @@ bool wxFrameMSW::HandleSize(int x, int y, WXUINT id) m_iconized = TRUE; break; } +#endif if ( !m_iconized ) { @@ -1091,10 +1094,12 @@ bool wxFrameMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) // menu was removed from screen item = -1; } +#ifndef __WXMICROWIN__ else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) ) { item = nItem; } +#endif else { #if wxUSE_STATUSBAR @@ -1146,6 +1151,7 @@ long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) } break; +#ifndef __WXMICROWIN__ case WM_MENUSELECT: { WXWORD item, flags; @@ -1155,11 +1161,13 @@ long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = HandleMenuSelect(item, flags, hmenu); } break; +#endif case WM_PAINT: processed = HandlePaint(); break; +#ifndef __WXMICROWIN__ case WM_QUERYDRAGICON: { HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) @@ -1168,6 +1176,7 @@ long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = rc != 0; } break; +#endif case WM_SIZE: processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);