More Ownerdraw menu updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8f70adc9c1
commit
4049cc1ccd
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user