SavvyUI C++ UI Library
Loading...
Searching...
No Matches
MenuBar.h
Go to the documentation of this file.
1#pragma once
2
3#include "./Common.h"
4
6{
7public:
8 long _actionId; // Identifier for the menu action (used in event handling)
9 wstring _text; // Text to display on the menu item
10 BOOL _isSeparator; // Flag indicating if this item is a separator (true) or a normal item (false)
11
12 MenuItem(long actionId = 0, const wstring& text = L"", BOOL isSeparator = FALSE)
13 : _actionId(actionId), _text(text), _isSeparator(isSeparator) {}
14};
15
16class Menu
17{
18public:
19 HMENU _hMenu; // Native Windows menu handle
20 wstring _menuName; // Name/title of the menu (e.g., "File", "Edit")
21 vector<MenuItem> _items; // List of menu items (commands or separators)
22
23 Menu() : _hMenu(NULL) {}
24 Menu(const wstring& name) : _hMenu(NULL), _menuName(name) {}
25};
26
28{
29 HMENU _hMenuBar; // Handle to the native Windows menu bar
30 vector<Menu> _menus; // Collection of menus attached to this menu bar
31
32public:
33
35 virtual ~MenuBar();
36
41 void addMenu(const wstring& menuName);
42
49 void addMenuItem(const wstring& menuName, long actionId, const wstring& text);
50
55 void addMenuSeparator(const wstring& menuName);
56
61 void setMenu(WinHandle hWnd);
62};
HWND WinHandle
Definition Common.h:16
void addMenuSeparator(const wstring &menuName)
virtual ~MenuBar()
void setMenu(WinHandle hWnd)
void addMenu(const wstring &menuName)
void addMenuItem(const wstring &menuName, long actionId, const wstring &text)
Menu(const wstring &name)
Definition MenuBar.h:24
vector< MenuItem > _items
Definition MenuBar.h:21
HMENU _hMenu
Definition MenuBar.h:19
Menu()
Definition MenuBar.h:23
wstring _menuName
Definition MenuBar.h:20
wstring _text
Definition MenuBar.h:9
MenuItem(long actionId=0, const wstring &text=L"", BOOL isSeparator=FALSE)
Definition MenuBar.h:12
BOOL _isSeparator
Definition MenuBar.h:10
long _actionId
Definition MenuBar.h:8