2015-12-30 06:41:46 +00:00
|
|
|
#if defined(Hiro_Widget)
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
namespace hiro {
|
|
|
|
|
|
|
|
auto pWidget::construct() -> void {
|
|
|
|
@autoreleasepool {
|
|
|
|
if(!cocoaView) {
|
|
|
|
abstract = true;
|
|
|
|
cocoaView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)];
|
|
|
|
[cocoaView setHidden:true];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(auto window = self().parentWindow(true)) {
|
|
|
|
if(auto p = window->self()) p->_append(self());
|
2019-07-07 09:44:09 +00:00
|
|
|
setDroppable(self().droppable());
|
2015-12-30 06:41:46 +00:00
|
|
|
setEnabled(self().enabled(true));
|
2019-07-07 09:44:09 +00:00
|
|
|
setFocusable(self().focusable());
|
2015-12-30 06:41:46 +00:00
|
|
|
setFont(self().font(true));
|
2019-07-07 09:44:09 +00:00
|
|
|
setMouseCursor(self().mouseCursor());
|
Update to v106r57 release.
byuu says:
I've added tool tips to hiro for Windows, GTK, and Qt. I'm unsure how to
add them for Cocoa. I wasted am embarrassing ~14 hours implementing tool
tips from scratch on Windows, because the `TOOLTIPS_CLASS` widget just
absolutely refused to show up, no matter what I tried. As such, they're
not quite 100% native, but I would really appreciate any patch
submissions to help improve my implementation.
I added tool tips to all of the confusing settings in bsnes. And of
course, for those of you who don't like them, there's a configuration
file setting to turn them off globally.
I also improved Mega Drive handling of the Game Genie a bit, and
restructured the way the Settings class works in bsnes.
Starting now, I'm feature-freezing bsnes and higan. From this point
forward:
- polishing up and fixing bugs caused by the ruby/hiro changes
- adding DRC to XAudio2, and maybe exclusive mode to WGL
- correcting FEoEZ (English) to load and work again out of the box
Once that's done, a final beta of bsnes will go out, I'll fix any
reported bugs that I'm able to, and then v107 should be ready. This time
with higan being functional, but marked as v107 beta. v108 will restore
higan to production status again, alongside bsnes.
2018-08-08 08:46:58 +00:00
|
|
|
setToolTip(self().toolTip());
|
2015-12-30 06:41:46 +00:00
|
|
|
setVisible(self().visible(true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pWidget::destruct() -> void {
|
|
|
|
@autoreleasepool {
|
2016-01-07 08:14:33 +00:00
|
|
|
[cocoaView removeFromSuperview];
|
2015-12-30 06:41:46 +00:00
|
|
|
[cocoaView release];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pWidget::focused() const -> bool {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
|
|
|
return cocoaView == [[cocoaView window] firstResponder];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto pWidget::setDroppable(bool droppable) -> void {
|
|
|
|
//virtual
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pWidget::setEnabled(bool enabled) -> void {
|
|
|
|
if(abstract) enabled = false;
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
@autoreleasepool {
|
|
|
|
if([cocoaView respondsToSelector:@selector(setEnabled:)]) {
|
|
|
|
[cocoaView setEnabled:enabled];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto pWidget::setFocusable(bool focusable) -> void {
|
|
|
|
//virtual
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pWidget::setFocused() -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
|
|
|
[[cocoaView window] makeFirstResponder:cocoaView];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pWidget::setFont(const Font& font) -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
|
|
|
if([cocoaView respondsToSelector:@selector(setFont:)]) {
|
2015-12-30 06:41:46 +00:00
|
|
|
[cocoaView setFont:pFont::create(font)];
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pWidget::setGeometry(Geometry geometry) -> void {
|
2013-03-15 13:11:33 +00:00
|
|
|
@autoreleasepool {
|
|
|
|
CGFloat windowHeight = [[cocoaView superview] frame].size.height;
|
2015-12-30 06:41:46 +00:00
|
|
|
[cocoaView setFrame:NSMakeRect(geometry.x(), windowHeight - geometry.y() - geometry.height(), geometry.width(), geometry.height())];
|
2013-03-15 13:11:33 +00:00
|
|
|
[[cocoaView superview] setNeedsDisplay:YES];
|
|
|
|
}
|
Update to v106r57 release.
byuu says:
I've added tool tips to hiro for Windows, GTK, and Qt. I'm unsure how to
add them for Cocoa. I wasted am embarrassing ~14 hours implementing tool
tips from scratch on Windows, because the `TOOLTIPS_CLASS` widget just
absolutely refused to show up, no matter what I tried. As such, they're
not quite 100% native, but I would really appreciate any patch
submissions to help improve my implementation.
I added tool tips to all of the confusing settings in bsnes. And of
course, for those of you who don't like them, there's a configuration
file setting to turn them off globally.
I also improved Mega Drive handling of the Game Genie a bit, and
restructured the way the Settings class works in bsnes.
Starting now, I'm feature-freezing bsnes and higan. From this point
forward:
- polishing up and fixing bugs caused by the ruby/hiro changes
- adding DRC to XAudio2, and maybe exclusive mode to WGL
- correcting FEoEZ (English) to load and work again out of the box
Once that's done, a final beta of bsnes will go out, I'll fix any
reported bugs that I'm able to, and then v107 should be ready. This time
with higan being functional, but marked as v107 beta. v108 will restore
higan to production status again, alongside bsnes.
2018-08-08 08:46:58 +00:00
|
|
|
pSizable::setGeometry(geometry);
|
|
|
|
}
|
|
|
|
|
2019-07-07 09:44:09 +00:00
|
|
|
auto pWidget::setMouseCursor(const MouseCursor& mouseCursor) -> void {
|
|
|
|
//TODO
|
|
|
|
}
|
|
|
|
|
Update to v106r57 release.
byuu says:
I've added tool tips to hiro for Windows, GTK, and Qt. I'm unsure how to
add them for Cocoa. I wasted am embarrassing ~14 hours implementing tool
tips from scratch on Windows, because the `TOOLTIPS_CLASS` widget just
absolutely refused to show up, no matter what I tried. As such, they're
not quite 100% native, but I would really appreciate any patch
submissions to help improve my implementation.
I added tool tips to all of the confusing settings in bsnes. And of
course, for those of you who don't like them, there's a configuration
file setting to turn them off globally.
I also improved Mega Drive handling of the Game Genie a bit, and
restructured the way the Settings class works in bsnes.
Starting now, I'm feature-freezing bsnes and higan. From this point
forward:
- polishing up and fixing bugs caused by the ruby/hiro changes
- adding DRC to XAudio2, and maybe exclusive mode to WGL
- correcting FEoEZ (English) to load and work again out of the box
Once that's done, a final beta of bsnes will go out, I'll fix any
reported bugs that I'm able to, and then v107 should be ready. This time
with higan being functional, but marked as v107 beta. v108 will restore
higan to production status again, alongside bsnes.
2018-08-08 08:46:58 +00:00
|
|
|
auto pWidget::setToolTip(const string& toolTip) -> void {
|
|
|
|
//TODO
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto pWidget::setVisible(bool visible) -> void {
|
|
|
|
if(abstract) visible = false;
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
@autoreleasepool {
|
|
|
|
[cocoaView setHidden:!visible];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
#endif
|