OwnerDrawn updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9567 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1208,17 +1208,6 @@ void wxDC::DoGetTextExtent(
|
|||||||
if(vPtMax.x < avPoint[i].x) vPtMax.x = avPoint[i].x;
|
if(vPtMax.x < avPoint[i].x) vPtMax.x = avPoint[i].x;
|
||||||
if(vPtMax.y < avPoint[i].y) vPtMax.y = avPoint[i].y;
|
if(vPtMax.y < avPoint[i].y) vPtMax.y = avPoint[i].y;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
sprintf(zMsg, "Extents for %s, are: Minx: %ld, Miny: %ld, Maxx: %ld, Maxy: %ld", vPtMin.x
|
|
||||||
, vPtMin.y
|
|
||||||
, vPtMax.x
|
|
||||||
, vPtMax.y
|
|
||||||
);
|
|
||||||
(void)wxMessageBox( "wxWindows Menu sample"
|
|
||||||
,zMsg
|
|
||||||
,wxICON_INFORMATION
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
::GpiQueryFontMetrics( m_hPS
|
::GpiQueryFontMetrics( m_hPS
|
||||||
,sizeof(FONTMETRICS)
|
,sizeof(FONTMETRICS)
|
||||||
,&vFM
|
,&vFM
|
||||||
|
@@ -22,68 +22,163 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
||||||
|
|
||||||
/*
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
* Memory DC
|
// Memory DC
|
||||||
*
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
*/
|
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(void)
|
wxMemoryDC::wxMemoryDC(void)
|
||||||
{
|
{
|
||||||
// TODO:
|
HDC hDC;
|
||||||
/*
|
HPS hPS;
|
||||||
m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) NULL);
|
DEVOPENSTRUC vDOP = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
|
||||||
m_ok = (m_hDC != 0);
|
SIZEL vSize = {0, 0};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a memory device context
|
||||||
|
//
|
||||||
|
hDC = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDOP, NULLHANDLE);
|
||||||
|
if (hDC != DEV_ERROR)
|
||||||
|
{
|
||||||
|
hPS = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||||
|
if (hPS != GPI_ERROR)
|
||||||
|
{
|
||||||
|
m_hPS = hPS;
|
||||||
|
m_hDC = hDC;
|
||||||
|
m_ok = TRUE;
|
||||||
m_bOwnsDC = TRUE;
|
m_bOwnsDC = TRUE;
|
||||||
|
|
||||||
SetBrush(*wxWHITE_BRUSH);
|
SetBrush(*wxWHITE_BRUSH);
|
||||||
SetPen(*wxBLACK_PEN);
|
SetPen(*wxBLACK_PEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_hPS = NULLHANDLE;
|
||||||
|
m_hDC = NULLHANDLE;
|
||||||
|
m_ok = FALSE;
|
||||||
|
m_bOwnsDC = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_hPS = NULLHANDLE;
|
||||||
|
m_hDC = NULLHANDLE;
|
||||||
|
m_ok = FALSE;
|
||||||
|
m_bOwnsDC = FALSE;
|
||||||
|
}
|
||||||
|
} // end of wxMemoryDC::wxMemoryDC
|
||||||
|
|
||||||
// the background mode is only used for text background
|
wxMemoryDC::wxMemoryDC(
|
||||||
// and is set in DrawText() to OPAQUE as required, other-
|
wxDC* pOldDC
|
||||||
// wise always TRANSPARENT, RR
|
)
|
||||||
::SetBkMode( GetHdc(), TRANSPARENT );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(wxDC *old_dc)
|
|
||||||
{
|
{
|
||||||
// TODO:
|
HDC hDC;
|
||||||
/*
|
HPS hPS;
|
||||||
old_dc->BeginDrawing();
|
DEVOPENSTRUC vDOP = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
|
||||||
|
SIZEL vSize = {0, 0};
|
||||||
|
|
||||||
m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) old_dc->GetHDC());
|
pOldDC->BeginDrawing();
|
||||||
m_ok = (m_hDC != 0);
|
|
||||||
|
|
||||||
old_dc->EndDrawing();
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a memory device context
|
||||||
|
//
|
||||||
|
hDC = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDOP, GetHdcOf(*pOldDC));
|
||||||
|
if (hDC != DEV_ERROR)
|
||||||
|
{
|
||||||
|
hPS = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||||
|
if (hPS != GPI_ERROR)
|
||||||
|
{
|
||||||
|
m_hPS = hPS;
|
||||||
|
m_hDC = hDC;
|
||||||
|
m_ok = TRUE;
|
||||||
|
m_bOwnsDC = TRUE;
|
||||||
|
pOldDC->EndDrawing();
|
||||||
SetBrush(*wxWHITE_BRUSH);
|
SetBrush(*wxWHITE_BRUSH);
|
||||||
SetPen(*wxBLACK_PEN);
|
SetPen(*wxBLACK_PEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pOldDC->EndDrawing();
|
||||||
|
m_hPS = NULLHANDLE;
|
||||||
|
m_hDC = NULLHANDLE;
|
||||||
|
m_ok = FALSE;
|
||||||
|
m_bOwnsDC = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pOldDC->EndDrawing();
|
||||||
|
m_hPS = NULLHANDLE;
|
||||||
|
m_hDC = NULLHANDLE;
|
||||||
|
m_ok = FALSE;
|
||||||
|
m_bOwnsDC = FALSE;
|
||||||
|
}
|
||||||
|
} // end of wxMemoryDC::wxMemoryDC
|
||||||
|
|
||||||
// the background mode is only used for text background
|
wxMemoryDC::~wxMemoryDC()
|
||||||
// and is set in DrawText() to OPAQUE as required, other-
|
|
||||||
// wise always TRANSPARENT, RR
|
|
||||||
::SetBkMode( GetHdc(), TRANSPARENT );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC(void)
|
|
||||||
{
|
{
|
||||||
};
|
if (m_hPS != NULLHANDLE)
|
||||||
|
::GpiDestroyPS(m_hPS);
|
||||||
|
if (m_hDC != NULLHANDLE)
|
||||||
|
::DevCloseDC(m_hDC);
|
||||||
|
} // end of wxMemoryDC::~wxMemoryDC
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::SelectObject(
|
||||||
|
const wxBitmap& rBitmap
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// TODO:
|
//
|
||||||
};
|
// Select old bitmap out of the device context
|
||||||
|
//
|
||||||
|
if (m_hOldBitmap)
|
||||||
|
{
|
||||||
|
::GpiSetBitmap(m_hPS, NULLHANDLE);
|
||||||
|
if (m_vSelectedBitmap.Ok())
|
||||||
|
{
|
||||||
|
m_vSelectedBitmap.SetSelectedInto(NULL);
|
||||||
|
m_vSelectedBitmap = wxNullBitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxMemoryDC::DoGetSize( int *width, int *height ) const
|
//
|
||||||
|
// Check for whether the bitmap is already selected into a device context
|
||||||
|
//
|
||||||
|
wxCHECK_RET( !rBitmap.GetSelectedInto() ||
|
||||||
|
(rBitmap.GetSelectedInto() == this),
|
||||||
|
wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)") );
|
||||||
|
|
||||||
|
m_vSelectedBitmap = rBitmap;
|
||||||
|
|
||||||
|
WXHBITMAP hBmp = m_vSelectedBitmap.GetHBITMAP();
|
||||||
|
|
||||||
|
if (!hBmp)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_vSelectedBitmap.SetSelectedInto(this);
|
||||||
|
hBmp = (WXHBITMAP)::GpiSetBitmap(m_hPS, (HBITMAP)hBmp);
|
||||||
|
|
||||||
|
if (hBmp != HBM_ERROR)
|
||||||
|
{
|
||||||
|
wxLogLastError(wxT("SelectObject(memDC, bitmap)"));
|
||||||
|
wxFAIL_MSG(wxT("Couldn't select a bitmap into wxMemoryDC"));
|
||||||
|
}
|
||||||
|
else if (!m_hOldBitmap)
|
||||||
|
{
|
||||||
|
m_hOldBitmap = hBmp;
|
||||||
|
}
|
||||||
|
} // end of wxMemoryDC::SelectObject
|
||||||
|
|
||||||
|
void wxMemoryDC::DoGetSize(
|
||||||
|
int* pWidth
|
||||||
|
, int* pHeight
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
if (!m_vSelectedBitmap.Ok())
|
if (!m_vSelectedBitmap.Ok())
|
||||||
{
|
{
|
||||||
*width = 0; *height = 0;
|
*pWidth = 0;
|
||||||
|
*pHeight = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*width = m_vSelectedBitmap.GetWidth();
|
*pWidth = m_vSelectedBitmap.GetWidth();
|
||||||
*height = m_vSelectedBitmap.GetHeight();
|
*pHeight = m_vSelectedBitmap.GetHeight();
|
||||||
};
|
} // end of wxMemoryDC::DoGetSize
|
||||||
|
|
||||||
|
|
||||||
|
@@ -330,7 +330,7 @@ bool wxMenu::DoInsertOrAppend(
|
|||||||
// Will eventually need to set the image handle somewhere into vItem.hItem
|
// Will eventually need to set the image handle somewhere into vItem.hItem
|
||||||
//
|
//
|
||||||
rItem.afStyle |= MIS_OWNERDRAW;
|
rItem.afStyle |= MIS_OWNERDRAW;
|
||||||
pData = (BYTE*)pItem;
|
pData = (BYTE*)NULL;
|
||||||
rItem.hItem = (HBITMAP)pItem->GetBitmap().GetHBITMAP();
|
rItem.hItem = (HBITMAP)pItem->GetBitmap().GetHBITMAP();
|
||||||
pItem->m_vMenuData.afStyle = rItem.afStyle;
|
pItem->m_vMenuData.afStyle = rItem.afStyle;
|
||||||
pItem->m_vMenuData.hItem = rItem.hItem;
|
pItem->m_vMenuData.hItem = rItem.hItem;
|
||||||
|
@@ -75,39 +75,27 @@ bool wxOwnerDrawn::OnMeasureItem(
|
|||||||
|
|
||||||
wxString sStr = wxStripMenuCodes(m_strName);
|
wxString sStr = wxStripMenuCodes(m_strName);
|
||||||
|
|
||||||
//
|
wxString sTgt = "\t";
|
||||||
// # without this menu items look too tightly packed (at least under Windows)
|
size_t nIndex;
|
||||||
//
|
|
||||||
sStr += wxT('W'); // 'W' is typically the widest letter
|
nIndex = sStr.Find(sTgt.c_str());
|
||||||
|
if (nIndex != -1)
|
||||||
|
sStr.Remove(nIndex);
|
||||||
|
sTgt = "~";
|
||||||
|
nIndex = sStr.Find(sTgt.c_str());
|
||||||
|
if (nIndex != -1)
|
||||||
|
sStr.Replace(sTgt.c_str(), "", TRUE);
|
||||||
|
|
||||||
vDC.GetTextExtent( sStr
|
vDC.GetTextExtent( sStr
|
||||||
,(long *)pWidth
|
,(long *)pWidth
|
||||||
,(long *)pHeight
|
,(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.
|
|
||||||
//
|
|
||||||
(*pHeight) = (*pHeight) + 2;
|
(*pHeight) = (*pHeight) + 2;
|
||||||
m_nHeight = *pHeight; // remember height for use in OnDrawItem
|
m_nHeight = *pHeight; // remember height for use in OnDrawItem
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // end of wxOwnerDrawn::OnMeasureItem
|
} // end of wxOwnerDrawn::OnMeasureItem
|
||||||
|
|
||||||
// searching for this macro you'll find all the code where I'm using the native
|
|
||||||
// Win32 GDI functions and not wxWindows ones. Might help to whoever decides to
|
|
||||||
// port this code to X. (VZ)
|
|
||||||
|
|
||||||
// JACS: TODO. Why does a disabled but highlighted item still
|
|
||||||
// get drawn embossed? How can we tell DrawState that we don't want the
|
|
||||||
// embossing?
|
|
||||||
|
|
||||||
// draw the item
|
// draw the item
|
||||||
bool wxOwnerDrawn::OnDrawItem(
|
bool wxOwnerDrawn::OnDrawItem(
|
||||||
wxDC& rDC
|
wxDC& rDC
|
||||||
@@ -117,12 +105,9 @@ bool wxOwnerDrawn::OnDrawItem(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// For now we let PM deal with highlighting and framing and such in a
|
// We do nothing on focus change
|
||||||
// default manner. So we leave fsAttribute and fsOldAttribute ( or
|
if (eAction == wxODFocusChanged )
|
||||||
// fsState and fsOldState ) the same and pass it on. We may want to add
|
return TRUE;
|
||||||
// code later to draw theseattributes in a more custom manner.
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// WxWinGdi_CColour <-> RGB
|
// WxWinGdi_CColour <-> RGB
|
||||||
//
|
//
|
||||||
@@ -137,22 +122,22 @@ bool wxOwnerDrawn::OnDrawItem(
|
|||||||
|
|
||||||
if (eStatus & wxODSelected)
|
if (eStatus & wxODSelected)
|
||||||
{
|
{
|
||||||
lColBack = (DWORD)::WinQuerySysColor( HWND_DESKTOP
|
lColBack = (ULONG)::WinQuerySysColor( HWND_DESKTOP
|
||||||
,SYSCLR_MENUHILITEBGND // Light gray
|
,SYSCLR_MENUHILITEBGND // Light gray
|
||||||
,0L
|
,0L
|
||||||
);
|
);
|
||||||
lColText = (DWORD)::WinQuerySysColor( HWND_DESKTOP
|
lColText = (ULONG)::WinQuerySysColor( HWND_DESKTOP
|
||||||
,SYSCLR_MENUTEXT // Black
|
,SYSCLR_MENUTEXT // Black
|
||||||
,0L
|
,0L
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (eStatus & wxODDisabled)
|
else if (eStatus & wxODDisabled)
|
||||||
{
|
{
|
||||||
lColBack = (DWORD)::WinQuerySysColor( HWND_DESKTOP
|
lColBack = (ULONG)::WinQuerySysColor( HWND_DESKTOP
|
||||||
,SYSCLR_MENU // Light gray
|
,SYSCLR_MENU // Light gray
|
||||||
,0L
|
,0L
|
||||||
);
|
);
|
||||||
lColText = (DWORD)::WinQuerySysColor( HWND_DESKTOP
|
lColText = (ULONG)::WinQuerySysColor( HWND_DESKTOP
|
||||||
,SYSCLR_MENUDISABLEDTEXT // dark gray
|
,SYSCLR_MENUDISABLEDTEXT // dark gray
|
||||||
,0L
|
,0L
|
||||||
);
|
);
|
||||||
@@ -217,11 +202,27 @@ bool wxOwnerDrawn::OnDrawItem(
|
|||||||
// to handle them ourselves. Notice Win32 can't handle \t in ownerdrawn
|
// to handle them ourselves. Notice Win32 can't handle \t in ownerdrawn
|
||||||
// strings either.
|
// strings either.
|
||||||
|
|
||||||
|
//
|
||||||
|
// Manually replace the tab with spaces
|
||||||
|
//
|
||||||
|
wxString sTgt = "\t";
|
||||||
|
wxString sReplace = " ";
|
||||||
|
size_t nIndex;
|
||||||
|
|
||||||
|
nIndex = m_strName.Find(sTgt.c_str());
|
||||||
|
if (nIndex != -1)
|
||||||
|
m_strName.Replace(sTgt.c_str(), sReplace.c_str(), TRUE);
|
||||||
|
sTgt = "~";
|
||||||
|
nIndex = m_strName.Find(sTgt.c_str());
|
||||||
|
if (nIndex != -1)
|
||||||
|
m_strName.Replace(sTgt.c_str(), "", TRUE);
|
||||||
|
|
||||||
rDC.DrawText( m_strName
|
rDC.DrawText( m_strName
|
||||||
,nX
|
,nX
|
||||||
,rRect.y
|
,rRect.y + 4
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#if 0
|
||||||
//
|
//
|
||||||
// Draw the bitmap
|
// Draw the bitmap
|
||||||
// ---------------
|
// ---------------
|
||||||
@@ -311,8 +312,8 @@ bool wxOwnerDrawn::OnDrawItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} // end of wxOwnerDrawn::OnDrawItem
|
||||||
|
|
||||||
#endif //wxUSE_OWNER_DRAWN
|
#endif //wxUSE_OWNER_DRAWN
|
||||||
|
@@ -1988,13 +1988,6 @@ MRESULT wxWindow::OS2WindowProc(
|
|||||||
|
|
||||||
if ( uMsg == WM_DRAWITEM )
|
if ( uMsg == WM_DRAWITEM )
|
||||||
{
|
{
|
||||||
// DEBUG
|
|
||||||
sprintf(zMsg, "In OS2OnDrawItem, id: %d", nIdCtrl);
|
|
||||||
(void)wxMessageBox( "wxWindows Menu sample"
|
|
||||||
,zMsg
|
|
||||||
,wxICON_INFORMATION
|
|
||||||
);
|
|
||||||
// end DEBUG
|
|
||||||
bProcessed = OS2OnDrawItem(nIdCtrl,
|
bProcessed = OS2OnDrawItem(nIdCtrl,
|
||||||
(WXDRAWITEMSTRUCT *)lParam);
|
(WXDRAWITEMSTRUCT *)lParam);
|
||||||
}
|
}
|
||||||
@@ -2672,48 +2665,75 @@ bool wxWindow::OS2OnDrawItem(
|
|||||||
if (vId == 0)
|
if (vId == 0)
|
||||||
{
|
{
|
||||||
POWNERITEM pMeasureStruct = (POWNERITEM)pItemStruct;
|
POWNERITEM pMeasureStruct = (POWNERITEM)pItemStruct;
|
||||||
BYTE* pData;
|
wxFrame* pFrame = (wxFrame*)this;
|
||||||
wxMenuItem* pMenuItem;
|
wxMenuItem* pMenuItem = pFrame->GetMenuBar()->FindItem(pMeasureStruct->idItem, pMeasureStruct->hItem);
|
||||||
HDC hDC = ::GpiQueryDevice(pMeasureStruct->hps);
|
HDC hDC = ::GpiQueryDevice(pMeasureStruct->hps);
|
||||||
|
wxRect vRect( pMeasureStruct->rclItem.xLeft
|
||||||
|
,pMeasureStruct->rclItem.yBottom
|
||||||
|
,pMeasureStruct->rclItem.xRight - pMeasureStruct->rclItem.xLeft
|
||||||
|
,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
|
||||||
|
);
|
||||||
vDc.SetHDC( hDC
|
vDc.SetHDC( hDC
|
||||||
,FALSE
|
,FALSE
|
||||||
);
|
);
|
||||||
vDc.SetHPS(pMeasureStruct->hps);
|
vDc.SetHPS(pMeasureStruct->hps);
|
||||||
#if 0
|
|
||||||
//
|
|
||||||
// We stored the CMenuItem itself into the menuitem text field so now
|
|
||||||
// we need to extract it.
|
|
||||||
//
|
|
||||||
::WinSendMsg( pMeasureStruct->hItem
|
|
||||||
,MM_QUERYITEMTEXT
|
|
||||||
,MPFROM2SHORT( (USHORT)pMeasureStruct->idItem
|
|
||||||
,(SHORT)(sizeof(wxMenuItem))
|
|
||||||
)
|
|
||||||
,(PSZ)pData
|
|
||||||
);
|
|
||||||
wxRect vRect( pMeasureStruct->rclItem.xLeft
|
|
||||||
,pMeasureStruct->rclItem.yTop
|
|
||||||
,pMeasureStruct->rclItem.xRight
|
|
||||||
,pMeasureStruct->rclItem.yBottom
|
|
||||||
);
|
|
||||||
|
|
||||||
wxOwnerDrawn::wxODAction eAction;
|
wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
|
||||||
|
|
||||||
|
|
||||||
|
int eAction = 0;
|
||||||
|
int eStatus = 0;
|
||||||
|
|
||||||
//
|
|
||||||
// Attribute applies to menuitems, fsState to listbox and other controls
|
|
||||||
//
|
|
||||||
if (pMeasureStruct->fsAttribute == pMeasureStruct->fsAttributeOld)
|
if (pMeasureStruct->fsAttribute == pMeasureStruct->fsAttributeOld)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Entire Item needs to be redrawn (either it has reappeared from
|
||||||
|
// behind another window or is being displayed for the first time
|
||||||
|
//
|
||||||
eAction = wxOwnerDrawn::wxODDrawAll;
|
eAction = wxOwnerDrawn::wxODDrawAll;
|
||||||
|
|
||||||
|
if (pMeasureStruct->fsAttribute & MIA_HILITED)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// If it is currently selected we let the system handle it
|
||||||
|
//
|
||||||
|
eStatus |= wxOwnerDrawn::wxODSelected;
|
||||||
|
}
|
||||||
|
if (pMeasureStruct->fsAttribute & MIA_CHECKED)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// If it is currently checked we draw our own
|
||||||
|
//
|
||||||
|
eStatus |= wxOwnerDrawn::wxODChecked;
|
||||||
|
pMeasureStruct->fsAttributeOld = pMeasureStruct->fsAttribute &= ~MIA_CHECKED;
|
||||||
|
}
|
||||||
|
if (pMeasureStruct->fsAttribute & MIA_DISABLED)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// If it is currently disabled we let the system handle it
|
||||||
|
//
|
||||||
|
eStatus |= wxOwnerDrawn::wxODDisabled;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Don't really care about framed (indicationg focus) or NoDismiss
|
||||||
|
//
|
||||||
|
}
|
||||||
else
|
else
|
||||||
eAction = wxOwnerDrawn::wxODSelectChanged;
|
{
|
||||||
pMenuItem = (wxMenuItem*)pData;
|
//
|
||||||
|
// For now we don't care about doing our own highlighting so we'll
|
||||||
|
// just ignore the entie message!
|
||||||
|
//
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Now redraw the item
|
||||||
|
//
|
||||||
return(pMenuItem->OnDrawItem( vDc
|
return(pMenuItem->OnDrawItem( vDc
|
||||||
,vRect
|
,vRect
|
||||||
,eAction
|
,(wxOwnerDrawn::wxODAction)eAction
|
||||||
,(wxOwnerDrawn::wxODStatus)pMeasureStruct->fsAttribute
|
,(wxOwnerDrawn::wxODStatus)eStatus
|
||||||
));
|
));
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// leave the fsAttribute and fsOldAttribute unchanged. If different,
|
// leave the fsAttribute and fsOldAttribute unchanged. If different,
|
||||||
// the system will do the highlight or fraeming or disabling for us,
|
// the system will do the highlight or fraeming or disabling for us,
|
||||||
|
Reference in New Issue
Block a user