| 1 |
#if defined(Hiro_TableView) |
| 2 |
|
| 3 |
namespace hiro { |
| 4 |
|
| 5 |
auto pTableViewCell::construct() -> void { |
| 6 |
} |
| 7 |
|
| 8 |
auto pTableViewCell::destruct() -> void { |
| 9 |
} |
| 10 |
|
| 11 |
auto pTableViewCell::setAlignment(Alignment alignment) -> void { |
| 12 |
_redraw(); |
| 13 |
} |
| 14 |
|
| 15 |
auto pTableViewCell::setBackgroundColor(Color color) -> void { |
| 16 |
_redraw(); |
| 17 |
} |
| 18 |
|
| 19 |
auto pTableViewCell::setCheckable(bool checkable) -> void { |
| 20 |
_redraw(); |
| 21 |
} |
| 22 |
|
| 23 |
auto pTableViewCell::setChecked(bool checked) -> void { |
| 24 |
_redraw(); |
| 25 |
} |
| 26 |
|
| 27 |
auto pTableViewCell::setForegroundColor(Color color) -> void { |
| 28 |
_redraw(); |
| 29 |
} |
| 30 |
|
| 31 |
auto pTableViewCell::setIcon(const image& icon) -> void { |
| 32 |
_redraw(); |
| 33 |
} |
| 34 |
|
| 35 |
auto pTableViewCell::setText(const string& text) -> void { |
| 36 |
_redraw(); |
| 37 |
} |
| 38 |
|
| 39 |
auto pTableViewCell::_grandparent() -> maybe<pTableView&> { |
| 40 |
if(auto parent = _parent()) return parent->_parent(); |
| 41 |
return nothing; |
| 42 |
} |
| 43 |
|
| 44 |
auto pTableViewCell::_parent() -> maybe<pTableViewItem&> { |
| 45 |
if(auto parent = self().parentTableViewItem()) { |
| 46 |
if(auto self = parent->self()) return *self; |
| 47 |
} |
| 48 |
return nothing; |
| 49 |
} |
| 50 |
|
| 51 |
auto pTableViewCell::_redraw() -> void { |
| 52 |
if(auto pTableViewItem = _parent()) { |
| 53 |
if(auto pTableView = _grandparent()) { |
| 54 |
auto column = self().offset(); |
| 55 |
auto row = pTableViewItem->self().offset(); |
| 56 |
NSRect rect = [[pTableView->cocoaTableView content] frameOfCellAtColumn:column row:row]; |
| 57 |
[[pTableView->cocoaTableView content] setNeedsDisplayInRect:rect]; |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
#endif |