Update to v106r36 release.

byuu says:

Changelog:

  - nall: renamed array to adaptive_array; marked it as deprecated
  - nall: created new array class; which is properly static (ala
    std::array) with optional bounds-checking
  - sfc/ppu-fast: converted unmanaged arrays to use nall/array (no speed
    penalty)
  - bsnes: rewrote the cheat code editor to a new design
  - nall: string class can stringify pointer types directly now, so
    pointer() was removed
  - nall: added array_view and pointer types (still unsure if/how I'll
    use pointer)
This commit is contained in:
Tim Allen
2018-06-04 12:44:57 +10:00
parent 77ac5f9e88
commit ec9729a9e1
26 changed files with 573 additions and 286 deletions

View File

@@ -1,6 +1,12 @@
#if defined(Hiro_ListView)
mListView::mListView() {
mTableView::onActivate([&] {
doActivate();
});
mTableView::onChange([&] {
doChange();
});
mTableView::onToggle([&](TableViewCell cell) {
if(auto item = cell->parentTableViewItem()) {
if(auto shared = item->instance.acquire()) {
@@ -18,6 +24,14 @@ auto mListView::batched() const -> vector<ListViewItem> {
return result;
}
auto mListView::doActivate() const -> void {
if(state.onActivate) state.onActivate();
}
auto mListView::doChange() const -> void {
if(state.onChange) state.onChange();
}
auto mListView::doToggle(ListViewItem item) const -> void {
if(state.onToggle) state.onToggle(item);
}
@@ -33,6 +47,16 @@ auto mListView::items() const -> vector<ListViewItem> {
return result;
}
auto mListView::onActivate(const function<void ()>& callback) -> type& {
state.onActivate = callback;
return *this;
}
auto mListView::onChange(const function<void ()>& callback) -> type& {
state.onChange = callback;
return *this;
}
auto mListView::onToggle(const function<void (ListViewItem)>& callback) -> type& {
state.onToggle = callback;
return *this;

View File

@@ -11,15 +11,21 @@ struct mListView : mTableView {
mListView();
auto batched() const -> vector<ListViewItem>;
auto doActivate() const -> void;
auto doChange() const -> void;
auto doToggle(ListViewItem) const -> void;
auto item(uint position) const -> ListViewItem;
auto items() const -> vector<ListViewItem>;
auto onActivate(const function<void ()>& callback) -> type&;
auto onChange(const function<void ()>& callback) -> type&;
auto onToggle(const function<void (ListViewItem)>& callback) -> type&;
auto reset() -> type& override;
auto selected() const -> ListViewItem;
//private:
struct State {
function<void ()> onActivate;
function<void ()> onChange;
function<void (ListViewItem)> onToggle;
} state;
};