mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
* GB: integrated SameBoy v0.12.1 by Lior Halphon * SFC: added HG51B169 (Cx4) math tables into bsnes binary
53 lines
1 KiB
C++
Executable file
53 lines
1 KiB
C++
Executable file
#if defined(Hiro_MenuItem)
|
|
|
|
@implementation CocoaMenuItem : NSMenuItem
|
|
|
|
-(id) initWith:(hiro::mMenuItem&)menuItemReference {
|
|
if(self = [super initWithTitle:@"" action:@selector(activate) keyEquivalent:@""]) {
|
|
menuItem = &menuItemReference;
|
|
|
|
[self setTarget:self];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
-(void) activate {
|
|
menuItem->doActivate();
|
|
}
|
|
|
|
@end
|
|
|
|
namespace hiro {
|
|
|
|
auto pMenuItem::construct() -> void {
|
|
@autoreleasepool {
|
|
cocoaAction = cocoaMenuItem = [[CocoaMenuItem alloc] initWith:self()];
|
|
pAction::construct();
|
|
|
|
setIcon(state().icon);
|
|
setText(state().text);
|
|
}
|
|
}
|
|
|
|
auto pMenuItem::destruct() -> void {
|
|
@autoreleasepool {
|
|
[cocoaAction release];
|
|
}
|
|
}
|
|
|
|
auto pMenuItem::setIcon(const image& icon) -> void {
|
|
@autoreleasepool {
|
|
uint size = 15; //there is no API to retrieve the optimal size
|
|
[cocoaAction setImage:NSMakeImage(icon, size, size)];
|
|
}
|
|
}
|
|
|
|
auto pMenuItem::setText(const string& text) -> void {
|
|
@autoreleasepool {
|
|
[cocoaAction setTitle:[NSString stringWithUTF8String:text]];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|