File: table-view-item.cpp

package info (click to toggle)
ares 126-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,600 kB
  • sloc: cpp: 356,508; ansic: 20,394; makefile: 16; sh: 2
file content (55 lines) | stat: -rw-r--r-- 1,326 bytes parent folder | download | duplicates (4)
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
#if defined(Hiro_TableView)

namespace hiro {

auto pTableViewItem::construct() -> void {
}

auto pTableViewItem::destruct() -> void {
}

auto pTableViewItem::append(sTableViewCell cell) -> void {
  if(auto tableView = _parent()) {
    [[(CocoaTableView*)(tableView->cocoaView) content] reloadData];
  }
}

auto pTableViewItem::remove(sTableViewCell cell) -> void {
  if(auto tableView = _parent()) {
    [[(CocoaTableView*)(tableView->cocoaView) content] reloadData];
  }
}

auto pTableViewItem::setAlignment(Alignment alignment) -> void {
}

auto pTableViewItem::setBackgroundColor(Color color) -> void {
}

auto pTableViewItem::setFocused() -> void {
}

auto pTableViewItem::setForegroundColor(Color color) -> void {
}

auto pTableViewItem::setSelected(bool selected) -> void {
  if(auto tableView = _parent()) {
    auto lock = tableView->acquire();
    auto indexSet = [[NSMutableIndexSet alloc] init];
    for(auto& item : tableView->state().items) {
      if(item->selected()) [indexSet addIndex:item->offset()];
    }
    [[(CocoaTableView*)(tableView->cocoaView) content] selectRowIndexes:indexSet byExtendingSelection:NO];
  }
}

auto pTableViewItem::_parent() -> maybe<pTableView&> {
  if(auto parent = self().parentTableView()) {
    if(auto self = parent->self()) return *self;
  }
  return nothing;
}

}

#endif