| 1 |
#if defined(Hiro_TreeView) |
| 2 |
|
| 3 |
namespace hiro { |
| 4 |
|
| 5 |
auto pTreeView::construct() -> void { |
| 6 |
qtWidget = qtTreeView = new QtTreeView(*this); |
| 7 |
qtStandardItemModel = new QStandardItemModel; |
| 8 |
qtTreeView->setHeaderHidden(true); |
| 9 |
qtTreeView->setModel(qtStandardItemModel); |
| 10 |
qtTreeView->setUniformRowHeights(true); |
| 11 |
|
| 12 |
setActivation(state().activation); |
| 13 |
setBackgroundColor(state().backgroundColor); |
| 14 |
setForegroundColor(state().foregroundColor); |
| 15 |
pWidget::construct(); |
| 16 |
} |
| 17 |
|
| 18 |
auto pTreeView::destruct() -> void { |
| 19 |
if(Application::state().quit) return; //TODO: hack |
| 20 |
delete qtTreeView; |
| 21 |
delete qtStandardItemModel; |
| 22 |
qtWidget = qtTreeView = nullptr; |
| 23 |
qtStandardItemModel = nullptr; |
| 24 |
} |
| 25 |
|
| 26 |
// |
| 27 |
|
| 28 |
auto pTreeView::append(sTreeViewItem item) -> void { |
| 29 |
} |
| 30 |
|
| 31 |
auto pTreeView::remove(sTreeViewItem item) -> void { |
| 32 |
} |
| 33 |
|
| 34 |
auto pTreeView::setActivation(Mouse::Click activation) -> void { |
| 35 |
} |
| 36 |
|
| 37 |
auto pTreeView::setBackgroundColor(Color color) -> void { |
| 38 |
static auto defaultColor = qtTreeView->palette().color(QPalette::Base); |
| 39 |
|
| 40 |
auto palette = qtTreeView->palette(); |
| 41 |
palette.setColor(QPalette::Base, CreateColor(color, defaultColor)); |
| 42 |
qtTreeView->setPalette(palette); |
| 43 |
qtTreeView->setAutoFillBackground((bool)color); |
| 44 |
} |
| 45 |
|
| 46 |
auto pTreeView::setForegroundColor(Color color) -> void { |
| 47 |
static auto defaultColor = qtTreeView->palette().color(QPalette::Text); |
| 48 |
|
| 49 |
auto palette = qtTreeView->palette(); |
| 50 |
palette.setColor(QPalette::Text, CreateColor(color, defaultColor)); |
| 51 |
qtTreeView->setPalette(palette); |
| 52 |
} |
| 53 |
|
| 54 |
} |
| 55 |
|
| 56 |
#endif |