,(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.
//
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);