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

Windows port should run mostly well now, although exiting fullscreen
breaks the application in a really bizarre way. (clicking on the window
makes it sink to background rather than come to the foreground o_O)

I also need to add the doModalChange => audio.clear() thing for the
accursed menu stuttering with DirectSound.

I also finished porting all of the ruby drivers over to the newer API
changes from nall.

Since I can't compile the Linux or OS X drivers, I have no idea if there
are any typos that will result in compilation errors. If so, please let
me know where they're at and I'll try and fix them. If they're simple,
please try and fix them on your end to test further if you can.

I'm hopeful the udev crash will be gone now that nall::string checks for
null char* values passed to its stringify function. Of course, it's
a problem it's getting a null value in the first place, so it may not
work at all.

If you can compile on Linux (or by some miracle, OS X), please test each
video/audio/input driver if you don't mind, to make sure there's no
"compiles okay but still typos exist" bugs.
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 ()>& callback) -> type& {
state.onChange = callback;
return *this;
}
auto mTabFrame::onClose(const function<void (sTabFrameItem)>& callback) -> type& {
state.onClose = callback;
return *this;
}
auto mTabFrame::onMove(const function<void (sTabFrameItem, sTabFrameItem)>& 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, items())) {
state.items[n]->adjustOffset(-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