bsnes/hiro/windows/action/menu-item.cpp
Tim Allen 20cc6148cb Update to v094r27 release.
byuu says:

Added AWJ's fixes for alt/cpu (Tetris Attack framelines issue) and
alt/dsp (Thread::clock reset)

Added fix so that the taskbar entry appears when the application first
starts on Windows.

Fixed checkbox toggling inside of list views on Windows.

Updated nall/image to properly protect variables that should not be
written externally.

New Object syntax for hiro is in.

Fixed the backwards-typing on Windows with the state manager.
NOTE: the list view isn't redrawing when you change the description
text. It does so on the cheat editor because of the resizeColumns call;
but that shouldn't be necessary. I'll try and fix this for the next WIP.
2015-06-18 20:48:53 +10:00

40 lines
876 B
C++

#if defined(Hiro_MenuItem)
namespace hiro {
auto pMenuItem::construct() -> void {
_createBitmap();
}
auto pMenuItem::destruct() -> void {
if(hbitmap) { DeleteObject(hbitmap); hbitmap = nullptr; }
}
auto pMenuItem::setIcon(const image& icon) -> void {
_createBitmap();
_synchronize();
}
auto pMenuItem::setText(const string& text) -> void {
_synchronize();
}
auto pMenuItem::onActivate() -> void {
self().doActivate();
}
auto pMenuItem::_createBitmap() -> void {
if(hbitmap) { DeleteObject(hbitmap); hbitmap = nullptr; }
if(auto icon = state().icon) {
icon.transform();
icon.alphaBlend(GetSysColor(COLOR_MENU)); //Windows does not alpha blend menu icons properly (leaves black outline)
icon.scale(GetSystemMetrics(SM_CXMENUCHECK), GetSystemMetrics(SM_CYMENUCHECK), Interpolation::Linear);
hbitmap = CreateBitmap(icon);
}
}
}
#endif