Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Menu items customization Collapse All
Subject Author Date
Moby Dick Mar 7, 2005 - 3:30 AM

Hi,


I’ve seen the DRAWCLI sample for menus customization.


I’d like to change the font style (color, bold or italic, ...) and keep the standard menu design.


Should I use a derived class for this (how ?) or how to do this with the Prof-UIS function ?


Thanks.

Technical Support Mar 7, 2005 - 11:43 AM

To set custom GUI font, just re-create g_PaintManager->m_Font... font objects. Please take a look at the FunnyBars sample application, which shows how to change the GUI font for all Prof-UIS toolbars and menus on-the-fly. It seems what you really need.

Moby Dick Mar 8, 2005 - 1:38 AM

Hi,


Sorry but I didn’t correctly explain my problem.


I can’t calculate the rectangle for the item text, item checkmark and item shortcut. I think there are constants to help me do this, aren’t there ?


How can I calculate the position for each items of my menu ?


Thanks.

Technical Support Mar 8, 2005 - 11:47 AM

The CPagePopupMenus::OnDrawPopupMenuItem() method of the ProfUIS_Controls sample application handles the CExtPopupMenuWnd::g_nMsgPopupDrawItem registered windows message and repaints the command item identified with ID_OWNERDRAW_ITEM in the context menu on the "Popup Menus" dialog. The pDrawItemData data structure provides you with all information about the menu item. It also contains methods that paint different parts of the menu item by default. So, to draw the default background of the menu item, you can invoke pDrawItemData->PaintDefaultBk() and then draw a custom check mark, text etc. The pDrawItemData->m_pRectItem member describes the rectangle around the menu item. You need to invoke pDrawItemData->m_pItemData->GetIconAreaWidth() to get the width of the icon/check-mark/radio-mark area. This area is equal to the widest icon/check-mark/radio-mark in the sublevel of the pop-up menu. The rest of the space should be used for drawing text. You should also invoke pDrawItemData->m_pItemData->IsSeparator() to check whether the menu item is a separator and call pDrawItemData->m_pItemData->IsPopup() to check whether the menu item is a pop-up submenu.