]> git.saurik.com Git - wxWidgets.git/commitdiff
More Ownerdraw menu updates
authorDavid Webster <Dave.Webster@bhmi.com>
Tue, 20 Mar 2001 14:26:42 +0000 (14:26 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Tue, 20 Mar 2001 14:26:42 +0000 (14:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/os2/ownerdrw.cpp
src/os2/window.cpp

index c4a073c1f06714bde383a45a9e08bafe464d7364..c0fbe632fdd4c5d0ffc0aaf962e4a49fdca8d278 100644 (file)
@@ -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.
index d62b0942dcff838a83ec513d6c16fd51e079e90a..654424d2e385d6fe0d630eadee3b9bab74ac071a 100644 (file)
@@ -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);