Implement owner draw menu bar MFC - c++

I want to create an owner draw menu bar (by menu bar I mean a bar that has the same width as the application window, not just to fit the menus) like the one in the image below
(Notice the menu item on the right and the background color for the bar that takes the full width of the window)
I only want the buttons to be customized (the size and the rectangle with a border on hover, and another effect when they're active), the menu popup itself has to be the Windows' default menu.
What have I done so far?
I managed to create the owner draw menu, but I have the following problems:
the menu bar rectangle is only as wide as the widths of the items summed up (I need it to take full window width)
all the menu items are styled uniformly (I only want the top buttons to be styled like that)
How can I get the desired look for my menu?

Related

Is there a way to scale radio buttons or checkboxes for MFC CDialog?

We scale the controls in the dialog based on a current "zoom" font size. Works great for text, edit controls, group boxes.
However, the physical radio button circle and checkbox squares are all the same/original "100%" size.
Other than writing our own controls, is there a way to scale the standard radio button or checkbox graphics?

QT, advance GUI, fancy context menu

i am working on a Qt project and i want to make a fancy context pie right click.... menu.
like the one in the image
bellow
I am using QGraphicsItem, QGraphicsScene, QGraphicsView, and setting the background transparent by
setAttribute(Qt::WA_TranslucentBackground);
setStyleSheet("background: transparent ;border: none;");
what i want to achieve is when user hove over the circle and it is a sub-menu then a pie menu will appears but,
The problem is:
sadly mouse events will not emit unless its touching a solid pixel from my QGraphicsView, so when mouse cursor hove over a sub-menu the red pie will appear BUT as soon as i move to click on a sector from the pie it will disappear because i am no longer hovering over the orange circle.
any another good idea or solution so i can get mouse events over my transparent area (i will calculate the distance from the orange circle and if the mouse IN RANGE the pie will stay shown)
thanks.
I think you can do this :
Hover the orange one and the sub menu appear.
Keep the sub menu appear until your mouse hover nothing or hover another circle menu. When you move your mouse to sub menu -> it means you hover thing, so the sub menu will still there. If your sub menus are all same, so when you hover another circle, just move sub menu position and maybe set some property.
Make sure that your orange circle and the sub menu is overlap, so moving mouse from orange to sub menu will not trigger "hover nothing"

Get color of highlighted menu item

How can I get default color of a highlighted menu item in qt?
I want to add a multiline menu item such as this. So I created a custom class inherited from QWidgetAction. I want to emulate native look&feel for this menu item. When the widget is under mouse, I need to change it's background color to default background of a highlighted menu item.

Make a Toolbar have a grid layout

I want to make a QToolBar have 3 columns of buttons when docked on the left side of the QMainWindow, but have 1 row when docked on the top of the main window. Is this possible?
I have a tried using a QToolBar with a custom layout, but the normal re-size behavior of the QToolBar doesn’t work (doesn’t hide widgets behind an expand button when its too small). The non-working expand button isn’t that big of a deal, but the bigger problem is that the custom layout prevents the main window from being smaller than the toolbar.
I was able to get my desired behavior by putting each row of Tool Buttons in a QHBoxLayout, putting that layout in a empty QWidget, and calling toolBar->addWidget( widget ) for each row. This gives me a grid toolbar when the toolbar is mounted on the left, and single horizontal bar when mounted on the top.

CreateSimpleReBar in WTL vista/7 native look and feel

When using the CreateSimpleReBar in WTL the main menu bar has this blue color on mouse hover and not the native vista/7 round and transparent shape. Also for some reason the menu bar seems taller then the usual native one.
Does CreateSimpleReBar draw the menu itself or am I missing something?
http://imageshack.us/photo/my-images/259/wtlmainmenu.png/
HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
// attach menu
m_CmdBar.AttachMenu(GetMenu());
// load command bar images
m_CmdBar.LoadImages(IDR_MAINFRAME);
// remove old menu
SetMenu(NULL);
// Set m_hWndToolBar member
CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
// Add a band to the rebar represented by m_hWndToolBar
AddSimpleReBarBand(hWndCmdBar);
CreateSimpleReBar creates a rebar control, and the menu is one of the rebar bands, created by m_CmdBar.Create - WTL's CCommandBarCtrl class. The latter custom-draws the menu to mimic OS behavior, including blue highlighting with COLOR_MENUHILIGHT (atlctrlw.h).