From 4049cc1ccd90f94ac97ce65357bd71a8162ecafb Mon Sep 17 00:00:00 2001 From: David Webster Date: Tue, 20 Mar 2001 14:26:42 +0000 Subject: [PATCH] More Ownerdraw menu updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/ownerdrw.cpp | 8 ++++++++ src/os2/window.cpp | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/os2/ownerdrw.cpp b/src/os2/ownerdrw.cpp index c4a073c1f0..c0fbe632fd 100644 --- a/src/os2/ownerdrw.cpp +++ b/src/os2/ownerdrw.cpp @@ -83,6 +83,14 @@ bool wxOwnerDrawn::OnMeasureItem( ,(long *)pWidth ,(long *)pHeight ); + // DEBUG + char zMsg[128]; + sprintf(zMsg, "GetTextExtent for %s: Width: %ld, Height: %ld", m_strName.c_str(), *pWidth, *pHeight); + (void)wxMessageBox( "wxWindows Menu sample" + ,zMsg + ,wxICON_INFORMATION + ); + // end DEBUG // // JACS: items still look too tightly packed, so adding 2 pixels. diff --git a/src/os2/window.cpp b/src/os2/window.cpp index d62b0942dc..654424d2e3 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -2741,18 +2741,28 @@ bool wxWindow::OS2OnMeasureItem( // if (lId == 65536) // I really don't like this...has to be a better indicator { - POWNERITEM pMeasureStruct = (POWNERITEM)pItemStruct; - char zData[sizeof(wxMenuItem)]; - - char zMsg[128]; - - if (IsKindOf(CLASSINFO(wxFrame))) + if (IsKindOf(CLASSINFO(wxFrame))) // we'll assume if Frame then a menu { + size_t nWidth; + size_t nHeight; + POWNERITEM pMeasureStruct = (POWNERITEM)pItemStruct; wxFrame* pFrame = (wxFrame*)this; wxMenuItem* pMenuItem = pFrame->GetMenuBar()->FindItem(pMeasureStruct->idItem, pMeasureStruct->hItem); wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE ); - return(pMenuItem->OnMeasureItem(&pMeasureStruct->rclItem)); + nWidth = 0L; + nHeight = 0L; + if (pMenuItem->OnMeasureItem( &nWidth + ,&nHeight + )) + { + pMeasureStruct->rclItem.xRight = nWidth; + pMeasureStruct->rclItem.xLeft = 0L; + pMeasureStruct->rclItem.yTop = nHeight; + pMeasureStruct->rclItem.yBottom = 0L; + return TRUE; + } + return FALSE; } } wxWindow* pItem = FindItem(id); -- 2.45.2