mirror of https://github.com/bsnes-emu/bsnes.git
67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
|
#if defined(Hiro_TableView)
|
||
|
|
||
|
namespace hiro {
|
||
|
|
||
|
auto pTableViewItem::construct() -> void {
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::destruct() -> void {
|
||
|
if(auto parent = _parent()) parent->lock();
|
||
|
if(qtItem) {
|
||
|
delete qtItem;
|
||
|
qtItem = nullptr;
|
||
|
}
|
||
|
if(auto parent = _parent()) parent->unlock();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::append(sTableViewCell cell) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::remove(sTableViewCell cell) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::setAlignment(Alignment alignment) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::setBackgroundColor(Color color) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::setFont(const Font& font) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::setForegroundColor(Color color) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::setSelected(bool selected) -> void {
|
||
|
_setState();
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::_parent() -> maybe<pTableView&> {
|
||
|
if(auto parent = self().parentTableView()) {
|
||
|
if(auto delegate = parent->self()) return *delegate;
|
||
|
}
|
||
|
return nothing;
|
||
|
}
|
||
|
|
||
|
auto pTableViewItem::_setState() -> void {
|
||
|
if(auto parent = _parent()) {
|
||
|
qtItem->setSelected(state().selected);
|
||
|
if(state().selected) {
|
||
|
parent->qtTableView->setCurrentItem(qtItem);
|
||
|
}
|
||
|
for(auto& cell : state().cells) {
|
||
|
if(auto self = cell->self()) self->_setState();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|