X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7172b423aa146ab9b06e01605887b8deae263f87..cffbfebc684e000e4fd859b05b2f6fabae633c8a:/src/os2/window.cpp diff --git a/src/os2/window.cpp b/src/os2/window.cpp index e3b48ba2e7..94d3060d5e 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -329,6 +329,7 @@ bool wxWindow::Create( ) { HWND hParent = NULLHANDLE; + wxPoint vPos = rPos; // The OS/2 position wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent")); @@ -346,9 +347,19 @@ bool wxWindow::Create( { pParent->AddChild(this); hParent = GetWinHwnd(pParent); + // + // OS2 uses normal coordinates, no bassackwards Windows ones + // + vPos.y = pParent->GetSize().y - (vPos.y + rSize.y); } else - hParent = HWND_DESKTOP; + { + RECTL vRect; + + ::WinQueryWindowRect(HWND_DESKTOP, &vRect); + hParent = HWND_DESKTOP; + vPos.y = vRect.yTop - (vPos.y + rSize.y); + } ULONG ulCreateFlags = 0L; @@ -382,8 +393,8 @@ bool wxWindow::Create( ,(PSZ)wxCanvasClassName ,rName.c_str() ,ulCreateFlags - ,rPos.x - ,rPos.y + ,vPos.x + ,vPos.y ,WidthDefault(rSize.x) ,HeightDefault(rSize.y) ,NULLHANDLE @@ -2663,6 +2674,8 @@ bool wxWindow::OS2OnDrawItem( // if (vId == 0) { + ERRORID vError; + wxString sError; POWNERITEM pMeasureStruct = (POWNERITEM)pItemStruct; wxFrame* pFrame = (wxFrame*)this; wxMenuItem* pMenuItem = pFrame->GetMenuBar()->FindItem(pMeasureStruct->idItem, pMeasureStruct->hItem); @@ -2676,6 +2689,36 @@ bool wxWindow::OS2OnDrawItem( ,FALSE ); vDc.SetHPS(pMeasureStruct->hps); + // + // Load the wxWindows Pallete and set to RGB mode + // + if (!::GpiCreateLogColorTable( pMeasureStruct->hps + ,0L + ,LCOLF_CONSECRGB + ,0L + ,(LONG)wxTheColourDatabase->m_nSize + ,(PLONG)wxTheColourDatabase->m_palTable + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Unable to set current color table. Error: %s\n", sError); + } + // + // Set the color table to RGB mode + // + if (!::GpiCreateLogColorTable( pMeasureStruct->hps + ,0L + ,LCOLF_RGB + ,0L + ,0L + ,NULL + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Unable to set current color table. Error: %s\n", sError); + } wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE ); @@ -2719,11 +2762,32 @@ bool wxWindow::OS2OnDrawItem( } else { - // - // For now we don't care about doing our own highlighting so we'll - // just ignore the entie message! - // - return TRUE; + if (pMeasureStruct->fsAttribute & MIA_HILITED) + { + eAction = wxOwnerDrawn::wxODDrawAll; + eStatus |= wxOwnerDrawn::wxODSelected; + // + // Keep the system from trying to highlight with its bogus colors + // + pMeasureStruct->fsAttributeOld = pMeasureStruct->fsAttribute &= ~MIA_HILITED; + } + else if (!(pMeasureStruct->fsAttribute & MIA_HILITED)) + { + eAction = wxOwnerDrawn::wxODDrawAll; + eStatus = 0; + // + // Keep the system from trying to highlight with its bogus colors + // + pMeasureStruct->fsAttribute = pMeasureStruct->fsAttributeOld &= ~MIA_HILITED; + } + else + { + // + // For now we don't care about anything else + // just ignore the entire message! + // + return TRUE; + } } // // Now redraw the item @@ -2784,7 +2848,7 @@ bool wxWindow::OS2OnMeasureItem( return FALSE; } } - wxWindow* pItem = FindItem(id); + wxWindow* pItem = FindItem(lId); if (pItem && pItem->IsKindOf(CLASSINFO(wxControl))) {