bsnes/hiro/cocoa/widget/table-view-item.cpp
byuu 5ba538ee39 v108.10
* provide actual display device names in ruby::Video::hasMonitors()
* macOS: fixed LineEdit::onChange (fixes state manager state naming)
* macOS: fixed RadioLabel height to not clip off bottom of radio icons
* macOS: fixed RadioLabel initial check states (fixed input settings
focus mode options)
* macOS: fixed TableViewItem::setSelected (fixes initial selection on
settings/tools windows)
* macOS: fixed TextEdit geometry (fixed manifest viewer)
* macOS: don't allow multiple TableViewItems to be selected in
single-selection mode
** (fixes settings/tools windows selecting multiple items via menubar
options)
2019-08-17 23:41:44 +09:00

62 lines
1.4 KiB
C++

#if defined(Hiro_TableView)
namespace hiro {
auto pTableViewItem::construct() -> void {
}
auto pTableViewItem::destruct() -> void {
}
auto pTableViewItem::append(sTableViewCell cell) -> void {
@autoreleasepool {
if(auto tableView = _parent()) {
[[tableView->cocoaView content] reloadData];
}
}
}
auto pTableViewItem::remove(sTableViewCell cell) -> void {
@autoreleasepool {
if(auto tableView = _parent()) {
[[tableView->cocoaView content] reloadData];
}
}
}
auto pTableViewItem::setAlignment(Alignment alignment) -> void {
}
auto pTableViewItem::setBackgroundColor(Color color) -> void {
}
auto pTableViewItem::setFocused() -> void {
}
auto pTableViewItem::setForegroundColor(Color color) -> void {
}
auto pTableViewItem::setSelected(bool selected) -> void {
@autoreleasepool {
if(auto tableView = _parent()) {
auto lock = tableView->acquire();
auto indexSet = [[NSMutableIndexSet alloc] init];
for(auto& item : tableView->state().items) {
if(item->selected()) [indexSet addIndex:item->offset()];
}
[[tableView->cocoaView content] selectRowIndexes:indexSet byExtendingSelection:NO];
[indexSet release];
}
}
}
auto pTableViewItem::_parent() -> maybe<pTableView&> {
if(auto parent = self().parentTableView()) {
if(auto self = parent->self()) return *self;
}
return nothing;
}
}
#endif