1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#if defined(Hiro_TableView)
namespace hiro {
auto pTableViewItem::construct() -> void {
}
auto pTableViewItem::destruct() -> void {
if(auto parent = _parent()) {
auto lock = parent->acquire();
if(qtItem) {
delete qtItem;
qtItem = nullptr;
}
}
}
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()) {
auto lock = parent->acquire();
qtItem->setSelected(state().selected);
if(state().selected) {
parent->qtTableView->setCurrentItem(qtItem);
}
for(auto& cell : state().cells) {
if(auto self = cell->self()) self->_setState();
}
}
}
}
#endif
|