Files
bsnes/hiro/core/widget/tab-frame.cpp
Tim Allen f0c17ffc0d Update to v094r24 release.
byuu says:

Finally!! Compilation works once again on Windows.

However, it's pretty buggy. Modality isn't really working right, you can
still poke at other windows, but when you select ListView items, they
redraw as empty boxes (need to process WM_DRAWITEM before checking
modality.)

The program crashes when you close it (probably a ruby driver's term()
function, that's what it usually is.)

The Layout::setEnabled(false) call isn't working right, so you get that
annoying chiming sound and cursor movement when mapping keyboard keys to
game inputs.

The column sizing seems off a bit on first display for the Hotkeys tab.

And probably lots more.
2015-06-16 20:30:04 +10:00

98 lines
2.2 KiB
C++

#if defined(Hiro_TabFrame)
auto mTabFrame::allocate() -> pObject* {
return new pTabFrame(*this);
}
auto mTabFrame::destruct() -> void {
for(auto& item : state.items) item->destruct();
mWidget::destruct();
}
//
auto mTabFrame::append(sTabFrameItem item) -> type& {
state.items.append(item);
item->setParent(this, items() - 1);
signal(append, item);
return *this;
}
auto mTabFrame::doChange() const -> void {
if(state.onChange) return state.onChange();
}
auto mTabFrame::doClose(sTabFrameItem item) const -> void {
if(state.onClose) return state.onClose(item);
}
auto mTabFrame::doMove(sTabFrameItem from, sTabFrameItem to) const -> void {
if(state.onMove) return state.onMove(from, to);
}
auto mTabFrame::edge() const -> Edge {
return state.edge;
}
auto mTabFrame::item(unsigned position) const -> sTabFrameItem {
if(position < items()) return state.items[position];
return {};
}
auto mTabFrame::items() const -> unsigned {
return state.items.size();
}
auto mTabFrame::onChange(const function<void ()>& function) -> type& {
state.onChange = function;
return *this;
}
auto mTabFrame::onClose(const function<void (sTabFrameItem)>& function) -> type& {
state.onClose = function;
return *this;
}
auto mTabFrame::onMove(const function<void (sTabFrameItem, sTabFrameItem)>& function) -> type& {
state.onMove = function;
return *this;
}
auto mTabFrame::remove(sTabFrameItem item) -> type& {
auto offset = item->offset();
item->setParent();
signal(remove, item);
state.items.remove(item->offset());
for(auto n : range(offset, items())) {
state.items[n]->offset(-1);
}
return *this;
}
auto mTabFrame::reset() -> type& {
while(state.items) remove(state.items.last());
return *this;
}
auto mTabFrame::selected() const -> sTabFrameItem {
for(auto& item : state.items) {
if(item->selected()) return item;
}
return {};
}
auto mTabFrame::setEdge(Edge edge) -> type& {
state.edge = edge;
signal(setEdge, edge);
return *this;
}
auto mTabFrame::setParent(mObject* parent, signed offset) -> type& {
for(auto& item : state.items) item->destruct();
mObject::setParent(parent, offset);
for(auto& item : state.items) item->setParent(this, item->offset());
return *this;
}
#endif