2015-06-12 13:14:38 +00:00
|
|
|
#if defined(Hiro_ComboButton)
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
namespace hiro {
|
|
|
|
|
|
|
|
auto pComboButton::construct() -> void {
|
|
|
|
hwnd = CreateWindow(
|
|
|
|
L"COMBOBOX", L"",
|
|
|
|
WS_CHILD | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_HASSTRINGS,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
_parentHandle(), nullptr, GetModuleHandle(0), 0
|
|
|
|
);
|
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
|
|
|
pWidget::construct();
|
2015-06-12 13:14:38 +00:00
|
|
|
for(auto& item : state().items) append(item);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pComboButton::destruct() -> void {
|
|
|
|
DestroyWindow(hwnd);
|
2011-03-22 12:56:49 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pComboButton::append(sComboButtonItem item) -> void {
|
|
|
|
lock();
|
|
|
|
SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(wchar_t*)utf16_t(item->state.text));
|
|
|
|
if(item->state.selected) SendMessage(hwnd, CB_SETCURSEL, item->offset(), 0);
|
|
|
|
if(SendMessage(hwnd, CB_GETCURSEL, 0, 0) == CB_ERR) item->setSelected();
|
|
|
|
unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pComboButton::minimumSize() const -> Size {
|
|
|
|
signed width = 0;
|
|
|
|
for(auto& item : state().items) {
|
|
|
|
width = max(width, pFont::size(hfont, item->state.text).width());
|
|
|
|
}
|
Update to bsnes v107.1 release.
byuu says:
Don't let the point release fool you, there are many significant changes in this
release. I will be keeping bsnes releases using a point system until the new
higan release is ready.
Changelog:
- GUI: added high DPI support
- GUI: fixed the state manager image preview
- Windows: added a new waveOut driver with support for dynamic rate control
- Windows: corrected the XAudio 2.1 dynamic rate control support [BearOso]
- Windows: corrected the Direct3D 9.0 fullscreen exclusive window centering
- Windows: fixed XInput controller support on Windows 10
- SFC: added high-level emulation for the DSP1, DSP2, DSP4, ST010, and Cx4
coprocessors
- SFC: fixed a slight rendering glitch in the intro to Megalomania
If the coprocessor firmware is missing, bsnes will fallback on HLE where it is
supported, which is everything other than SD Gundam GX and the two Hayazashi
Nidan Morita Shougi games.
The Windows dynamic rate control works best with Direct3D in fullscreen
exclusive mode. I recommend the waveOut driver over the XAudio 2.1 driver, as it
is not possible to target a single XAudio2 version on all Windows OS releases.
The waveOut driver should work everywhere out of the box.
Note that with DRC, the synchronization source is your monitor, so you will
want to be running at 60hz (NTSC) or 50hz (PAL). If you have an adaptive sync
monitor, you should instead use the WASAPI (exclusive) or ASIO audio driver.
2019-04-09 01:16:30 +00:00
|
|
|
return {width + 24_sx, pFont::size(hfont, " ").height() + 10_sy};
|
2015-06-12 13:14:38 +00:00
|
|
|
}
|
2012-06-25 12:49:39 +00:00
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pComboButton::remove(sComboButtonItem item) -> void {
|
|
|
|
lock();
|
|
|
|
SendMessage(hwnd, CB_DELETESTRING, item->offset(), 0);
|
|
|
|
if(item->state.selected) SendMessage(hwnd, CB_SETCURSEL, 0, 0);
|
|
|
|
unlock();
|
2012-06-25 12:49:39 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pComboButton::reset() -> void {
|
2011-02-24 09:25:20 +00:00
|
|
|
SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
|
|
|
|
}
|
|
|
|
|
2019-09-16 18:37:03 +00:00
|
|
|
//Windows overrides the height parameter for a ComboButton's SetWindowPos to be the drop-down list height.
|
|
|
|
//the canonical way to set the actual height is through CB_SETITEMHEIGHT. However, doing so is bugged.
|
|
|
|
//the ComboButton will end up not being painted for ~500ms after calling ShowWindow(hwnd, SW_NORMAL) on it.
|
|
|
|
//thus, implementing windows that use multiple pages of controls via toggling visibility will flicker heavily.
|
|
|
|
//as a result, the best we can do is center the actual widget within the requested space.
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pComboButton::setGeometry(Geometry geometry) -> void {
|
2019-09-16 18:37:03 +00:00
|
|
|
//since the ComboButton has a fixed height, it will always be the same, even before calling setGeometry() once.
|
2013-11-28 10:29:01 +00:00
|
|
|
RECT rc;
|
|
|
|
GetWindowRect(hwnd, &rc);
|
2019-09-06 14:19:44 +00:00
|
|
|
geometry.setY(geometry.y() + (geometry.height() - (rc.bottom - rc.top)));
|
|
|
|
pWidget::setGeometry({geometry.x(), geometry.y(), geometry.width(), 1});
|
2013-11-28 10:29:01 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
auto pComboButton::onChange() -> void {
|
|
|
|
signed offset = SendMessage(hwnd, CB_GETCURSEL, 0, 0);
|
|
|
|
if(offset == CB_ERR) return;
|
|
|
|
for(auto& item : state().items) item->state.selected = false;
|
|
|
|
if(auto item = self().item(offset)) item->setSelected();
|
|
|
|
self().doChange();
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-06-12 13:14:38 +00:00
|
|
|
#endif
|