X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/542875a8c4f12b16fef8c1c25ee7e8166902f9bb..6342bd1ab36c1957684c00d408d09fba65d33db6:/src/os2/frame.cpp?ds=sidebyside diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 4c15e005b4..f3faceb427 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -90,6 +90,18 @@ void wxFrame::Init() m_nFsToolBarHeight = 0; m_bFsIsMaximized = FALSE; m_bFsIsShowing = FALSE; + + // + // Initialize SWP's + // + memset(&m_vSwp, 0, sizeof(SWP)); + memset(&m_vSwpClient, 0, sizeof(SWP)); + memset(&m_vSwpTitleBar, 0, sizeof(SWP)); + memset(&m_vSwpMenuBar, 0, sizeof(SWP)); + memset(&m_vSwpHScroll, 0, sizeof(SWP)); + memset(&m_vSwpVScroll, 0, sizeof(SWP)); + memset(&m_vSwpStatusBar, 0, sizeof(SWP)); + memset(&m_vSwpToolBar, 0, sizeof(SWP)); } // end of wxFrame::Init bool wxFrame::Create( @@ -125,12 +137,6 @@ bool wxFrame::Create( m_bIconized = FALSE; - // - // We pass NULL as parent to MSWCreate because frames with parents behave - // very strangely under Win95 shell. - // Alteration by JACS: keep normal Windows behaviour (float on top of parent) - // with this ulStyle. - // if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0) pParent = NULL; @@ -166,7 +172,7 @@ wxFrame::~wxFrame() if (wxTheApp->GetExitOnFrameDelete()) { - ::WinPostMsg(GetHwnd(), WM_QUIT, 0, 0); + ::WinPostMsg(m_hFrame, WM_QUIT, 0, 0); } } wxModelessWindows.DeleteObject(this); @@ -208,14 +214,12 @@ void wxFrame::DoGetClientSize( // top-left thus the += instead of the -= // RECTL vRect; - HWND hWndClient; // // PM has no GetClientRect that inherantly knows about the client window // We have to explicitly go fetch it! // - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); - ::WinQueryWindowRect(hWndClient, &vRect); + ::WinQueryWindowRect(GetHwnd(), &vRect); #if wxUSE_STATUSBAR if ( GetStatusBar() ) @@ -251,14 +255,12 @@ void wxFrame::DoSetClientSize( ) { HWND hWnd = GetHwnd(); - HWND hWndClient; RECTL vRect; RECTL vRect2; - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); - ::WinQueryWindowRect(hWndClient, &vRect); + ::WinQueryWindowRect(GetHwnd(), &vRect); - ::WinQueryWindowRect(hWnd, &vRect2); + ::WinQueryWindowRect(m_hFrame, &vRect2); // // Find the difference between the entire window (title bar and all) @@ -290,7 +292,7 @@ void wxFrame::DoSetClientSize( vPointl.x = vRect2.xLeft; vPoint.y = vRect2.yTop; - ::WinSetWindowPos( hWnd + ::WinSetWindowPos( m_hFrame ,HWND_TOP ,vPointl.x ,vPointl.y @@ -315,7 +317,7 @@ void wxFrame::DoGetSize( { RECTL vRect; - ::WinQueryWindowRect(GetHwnd(), &vRect); + ::WinQueryWindowRect(m_hFrame, &vRect); *pWidth = vRect.xRight - vRect.xLeft; *pHeight = vRect.yTop - vRect.yBottom; } // end of wxFrame::DoGetSize @@ -328,7 +330,7 @@ void wxFrame::DoGetPosition( RECTL vRect; POINTL vPoint; - ::WinQueryWindowRect(GetHwnd(), &vRect); + ::WinQueryWindowRect(m_hFrame, &vRect); vPoint.x = vRect.xLeft; // @@ -345,31 +347,43 @@ void wxFrame::DoGetPosition( // ---------------------------------------------------------------------------- void wxFrame::DoShowWindow( - int nShowCmd + int bShowCmd ) { - ::WinShowWindow(GetHwnd(), nShowCmd); - m_bIconized = nShowCmd == SWP_MINIMIZE; + HWND hClient = NULLHANDLE; + SWP vSwp; + + // + // Reset the window position + // + WinQueryWindowPos(m_hFrame, &vSwp); + WinSetWindowPos( GetHwnd() + ,HWND_TOP + ,vSwp.x + ,vSwp.y + ,vSwp.cx + ,vSwp.cy + ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE + ); + ::WinShowWindow(m_hFrame, (BOOL)bShowCmd); + ::WinShowWindow(GetHwnd(), (BOOL)bShowCmd); } // end of wxFrame::DoShowWindow bool wxFrame::Show( bool bShow ) { - DoShowWindow(bShow ? SWP_SHOW : SWP_HIDE); + SWP vSwp; + + DoShowWindow((int)bShow); if (bShow) { wxActivateEvent vEvent(wxEVT_ACTIVATE, TRUE, m_windowId); - ::WinSetWindowPos( (HWND) GetHWND() - ,HWND_TOP - ,0 - ,0 - ,0 - ,0 - ,SWP_ZORDER - ); + ::WinQueryWindowPos(m_hFrame, &vSwp); + m_bIconized = vSwp.fl & SWP_MINIMIZE; + ::WinEnableWindow(m_hFrame, TRUE); vEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(vEvent); } @@ -382,15 +396,18 @@ bool wxFrame::Show( { HWND hWndParent = GetHwndOf(GetParent()); + ::WinQueryWindowPos(hWndParent, &vSwp); + m_bIconized = vSwp.fl & SWP_MINIMIZE; if (hWndParent) ::WinSetWindowPos( hWndParent ,HWND_TOP - ,0 - ,0 - ,0 - ,0 - ,SWP_ZORDER + ,vSwp.x + ,vSwp.y + ,vSwp.cx + ,vSwp.cy + ,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE ); + ::WinEnableWindow(hWndParent, TRUE); } } return TRUE; @@ -434,7 +451,7 @@ bool wxFrame::IsMaximized() const SWP vSwp; bool bIconic; - ::WinQueryWindowPos(GetHwnd(), &vSwp); + ::WinQueryWindowPos(m_hFrame, &vSwp); return (vSwp.fl & SWP_MAXIMIZE); } // end of wxFrame::IsMaximized @@ -444,13 +461,18 @@ void wxFrame::SetIcon( { wxFrameBase::SetIcon(rIcon); - if (m_icon.Ok()) + if ((m_icon.GetHICON()) != NULLHANDLE) { - WinSendMsg( GetHwnd() - ,WM_SETICON - ,(MPARAM)((HICON)m_icon.GetHICON()) - ,NULL - ); + ::WinSendMsg( m_hFrame + ,WM_SETICON + ,(MPARAM)((HPOINTER)m_icon.GetHICON()) + ,NULL + ); + ::WinSendMsg( m_hFrame + ,WM_UPDATEFRAME + ,(MPARAM)FCF_ICON + ,(MPARAM)0 + ); } } // end of wxFrame::SetIcon @@ -463,17 +485,63 @@ wxStatusBar* wxFrame::OnCreateStatusBar( ) { wxStatusBar* pStatusBar = NULL; + SWP vSwp; + ERRORID vError; + wxString sError; + HWND hWnd; pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber ,lulStyle ,vId ,rName ); + // + // The default parent set for the Statusbar is m_hWnd which, of course, + // is the handle to the client window of the frame. We don't want that, + // so we have to set the parent to actually be the Frame. + // + hWnd = pStatusBar->GetHWND(); + if (!::WinSetParent(hWnd, m_hFrame, FALSE)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for statusbar. Error: %s\n", sError); + return NULL; + } + + // + // Also we need to reset it positioning to enable the SHOW attribute + // + if (!::WinQueryWindowPos((HWND)pStatusBar->GetHWND(), &vSwp)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error querying frame for statusbar position. Error: %s\n", sError); + return NULL; + } + if (!::WinSetWindowPos( (HWND)pStatusBar->GetHWND() + ,HWND_TOP + ,vSwp.cx + ,vSwp.cy + ,vSwp.x + ,vSwp.y + ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting statusbar position. Error: %s\n", sError); + return NULL; + } return pStatusBar; } // end of wxFrame::OnCreateStatusBar void wxFrame::PositionStatusBar() { + SWP vSwp; + ERRORID vError; + wxString sError; + // // Native status bar positions itself // @@ -486,8 +554,7 @@ void wxFrame::PositionStatusBar() HWND hWndClient; RECTL vRect; - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); - ::WinQueryWindowRect(hWndClient, &vRect); + ::WinQueryWindowRect(GetHwnd(), &vRect); nWidth = vRect.xRight - vRect.xLeft; nHeight = vRect.yTop - vRect.yBottom; @@ -504,6 +571,27 @@ void wxFrame::PositionStatusBar() ,nWidth ,nStatbarHeight ); + if (!::WinQueryWindowPos(m_frameStatusBar->GetHWND(), &vSwp)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + return; + } + if (!::WinSetWindowPos( m_frameStatusBar->GetHWND() + ,HWND_TOP + ,nStatbarWidth + ,nStatbarHeight + ,vSwp.x + ,vSwp.y + ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + return; + } } } // end of wxFrame::PositionStatusBar #endif // wxUSE_STATUSBAR @@ -521,44 +609,92 @@ void wxFrame::SetMenuBar( wxMenuBar* pMenuBar ) { + ERRORID vError; + wxString sError; + HWND hClient = NULLHANDLE; + HWND hFrame = NULLHANDLE; + HWND hTitlebar = NULLHANDLE; + HWND hHScroll = NULLHANDLE; + HWND hVScroll = NULLHANDLE; + HWND hMenuBar = NULLHANDLE; + SWP vSwp; + SWP vSwpTitlebar; + SWP vSwpVScroll; + SWP vSwpHScroll; + SWP vSwpMenu; + if (!pMenuBar) { DetachMenuBar(); return; } - wxCHECK_RET(!pMenuBar->GetFrame(), wxT("this menubar is already attached")); + m_frameMenuBar = NULL; - if (m_frameMenuBar) - delete m_frameMenuBar; - - m_hMenu = pMenuBar->Create(); - m_ulMenubarId = pMenuBar->GetMenubarId(); - if (m_ulMenubarId != FID_MENU) + // Can set a menubar several times. + // TODO: how to prevent a memory leak if you have a currently-unattached + // menubar? wxWindows assumes that the frame will delete the menu (otherwise + // there are problems for MDI). + if (pMenuBar->GetHMenu()) { - ::WinSetWindowUShort( m_hMenu - ,QWS_ID - ,(unsigned short)m_ulMenubarId - ); + m_hMenu = pMenuBar->GetHMenu(); } + else + { + pMenuBar->Detach(); - if (!m_hMenu) - return; + m_hMenu = pMenuBar->Create(); + + if (!m_hMenu) + return; + } + + // + // Set the parent and owner of the menubar to be the frame + // + if (!::WinSetParent(m_hMenu, m_hFrame, FALSE)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + } + if (!::WinSetOwner(m_hMenu, m_hFrame)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + } InternalSetMenuBar(); m_frameMenuBar = pMenuBar; pMenuBar->Attach(this); + + // + // Now resize the client to fit the new frame + // + WinQueryWindowPos(m_hFrame, &vSwp); + hTitlebar = WinWindowFromID(m_hFrame, FID_TITLEBAR); + WinQueryWindowPos(hTitlebar, &vSwpTitlebar); + hHScroll = WinWindowFromID(m_hFrame, FID_HORZSCROLL); + WinQueryWindowPos(hHScroll, &vSwpHScroll); + hVScroll = WinWindowFromID(m_hFrame, FID_VERTSCROLL); + WinQueryWindowPos(hVScroll, &vSwpVScroll); + hMenuBar = WinWindowFromID(m_hFrame, FID_MENU); + WinQueryWindowPos(hMenuBar, &vSwpMenu); + WinSetWindowPos( GetHwnd() + ,HWND_TOP + ,SV_CXSIZEBORDER/2 + ,(SV_CYSIZEBORDER/2) + vSwpHScroll.cy/2 + ,vSwp.cx - ((SV_CXSIZEBORDER + 1) + vSwpVScroll.cx) + ,vSwp.cy - ((SV_CYSIZEBORDER + 1) + vSwpTitlebar.cy + vSwpMenu.cy + vSwpHScroll.cy/2) + ,SWP_SIZE | SWP_MOVE + ); } // end of wxFrame::SetMenuBar void wxFrame::InternalSetMenuBar() { - - ::WinPostMsg( GetHwnd() - ,WM_UPDATEFRAME - ,(MPARAM)FCF_MENU - ,NULL - ); + WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); } // end of wxFrame::InternalSetMenuBar // @@ -725,90 +861,165 @@ bool wxFrame::OS2Create( , long ulStyle ) { - ULONG ulPmFlags = 0; - ULONG ulExtraFlags = 0; - ULONG ulTempFlags = FCF_TITLEBAR | - FCF_SYSMENU | - FCF_MINBUTTON | - FCF_MAXBUTTON | - FCF_SIZEBORDER | - FCF_ICON | - FCF_MENU | - FCF_ACCELTABLE | - FCF_SHELLPOSITION | - FCF_TASKLIST; + ULONG ulCreateFlags = 0L; + ULONG ulStyleFlags = 0L; + ULONG ulExtraFlags = 0L; + FRAMECDATA vFrameCtlData; + HWND hParent = NULLHANDLE; + HWND hClient = NULLHANDLE; + HWND hFrame = NULLHANDLE; + HWND hTitlebar = NULLHANDLE; + HWND hHScroll = NULLHANDLE; + HWND hVScroll = NULLHANDLE; + SWP vSwp[10]; + RECTL vRect[10]; + USHORT uCtlCount; m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON); - if ((ulStyle & wxCAPTION) == wxCAPTION) - ulPmFlags = FCF_TASKLIST; + if (pParent) + hParent = GetWinHwnd(pParent); + else + hParent = HWND_DESKTOP; + + if (ulStyle == wxDEFAULT_FRAME_STYLE) + ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | + FCF_MINMAX | FCF_TASKLIST; else - ulPmFlags = FCF_NOMOVEWITHOWNER; - - if (ulStyle & wxMINIMIZE_BOX) - ulPmFlags |= FCF_MINBUTTON; - if (ulStyle & wxMAXIMIZE_BOX) - ulPmFlags |= FCF_MAXBUTTON; - if (ulStyle & wxTHICK_FRAME) - ulPmFlags |= FCF_DLGBORDER; - if (ulStyle & wxSYSTEM_MENU) - ulPmFlags |= FCF_SYSMENU; - if ((ulStyle & wxMINIMIZE) || (ulStyle & wxICONIZE)) - ulPmFlags |= WS_MINIMIZED; - if (ulStyle & wxMAXIMIZE) - ulPmFlags |= WS_MAXIMIZED; - if (ulStyle & wxCAPTION) - ulPmFlags |= FCF_TASKLIST; - if (ulStyle & wxCLIP_CHILDREN) { - // Invalid for frame windows under PM + if ((ulStyle & wxCAPTION) == wxCAPTION) + ulCreateFlags = FCF_TASKLIST; + else + ulCreateFlags = FCF_NOMOVEWITHOWNER; + + if ((ulStyle & wxVSCROLL) == wxVSCROLL) + ulCreateFlags |= FCF_VERTSCROLL; + if ((ulStyle & wxHSCROLL) == wxHSCROLL) + ulCreateFlags |= FCF_HORZSCROLL; + if (ulStyle & wxMINIMIZE_BOX) + ulCreateFlags |= FCF_MINBUTTON; + if (ulStyle & wxMAXIMIZE_BOX) + ulCreateFlags |= FCF_MAXBUTTON; + if (ulStyle & wxTHICK_FRAME) + ulCreateFlags |= FCF_DLGBORDER; + if (ulStyle & wxSYSTEM_MENU) + ulCreateFlags |= FCF_SYSMENU; + if (ulStyle & wxCAPTION) + ulCreateFlags |= FCF_TASKLIST; + if (ulStyle & wxCLIP_CHILDREN) + { + // Invalid for frame windows under PM + } + + if (ulStyle & wxTINY_CAPTION_VERT) + ulCreateFlags |= FCF_TASKLIST; + if (ulStyle & wxTINY_CAPTION_HORIZ) + ulCreateFlags |= FCF_TASKLIST; + + if ((ulStyle & wxTHICK_FRAME) == 0) + ulCreateFlags |= FCF_BORDER; + if (ulStyle & wxFRAME_TOOL_WINDOW) + ulExtraFlags = kFrameToolWindow; + + if (ulStyle & wxSTAY_ON_TOP) + ulCreateFlags |= FCF_SYSMODAL; } + if ((ulStyle & wxMINIMIZE) || (ulStyle & wxICONIZE)) + ulStyleFlags |= WS_MINIMIZED; + if (ulStyle & wxMAXIMIZE) + ulStyleFlags |= WS_MAXIMIZED; // - // Keep this in wxFrame because it saves recoding this function - // in wxTinyFrame + // Clear the visible flag, we always call show // -#if wxUSE_ITSY_BITSY - if (ulStyle & wxTINY_CAPTION_VERT) - ulExtraFlags |= kVertCaption; - if (ulStyle & wxTINY_CAPTION_HORIZ) - ulExtraFlags |= kHorzCaption; -#else - if (ulStyle & wxTINY_CAPTION_VERT) - ulPmFlags |= FCF_TASKLIST; - if (ulStyle & wxTINY_CAPTION_HORIZ) - ulPmFlags |= FCF_TASKLIST; -#endif - if ((ulStyle & wxTHICK_FRAME) == 0) - ulPmFlags |= FCF_BORDER; - if (ulStyle & wxFRAME_TOOL_WINDOW) - ulExtraFlags = kFrameToolWindow; + ulStyleFlags &= (unsigned long)~WS_VISIBLE; + m_bIconized = FALSE; - if (ulStyle & wxSTAY_ON_TOP) - ulPmFlags |= FCF_SYSMODAL; + // + // Set the frame control block + // + vFrameCtlData.cb = sizeof(vFrameCtlData); + vFrameCtlData.flCreateFlags = ulCreateFlags; + vFrameCtlData.hmodResources = 0L; + vFrameCtlData.idResources = 0; - if (ulPmFlags & ulTempFlags) - ulPmFlags = FCF_STANDARD; // - // Clear the visible flag, we always call show + // Create the frame window // - ulPmFlags &= (unsigned long)~WS_VISIBLE; - m_bIconized = FALSE; - if ( !wxWindow::OS2Create( nId - ,pParent - ,zWclass - ,pWxWin - ,zTitle - ,nX - ,nY - ,nWidth - ,nHeight - ,ulPmFlags - ,NULL - ,ulExtraFlags)) + if ((m_hFrame = ::WinCreateWindow( hParent // Frame is parent + ,WC_FRAME // standard frame class + ,(PSZ)zTitle // Window title + ,0 // No styles + ,0, 0, 0, 0 // Window position + ,NULLHANDLE // Owner + ,HWND_TOP // Sibling + ,(ULONG)nId // ID + ,(PVOID)&vFrameCtlData // Creation data + ,NULL // Window Pres Params + )) == 0L) { return FALSE; } + + if (!wxWindow::OS2Create( m_hFrame + ,wxFrameClassName + ,NULL + ,0L + ,0L + ,0L + ,0L + ,0L + ,NULLHANDLE + ,HWND_TOP + ,(unsigned long)FID_CLIENT + ,NULL + ,NULL + )) + { + return FALSE; + } + + // + // Now size everything. If adding a menu the client will need to be resized. + // + if (!::WinSetWindowPos( m_hFrame + ,HWND_TOP + ,nX + ,nY + ,nWidth + ,nHeight + ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER + )) + return FALSE; + + uCtlCount = SHORT1FROMMP(::WinSendMsg(m_hFrame, WM_FORMATFRAME, (MPARAM)vSwp, (MPARAM)vRect)); + for (int i = 0; i < uCtlCount; i++) + { + if (vSwp[i].hwnd == m_hFrame) + memcpy(&m_vSwp, &vSwp[i], sizeof(SWP)); + else if (vSwp[i].hwnd == m_hVScroll) + memcpy(&m_vSwpVScroll, &vSwp[i], sizeof(SWP)); + else if (vSwp[i].hwnd == m_hHScroll) + memcpy(&m_vSwpVScroll, &vSwp[i], sizeof(SWP)); + else if (vSwp[i].hwnd == m_hTitleBar) + memcpy(&m_vSwpTitleBar, &vSwp[i], sizeof(SWP)); + } + + // + // Now set the size of the client + // + WinSetWindowPos( hClient + ,HWND_TOP + ,SV_CXSIZEBORDER/2 + ,(SV_CYSIZEBORDER/2) + m_vSwpHScroll.cy/2 + ,m_vSwp.cx - ((SV_CXSIZEBORDER + 1) + m_vSwpVScroll.cx) + ,m_vSwp.cy - ((SV_CYSIZEBORDER + 1) + m_vSwpTitleBar.cy + m_vSwpHScroll.cy/2) + ,SWP_SIZE | SWP_MOVE + ); + + // + // Set the client window's background, otherwise it is transparent! + // return TRUE; } // end of wxFrame::OS2Create @@ -905,8 +1116,7 @@ void wxFrame::PositionToolBar() HWND hWndClient; RECTL vRect; - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); - ::WinQueryWindowRect(hWndClient, &vRect); + ::WinQueryWindowRect(GetHwnd(), &vRect); #if wxUSE_STATUSBAR if (GetStatusBar()) @@ -990,8 +1200,6 @@ bool wxFrame::OS2TranslateMessage( WXMSG* pMsg ) { - if (wxWindow::OS2TranslateMessage(pMsg)) - return TRUE; // // try the menu bar accels // @@ -1001,7 +1209,7 @@ bool wxFrame::OS2TranslateMessage( return FALSE; const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable(); - return rAcceleratorTable.Translate(this, pMsg); + return rAcceleratorTable.Translate(m_hFrame, pMsg); } // end of wxFrame::OS2TranslateMessage // --------------------------------------------------------------------------- @@ -1011,7 +1219,7 @@ bool wxFrame::HandlePaint() { RECTL vRect; - if (::WinQueryUpdateRect(GetHwnd(), &vRect)) + if (::WinQueryUpdateRect(m_hFrame, &vRect)) { if (m_bIconized) { @@ -1021,7 +1229,7 @@ bool wxFrame::HandlePaint() HPOINTER hIcon; if (m_icon.Ok()) - hIcon = (HPOINTER)::WinSendMsg(GetHwnd(), WM_QUERYICON, 0L, 0L); + hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L); else hIcon = (HPOINTER)m_hDefaultIcon; @@ -1030,7 +1238,7 @@ bool wxFrame::HandlePaint() // is being processed // RECTL vRect2; - HPS hPs = ::WinBeginPaint(GetHwnd(), NULLHANDLE, &vRect2); + HPS hPs = ::WinBeginPaint(m_hFrame, NULLHANDLE, &vRect2); // // Erase background before painting or we get white background @@ -1042,8 +1250,7 @@ bool wxFrame::HandlePaint() HWND hWndClient; RECTL vRect3; - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); - ::WinQueryWindowRect(hWndClient, &vRect3); + ::WinQueryWindowRect(GetHwnd(), &vRect3); static const int nIconWidth = 32; static const int nIconHeight = 32; @@ -1057,6 +1264,13 @@ bool wxFrame::HandlePaint() } else { + HPS hPS; + RECTL vRect; + + hPS = WinBeginPaint(GetHwnd(), 0L, &vRect); + WinFillRect(hPS, &vRect, SYSCLR_WINDOW); + WinEndPaint(hPS); + return wxWindow::HandlePaint(); } } @@ -1282,12 +1496,21 @@ MRESULT wxFrame::OS2WindowProc( bProcessed = HandlePaint(); break; + case WM_ERASEBACKGROUND: + // + // Return TRUE to request PM to paint the window background + // in SYSCLR_WINDOW. + // + bProcessed = TRUE; + mRc = (MRESULT)(TRUE); + break; + case CM_QUERYDRAGIMAGE: { HPOINTER hIcon; if (m_icon.Ok()) - hIcon = (HPOINTER)::WinSendMsg(GetHwnd(), WM_QUERYICON, 0L, 0L); + hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L); else hIcon = (HPOINTER)m_hDefaultIcon; mRc = (MRESULT)hIcon;