mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Finally!! Compilation works once again on Windows. However, it's pretty buggy. Modality isn't really working right, you can still poke at other windows, but when you select ListView items, they redraw as empty boxes (need to process WM_DRAWITEM before checking modality.) The program crashes when you close it (probably a ruby driver's term() function, that's what it usually is.) The Layout::setEnabled(false) call isn't working right, so you get that annoying chiming sound and cursor movement when mapping keyboard keys to game inputs. The column sizing seems off a bit on first display for the Hotkeys tab. And probably lots more.
84 lines
1.8 KiB
C++
84 lines
1.8 KiB
C++
#if defined(Hiro_MenuBar)
|
|
|
|
namespace hiro {
|
|
|
|
auto pMenuBar::construct() -> void {
|
|
_update();
|
|
}
|
|
|
|
auto pMenuBar::destruct() -> void {
|
|
if(hmenu) { DestroyMenu(hmenu); hmenu = nullptr; }
|
|
if(auto parent = _parent()) {
|
|
SetMenu(parent->hwnd, nullptr);
|
|
}
|
|
}
|
|
|
|
auto pMenuBar::append(sMenu) -> void {
|
|
_update();
|
|
}
|
|
|
|
auto pMenuBar::remove(sMenu) -> void {
|
|
_update();
|
|
}
|
|
|
|
auto pMenuBar::setEnabled(bool enabled) -> void {
|
|
_update();
|
|
}
|
|
|
|
auto pMenuBar::setFont(const string& font) -> void {
|
|
//unsupported
|
|
}
|
|
|
|
auto pMenuBar::setVisible(bool visible) -> void {
|
|
if(auto parent = _parent()) {
|
|
SetMenu(parent->hwnd, visible ? hmenu : nullptr);
|
|
parent->setGeometry(parent->state().geometry);
|
|
}
|
|
}
|
|
|
|
auto pMenuBar::_parent() -> maybe<pWindow&> {
|
|
if(auto parent = self().parentWindow(true)) {
|
|
if(auto self = parent->self()) return *self;
|
|
}
|
|
return nothing;
|
|
}
|
|
|
|
auto pMenuBar::_update() -> void {
|
|
if(hmenu) DestroyMenu(hmenu);
|
|
hmenu = CreateMenu();
|
|
|
|
MENUINFO mi{sizeof(MENUINFO)};
|
|
mi.fMask = MIM_STYLE;
|
|
mi.dwStyle = MNS_NOTIFYBYPOS; //| MNS_MODELESS;
|
|
SetMenuInfo(hmenu, &mi);
|
|
|
|
unsigned position = 0;
|
|
|
|
#if defined(Hiro_Menu)
|
|
for(auto& menu : state().menus) {
|
|
unsigned enabled = menu->enabled() ? 0 : MF_GRAYED;
|
|
|
|
MENUITEMINFO mii{sizeof(MENUITEMINFO)};
|
|
mii.fMask = MIIM_DATA;
|
|
mii.dwItemData = (ULONG_PTR)menu.data();
|
|
|
|
if(menu->visible()) {
|
|
if(auto self = menu->self()) {
|
|
self->_update();
|
|
AppendMenu(hmenu, MF_STRING | MF_POPUP | enabled, (UINT_PTR)self->hmenu, utf16_t(menu->text()));
|
|
SetMenuItemInfo(hmenu, position++, true, &mii);
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
if(auto parent = _parent()) {
|
|
SetMenu(parent->hwnd, self().visible(true) ? hmenu : nullptr);
|
|
parent->setGeometry(parent->state().geometry);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|