bsnes/hiro/qt/widget/combo-button.cpp
Tim Allen 213879771e Update to v094r41 release (open beta).
byuu says:

Changelog (since the last open beta):
- icarus is now included. icarus is used to import game files/archives
  into game paks (folders)
- SNES: mid-scanline BGMODE changes now emulated correctly (used only by
  atx2.smc Anthrox Demo)
- GBA: fixed a CPU bug that was causing dozens of games to have
  distorted audio
- GBA: fixed default FlashROM ID; should allow much higher compatibility
- GBA: now using Cydrak's new, much improved, GBA color emulation filter
  (still a work-in-progress)
- re-added command-line loading support for game paks (not for game
  files/archives, sorry!)
- Qt port now compiles and runs again (may be a little buggy;
  Windows/GTK+ ports preferred)
- SNES performance profile now compiles and runs again
- much more
2015-08-21 20:57:03 +10:00

51 lines
1.2 KiB
C++

#if defined(Hiro_ComboButton)
namespace hiro {
auto pComboButton::construct() -> void {
qtWidget = qtComboButton = new QtComboButton(*this);
qtComboButton->connect(qtComboButton, SIGNAL(currentIndexChanged(int)), SLOT(onChange(int)));
pWidget::construct();
}
auto pComboButton::destruct() -> void {
delete qtComboButton;
qtWidget = qtComboButton = nullptr;
}
auto pComboButton::append(sComboButtonItem item) -> void {
}
auto pComboButton::minimumSize() const -> Size {
signed maximumWidth = 0;
for(auto& item : state().items) {
maximumWidth = max(maximumWidth, pFont::size(qtWidget->font(), item->state.text).width());
}
auto size = pFont::size(qtWidget->font(), " ");
return {maximumWidth + 32, size.height() + 12};
}
auto pComboButton::remove(sComboButtonItem item) -> void {
}
auto pComboButton::reset() -> void {
lock();
while(qtComboButton->count()) qtComboButton->removeItem(0);
unlock();
}
auto QtComboButton::onChange(int offset) -> void {
for(auto& item : p.state().items) {
item->state.selected = false;
}
if(auto item = p.self().item(offset)) {
item->state.selected = true;
}
if(!p.locked()) p.self().doChange();
}
}
#endif