well it looks like i found a way to fix it my adding my own draw routing to the CMFCPopupMenu
here's the code, i don't have time to explain how it works but it does
in MainFrame.h i add an override
virtual BOOL OnShowPopupMenu (CMFCPopupMenu* pMenuPopup);
then in MainFrame.cpp
BOOL CMainFrame::OnShowPopupMenu (CMFCPopupMenu* pMenuPopup)
{
CMDIFrameWndEx::OnShowPopupMenu(pMenuPopup);
if (pMenuPopup == NULL || pMenuPopup->GetMenuBar () == NULL)
{
return TRUE;
}
ReplaceRangeWithTabStyleMenuItem(pMenuPopup, ID_EDIT_TRIPLETIZETKEY, ID_EDIT_GHOSTGKEY);
ReplaceRangeWithTabStyleMenuItem(pMenuPopup, ID_EDIT_SNARE, ID_EDIT_RIDECYMBAL);
ReplaceRangeWithTabStyleMenuItem(pMenuPopup, ID_EDIT_JOGLEFT, ID_EDIT_MOVENOTEDOWN);
ReplaceRangeWithTabStyleMenuItem(pMenuPopup, ID_EDIT_TAILUP, ID_EDIT_TAILDOWN);
return TRUE;
}
void CMainFrame::ReplaceRangeWithTabStyleMenuItem(CMFCPopupMenu* pMenuPopup, UINT startId, UINT endId)
{
for (UINT uiLineStyleCmd = startId; uiLineStyleCmd <= endId; uiLineStyleCmd++)
{
int iIndex = pMenuPopup->GetMenuBar ()->CommandToIndex (uiLineStyleCmd);
if (iIndex >= 0)
{
CMFCPopupMenuBar* pMebuBar = pMenuPopup->GetMenuBar();
pMebuBar->m_bDisableSideBarInXPMode = TRUE;
CString strText = pMebuBar->GetButtonText (iIndex);
UINT uiStyle = pMebuBar->GetButtonStyle (iIndex);
pMebuBar->ReplaceButton(uiLineStyleCmd, CTabStyleMenuItem (uiLineStyleCmd, strText, uiStyle & TBBS_CHECKED));
}
}
}
the import part here is for every menu item in the range, i replace its class with CTabStyleMenuItem here
ReplaceButton(uiLineStyleCmd, CTabStyleMenuItem, ...
my menu strings look like this now
BEGIN
POPUP "Edit"
BEGIN
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
MENUITEM SEPARATOR
MENUITEM "Tripletize:T", ID_EDIT_TRIPLETIZETKEY
MENUITEM "Flam:F", ID_EDIT_FLAMFKEY
MENUITEM "Accent:A", ID_EDIT_ACCENTAKEY
MENUITEM "Ghost:G", ID_EDIT_GHOSTGKEY
POPUP "Insert note"
BEGIN
MENUITEM "Snare:S", ID_EDIT_SNARE
MENUITEM "Kick (Bass drum):K", ID_EDIT_BASS
MENUITEM "Closed High Hat:H", ID_EDIT_HIGHHAT
MENUITEM "Open High Hat:O", ID_EDIT_OPENHIGHHAT
MENUITEM "Crash Cymbal 1:C", ID_EDIT_CRASHCYMBAL1
MENUITEM "Crash Cymbal 2:V", ID_EDIT_CRASHCYMBAL2
MENUITEM "Ride Cymbal:R", ID_EDIT_RIDECYMBAL
END
POPUP "Move note"
BEGIN
MENUITEM "Move notes left:Left Arrow", ID_EDIT_JOGLEFT
MENUITEM "Move notes right:Right Arrow", ID_EDIT_JOGRIGHT
MENUITEM "Move note up:Up Arrow", ID_EDIT_MOVENOTEUP
MENUITEM "Move note down:Down Arrow", ID_EDIT_MOVENOTEDOWN
END
POPUP "Tail direction"
BEGIN
MENUITEM "Tail up:Shift+Up Arrow", ID_EDIT_TAILUP
MENUITEM "Tail down:Shift+Down Arrow", ID_EDIT_TAILDOWN
END
END
END
the ':' character in the menu test string will be replaced by right aligning the following text in my special draw routine.
so create the class
class CTabStyleMenuItem : public CMFCToolBarMenuButton
{
DECLARE_DYNCREATE(CTabStyleMenuItem)
public:
CTabStyleMenuItem(UINT uiCmdID = 0, LPCTSTR lpszText = NULL,
BOOL bIsChecked = FALSE);
virtual ~CTabStyleMenuItem();
protected:
virtual void OnDraw (CDC* pDC, const CRect& rect, CMFCToolBarImages* pImages,
BOOL bHorz = TRUE, BOOL bCustomizeMode = FALSE,
BOOL bHighlight = FALSE,
BOOL bDrawBorder = TRUE,
BOOL bGrayDisabledButtons = TRUE);
};
and
IMPLEMENT_DYNCREATE(CTabStyleMenuItem, CMFCToolBarMenuButton)
CTabStyleMenuItem::CTabStyleMenuItem(UINT uiCmdID, LPCTSTR lpszText,
BOOL bIsChecked) :
CMFCToolBarMenuButton (uiCmdID, NULL , -1 , lpszText)
{
if (bIsChecked)
{
m_nStyle |= TBBS_CHECKED;
}
}
CTabStyleMenuItem::~CTabStyleMenuItem()
{
}
void CTabStyleMenuItem::OnDraw (CDC* pDC, const CRect& rect, CMFCToolBarImages* ,
BOOL , BOOL , BOOL bHighlight,
BOOL , BOOL )
{
ASSERT_VALID (pDC);
CRect rectItem = rect;
rectItem.DeflateRect (1, 1);
FillInterior (pDC, rectItem, bHighlight);
int colonPos = m_strText.Find(':');
if(colonPos==-1) {
CRect rectText = rectItem;
rectText.left += afxGlobalData.GetTextWidth () +5;
rectText.right = rectText.left + afxGlobalData.GetTextWidth () * 4;
pDC->DrawText (m_strText, rectText, DT_SINGLELINE | DT_VCENTER);
} else {
CString left = m_strText.Left(colonPos);
CString right = m_strText.Right(m_strText.GetLength()-colonPos-1);
CRect rectText = rectItem;
rectText.left += afxGlobalData.GetTextWidth () +5;
rectText.right -= 10;
pDC->DrawText (left, rectText, DT_SINGLELINE | DT_VCENTER);
pDC->DrawText (right, rectText, DT_SINGLELINE | DT_VCENTER | DT_RIGHT);
}
if (m_nStyle & TBBS_CHECKED)
{
pDC->Draw3dRect (rectItem, GetSysColor (COLOR_3DSHADOW), GetSysColor (COLOR_3DHILIGHT));
}
else if (bHighlight)
{
pDC->Draw3dRect (rectItem, GetSysColor (COLOR_3DHILIGHT), GetSysColor (COLOR_3DSHADOW));
}
}
you can probably work it out from here