bsnes/hiro/core/widget/tab-frame.cpp
Tim Allen 0955295475 Update to v098r08 release.
byuu says:

Changelog:
- nall/vector rewritten from scratch
- higan/audio uses nall/vector instead of raw pointers
- higan/sfc/coprocessor/sdd1 updated with new research information
- ruby/video/glx and ruby/video/glx2: fuck salt glXSwapIntervalEXT!

The big change here is definitely nall/vector. The Windows, OS X and Qt
ports won't compile until you change some first/last strings to
left/right, but GTK will compile.

I'd be really grateful if anyone could stress-test nall/vector. Pretty
much everything I do relies on this class. If we introduce a bug, the
worst case scenario is my entire SFC game dump database gets corrupted,
or the byuu.org server gets compromised. So it's really critical that we
test the hell out of this right now.

The S-DD1 changes mean you need to update your installation of icarus
again. Also, even though the Lunar FMV never really worked on the
accuracy core anyway (it didn't initialize the PPU properly), it really
won't work now that we emulate the hard-limit of 16MiB for S-DD1 games.
2016-05-02 19:57:04 +10:00

105 lines
2.5 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& {
if(!state.items) item->state.selected = true;
state.items.append(item);
item->setParent(this, itemCount() - 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::item(unsigned position) const -> TabFrameItem {
if(position < itemCount()) return state.items[position];
return {};
}
auto mTabFrame::itemCount() const -> unsigned {
return state.items.size();
}
auto mTabFrame::items() const -> vector<TabFrameItem> {
vector<TabFrameItem> items;
for(auto& item : state.items) items.append(item);
return items;
}
auto mTabFrame::navigation() const -> Navigation {
return state.navigation;
}
auto mTabFrame::onChange(const function<void ()>& callback) -> type& {
state.onChange = callback;
return *this;
}
auto mTabFrame::onClose(const function<void (TabFrameItem)>& callback) -> type& {
state.onClose = callback;
return *this;
}
auto mTabFrame::onMove(const function<void (TabFrameItem, TabFrameItem)>& callback) -> type& {
state.onMove = callback;
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, itemCount())) {
state.items[n]->adjustOffset(-1);
}
return *this;
}
auto mTabFrame::reset() -> type& {
while(state.items) remove(state.items.right());
return *this;
}
auto mTabFrame::selected() const -> TabFrameItem {
for(auto& item : state.items) {
if(item->selected()) return item;
}
return {};
}
auto mTabFrame::setNavigation(Navigation navigation) -> type& {
state.navigation = navigation;
signal(setNavigation, navigation);
return *this;
}
auto mTabFrame::setParent(mObject* parent, signed offset) -> type& {
for(auto n : rrange(state.items)) state.items[n]->destruct();
mObject::setParent(parent, offset);
for(auto& item : state.items) item->setParent(this, item->offset());
return *this;
}
#endif