2015-06-12 13:14:38 +00:00
|
|
|
#if defined(Hiro_Widget)
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
namespace hiro {
|
|
|
|
|
|
|
|
auto pWidget::construct() -> void {
|
|
|
|
abstract = true;
|
|
|
|
//todo: create hiroWidget
|
|
|
|
hwnd = CreateWindow(L"hiroLabel", L"", WS_CHILD, 0, 0, 0, 0, _parentHandle(), nullptr, GetModuleHandle(0), 0);
|
|
|
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&reference);
|
|
|
|
_setState();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pWidget::destruct() -> void {
|
|
|
|
DeleteObject(hfont);
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2015-06-15 22:16:43 +00:00
|
|
|
auto pWidget::focused() const -> bool {
|
|
|
|
auto focused = GetFocus();
|
|
|
|
return hwnd == focused || IsChild(hwnd, focused);
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::minimumSize() -> Size {
|
2013-03-15 13:11:33 +00:00
|
|
|
return {0, 0};
|
2011-03-22 12:56:49 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::setEnabled(bool enabled) -> void {
|
|
|
|
if(!self().parentWindow(true)) enabled = false;
|
|
|
|
if(!self().enabled(true)) enabled = false;
|
|
|
|
if(abstract) enabled = false;
|
2011-02-24 09:27:21 +00:00
|
|
|
EnableWindow(hwnd, enabled);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::setFocused() -> void {
|
2011-02-24 09:27:21 +00:00
|
|
|
SetFocus(hwnd);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::setFont(const string&) -> void {
|
|
|
|
auto font = self().font(true);
|
|
|
|
if(!font) font = Font::sans(8);
|
2011-09-05 03:48:23 +00:00
|
|
|
if(hfont) DeleteObject(hfont);
|
|
|
|
hfont = pFont::create(font);
|
|
|
|
SendMessage(hwnd, WM_SETFONT, (WPARAM)hfont, 0);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::setGeometry(Geometry geometry) -> void {
|
|
|
|
if(auto parent = _parentWidget()) {
|
2015-06-15 22:16:43 +00:00
|
|
|
auto displacement = parent->self().geometry().position();
|
2015-06-12 13:14:38 +00:00
|
|
|
geometry.setX(geometry.x() - displacement.x());
|
|
|
|
geometry.setY(geometry.y() - displacement.y());
|
2013-11-28 10:29:01 +00:00
|
|
|
}
|
2015-06-15 22:16:43 +00:00
|
|
|
SetWindowPos(hwnd, nullptr, geometry.x(), geometry.y(), geometry.width(), geometry.height(), SWP_NOZORDER);
|
2015-06-12 13:14:38 +00:00
|
|
|
self().doSize();
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::setVisible(bool visible) -> void {
|
|
|
|
if(!self().parentWindow(true)) visible = false;
|
|
|
|
if(!self().visible(true)) visible = false;
|
|
|
|
if(abstract) visible = false;
|
2011-02-24 09:27:21 +00:00
|
|
|
ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
//
|
2011-02-24 09:25:20 +00:00
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::_parentHandle() -> HWND {
|
2015-06-15 22:16:43 +00:00
|
|
|
if(auto parent = _parentWidget()) return parent->hwnd;
|
|
|
|
if(auto parent = _parentWindow()) return parent->hwnd;
|
|
|
|
return nullptr;
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 22:16:43 +00:00
|
|
|
auto pWidget::_parentWidget() -> maybe<pWidget&> {
|
2015-06-12 13:14:38 +00:00
|
|
|
#if defined(Hiro_TabFrame)
|
2015-06-15 22:16:43 +00:00
|
|
|
if(auto parent = self().parentTabFrame(true)) {
|
|
|
|
if(auto self = parent->self()) return *self;
|
|
|
|
}
|
2015-06-12 13:14:38 +00:00
|
|
|
#endif
|
|
|
|
return nothing;
|
2011-09-05 03:48:23 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 22:16:43 +00:00
|
|
|
auto pWidget::_parentWindow() -> maybe<pWindow&> {
|
|
|
|
if(auto parent = self().parentWindow(true)) {
|
|
|
|
if(auto self = parent->self()) return *self;
|
|
|
|
}
|
2015-06-12 13:14:38 +00:00
|
|
|
return nothing;
|
2011-09-05 03:48:23 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pWidget::_setState() -> void {
|
|
|
|
setEnabled(self().enabled());
|
|
|
|
setFont(self().font());
|
|
|
|
setVisible(self().visible());
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
}
|
2015-06-12 13:14:38 +00:00
|
|
|
|
|
|
|
#endif
|