Debian Codegraph @

hiro/gtk/widget/table-view-cell.cpp

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