Debian Codegraph @

hiro/cocoa/widget/table-view-item.cpp

raw
1 #if defined(Hiro_TableView)
2
3 namespace hiro {
4
5 auto pTableViewItem::construct() -> void {
6 }
7
8 auto pTableViewItem::destruct() -> void {
9 }
10
11 auto pTableViewItem::append(sTableViewCell cell) -> void {
12 if(auto tableView = _parent()) {
13 [[(CocoaTableView*)(tableView->cocoaView) content] reloadData];
14 }
15 }
16
17 auto pTableViewItem::remove(sTableViewCell cell) -> void {
18 if(auto tableView = _parent()) {
19 [[(CocoaTableView*)(tableView->cocoaView) content] reloadData];
20 }
21 }
22
23 auto pTableViewItem::setAlignment(Alignment alignment) -> void {
24 }
25
26 auto pTableViewItem::setBackgroundColor(Color color) -> void {
27 }
28
29 auto pTableViewItem::setFocused() -> void {
30 }
31
32 auto pTableViewItem::setForegroundColor(Color color) -> void {
33 }
34
35 auto pTableViewItem::setSelected(bool selected) -> void {
36 if(auto tableView = _parent()) {
37 auto lock = tableView->acquire();
38 auto indexSet = [[NSMutableIndexSet alloc] init];
39 for(auto& item : tableView->state().items) {
40 if(item->selected()) [indexSet addIndex:item->offset()];
41 }
42 [[(CocoaTableView*)(tableView->cocoaView) content] selectRowIndexes:indexSet byExtendingSelection:NO];
43 }
44 }
45
46 auto pTableViewItem::_parent() -> maybe<pTableView&> {
47 if(auto parent = self().parentTableView()) {
48 if(auto self = parent->self()) return *self;
49 }
50 return nothing;
51 }
52
53 }
54
55 #endif