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
|
#if defined(Hiro_ListView)
namespace hiro {
auto pListViewItem::construct() -> void {
}
auto pListViewItem::destruct() -> void {
if(auto parent = _parent()) parent->lock();
if(qtItem) {
delete qtItem;
qtItem = nullptr;
}
if(auto parent = _parent()) parent->unlock();
}
auto pListViewItem::append(sListViewCell cell) -> void {
}
auto pListViewItem::remove(sListViewCell cell) -> void {
}
auto pListViewItem::setAlignment(Alignment alignment) -> void {
_setState();
}
auto pListViewItem::setBackgroundColor(Color color) -> void {
_setState();
}
auto pListViewItem::setFont(const Font& font) -> void {
_setState();
}
auto pListViewItem::setForegroundColor(Color color) -> void {
_setState();
}
auto pListViewItem::setSelected(bool selected) -> void {
_setState();
}
auto pListViewItem::_parent() -> maybe<pListView&> {
if(auto parent = self().parentListView()) {
if(auto delegate = parent->self()) return *delegate;
}
return nothing;
}
auto pListViewItem::_setState() -> void {
if(auto parent = _parent()) {
qtItem->setSelected(state().selected);
if(state().selected) {
parent->qtListView->setCurrentItem(qtItem);
}
for(auto& cell : state().cells) {
if(auto self = cell->self()) self->_setState();
}
}
}
}
#endif
|