bsnes/hiro/windows/widget/table-view-column.cpp
Tim Allen 5da4532771 Update to v106r55 release.
byuu says:

Everything *should* be working again, but of course that won't
actually be the case. Here's where things stand:

  - bsnes, higan, icarus, and genius compile and run fine on FreeBSD
    with GTK
  - ruby video and audio drivers are untested on Windows, macOS, and
    Linux
  - hiro is untested on macOS
  - bsnes' status bar is not showing up properly with hiro/qt
  - bsnes and higan's about screen is not showing up properly with
    hiro/qt (1x1 window size)
  - bsnes on Windows crashes often when saving states, and I'm not sure
    why ... it happens inside Encode::RLE
  - bsnes on Windows crashes with ruby.input.windows (unsure why)
  - bsnes on Windows fails to show the verified emblem on the status bar
    properly
  - hiro on Windows flickers when changing tabs

To build the Windows bsnes and higan ports, use

    ruby="video.gdi audio.directsound"

Compilation error logs for Linux will help me fix the inevitable list of
typos there. I can fix the typos on other platforms, I just haven't
gotten to it yet.
2018-08-05 19:00:15 +10:00

105 lines
2.6 KiB
C++

#if defined(Hiro_TableView)
namespace hiro {
auto pTableViewColumn::construct() -> void {
if(auto parent = _parent()) {
auto lock = parent->acquire();
wchar_t text[] = L"";
LVCOLUMN lvColumn{0};
lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.iSubItem = self().offset();
lvColumn.pszText = text;
ListView_InsertColumn(parent->hwnd, self().offset(), &lvColumn);
_setState();
}
}
auto pTableViewColumn::destruct() -> void {
if(auto parent = _parent()) {
auto lock = parent->acquire();
ListView_DeleteColumn(parent->hwnd, self().offset());
}
}
auto pTableViewColumn::setActive() -> void {
//unsupported
}
auto pTableViewColumn::setAlignment(Alignment alignment) -> void {
}
auto pTableViewColumn::setBackgroundColor(Color color) -> void {
}
auto pTableViewColumn::setEditable(bool editable) -> void {
//unsupported
}
auto pTableViewColumn::setExpandable(bool expandable) -> void {
}
auto pTableViewColumn::setForegroundColor(Color color) -> void {
}
auto pTableViewColumn::setHorizontalAlignment(double alignment) -> void {
_setState();
}
auto pTableViewColumn::setIcon(const image& icon) -> void {
_setState();
}
auto pTableViewColumn::setResizable(bool resizable) -> void {
_setState();
}
auto pTableViewColumn::setSorting(Sort sorting) -> void {
_setState();
}
auto pTableViewColumn::setText(const string& text) -> void {
_setState();
}
auto pTableViewColumn::setVerticalAlignment(double alignment) -> void {
}
auto pTableViewColumn::setWidth(signed width) -> void {
_setState();
}
auto pTableViewColumn::_parent() -> maybe<pTableView&> {
if(auto parent = self().parentTableView()) {
if(auto self = parent->self()) return *self;
}
return {};
}
auto pTableViewColumn::_setState() -> void {
if(auto parent = _parent()) {
auto lock = parent->acquire();
parent->_setIcons();
string text = state().text;
if(state().sorting == Sort::Ascending ) text.append(" ^");
if(state().sorting == Sort::Descending) text.append(" v");
utf16_t wtext(text);
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
lvColumn.fmt = LVCFMT_CENTER;
lvColumn.iSubItem = self().offset();
lvColumn.iImage = self().offset();
lvColumn.pszText = wtext;
lvColumn.cx = _width;
if(state().horizontalAlignment < 0.333) lvColumn.fmt = LVCFMT_LEFT;
if(state().horizontalAlignment > 0.666) lvColumn.fmt = LVCFMT_RIGHT;
if(state().icon) lvColumn.mask |= LVCF_IMAGE;
if(!state().resizable) lvColumn.fmt |= LVCFMT_FIXED_WIDTH;
ListView_SetColumn(parent->hwnd, self().offset(), &lvColumn);
}
}
}
#endif