| 1 |
#if defined(Hiro_TableView) |
| 2 |
|
| 3 |
namespace hiro { |
| 4 |
|
| 5 |
auto pTableViewColumn::construct() -> void { |
| 6 |
if(auto tableView = _parent()) { |
| 7 |
[(CocoaTableView*)(tableView->cocoaView) reloadColumns]; |
| 8 |
} |
| 9 |
} |
| 10 |
|
| 11 |
auto pTableViewColumn::destruct() -> void { |
| 12 |
if(auto tableView = _parent()) { |
| 13 |
[(CocoaTableView*)(tableView->cocoaView) reloadColumns]; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
auto pTableViewColumn::setActive() -> void { |
| 18 |
} |
| 19 |
|
| 20 |
auto pTableViewColumn::setAlignment(Alignment alignment) -> void { |
| 21 |
} |
| 22 |
|
| 23 |
auto pTableViewColumn::setBackgroundColor(Color color) -> void { |
| 24 |
} |
| 25 |
|
| 26 |
auto pTableViewColumn::setEditable(bool editable) -> void { |
| 27 |
} |
| 28 |
|
| 29 |
auto pTableViewColumn::setExpandable(bool expandable) -> void { |
| 30 |
} |
| 31 |
|
| 32 |
auto pTableViewColumn::setFont(const Font& font) -> void { |
| 33 |
} |
| 34 |
|
| 35 |
auto pTableViewColumn::setForegroundColor(Color color) -> void { |
| 36 |
} |
| 37 |
|
| 38 |
auto pTableViewColumn::setHorizontalAlignment(double alignment) -> void { |
| 39 |
} |
| 40 |
|
| 41 |
auto pTableViewColumn::setIcon(const image& icon) -> void { |
| 42 |
//TODO |
| 43 |
} |
| 44 |
|
| 45 |
auto pTableViewColumn::setResizable(bool resizable) -> void { |
| 46 |
} |
| 47 |
|
| 48 |
auto pTableViewColumn::setSorting(Sort sorting) -> void { |
| 49 |
setText(state().text); |
| 50 |
} |
| 51 |
|
| 52 |
auto pTableViewColumn::setText(const string& text) -> void { |
| 53 |
if(auto parent = _parent()) { |
| 54 |
string label = text; |
| 55 |
if(state().sorting == Sort::Ascending ) label.append(" \u25b4"); |
| 56 |
if(state().sorting == Sort::Descending) label.append(" \u25be"); |
| 57 |
NSTableColumn* tableColumn = [[(CocoaTableView*)(parent->cocoaView) content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:self().offset()] stringValue]]; |
| 58 |
[[tableColumn headerCell] setStringValue:[NSString stringWithUTF8String:label]]; |
| 59 |
[[[(CocoaTableView*)(parent->cocoaView) content] headerView] setNeedsDisplay:YES]; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
auto pTableViewColumn::setVerticalAlignment(double alignment) -> void { |
| 64 |
} |
| 65 |
|
| 66 |
auto pTableViewColumn::setVisible(bool visible) -> void { |
| 67 |
} |
| 68 |
|
| 69 |
auto pTableViewColumn::setWidth(signed width) -> void { |
| 70 |
if(auto parent = _parent()) { |
| 71 |
NSTableColumn* tableColumn = [[(CocoaTableView*)(parent->cocoaView) content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:self().offset()] stringValue]]; |
| 72 |
tableColumn.width = width; |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
auto pTableViewColumn::_parent() -> maybe<pTableView&> { |
| 77 |
if(auto parent = self().parentTableView()) { |
| 78 |
if(auto self = parent->self()) return *self; |
| 79 |
} |
| 80 |
return {}; |
| 81 |
} |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
#endif |