void pMenu::append(Action &action) {
if(parentWindow) parentWindow->p.updateMenu();
}
void pMenu::setText(const string &text) {
if(parentWindow) parentWindow->p.updateMenu();
}
void pMenu::constructor() {
hmenu = 0;
}
//Windows actions lack the ability to toggle visibility.
//To support this, menus must be destroyed and recreated when toggling any action's visibility.
void pMenu::update(Window &parentWindow, HMENU parentMenu) {
this->parentWindow = &parentWindow;
this->parentMenu = parentMenu;
if(hmenu) DestroyMenu(hmenu);
hmenu = CreatePopupMenu();
foreach(action, menu.state.action) {
action.p.parentWindow = &parentWindow;
action.p.parentMenu = hmenu;
unsigned enabled = action.state.enabled ? 0 : MF_GRAYED;
if(dynamic_cast