bsnes/hiro/qt/widget/table-view-column.cpp
Tim Allen 6ae0abe3d3 Update to v098r09 release.
byuu says:

Changelog:
- fixed major nall/vector/prepend bug
- renamed hiro/ListView to hiro/TableView
- added new hiro/ListView control which is a simplified abstraction of
  hiro/TableView
- updated higan's cheat database window and icarus' scan dialog to use
  the new ListView control
- compilation works once again on all platforms (Windows, Cocoa, GTK,
  Qt)
- the loki skeleton compiles once again (removed nall/DSP references;
  updated port/device ID names)

Small catch: need to capture layout resize events internally in Windows
to call resizeColumns. For now, just resize the icarus window to get it
to use the full window width for list view items.
2016-05-04 20:07:13 +10:00

100 lines
2.3 KiB
C++

#if defined(Hiro_TableView)
namespace hiro {
auto pTableViewColumn::construct() -> void {
}
auto pTableViewColumn::destruct() -> void {
}
auto pTableViewColumn::setActive() -> void {
//unsupported
}
auto pTableViewColumn::setAlignment(Alignment alignment) -> void {
_setState();
}
auto pTableViewColumn::setBackgroundColor(Color color) -> void {
_setState();
}
auto pTableViewColumn::setEditable(bool editable) -> void {
//unsupported
}
auto pTableViewColumn::setExpandable(bool expandable) -> void {
_setState();
}
auto pTableViewColumn::setFont(const Font& font) -> void {
_setState();
}
auto pTableViewColumn::setForegroundColor(Color color) -> void {
_setState();
}
auto pTableViewColumn::setHorizontalAlignment(double alignment) -> void {
_setState();
}
auto pTableViewColumn::setIcon(const image& icon) -> void {
//unsupported
}
auto pTableViewColumn::setResizable(bool resizable) -> void {
_setState();
}
auto pTableViewColumn::setSortable(bool sortable) -> void {
_setState();
}
auto pTableViewColumn::setText(const string& text) -> void {
_setState();
}
auto pTableViewColumn::setVerticalAlignment(double alignment) -> void {
_setState();
}
auto pTableViewColumn::setVisible(bool visible) -> void {
_setState();
}
auto pTableViewColumn::setWidth(signed width) -> void {
_setState();
}
auto pTableViewColumn::_parent() -> maybe<pTableViewHeader&> {
if(auto parent = self().parentTableViewHeader()) {
if(auto delegate = parent->self()) return *delegate;
}
return nothing;
}
auto pTableViewColumn::_setState() -> void {
if(auto header = _parent()) {
if(auto parent = header->_parent()) {
parent->qtTableView->header()->setResizeMode(self().offset(), state().resizable ? QHeaderView::Interactive : QHeaderView::Fixed);
bool clickable = false;
for(auto& column : header->state().columns) clickable |= column->state.sortable;
parent->qtTableView->header()->setClickable(clickable);
parent->qtTableView->headerItem()->setText(self().offset(), QString::fromUtf8(state().text));
parent->qtTableView->setColumnHidden(self().offset(), !self().visible());
for(auto& item : parent->state().items) {
if(auto cell = item->cell(self().offset())) {
if(auto self = cell->self()) self->_setState();
}
}
}
}
}
}
#endif