* add support for TableView::onActivate(TableViewCell) to Windows, macOS
** allows the new input/hotkey mapping panels to work on Windows, macOS
* polish BrowserDialog behavior
This commit is contained in:
byuu
2019-08-01 02:40:35 +09:00
parent a7b30b069c
commit bc7456246c
8 changed files with 80 additions and 28 deletions

View File

@@ -447,18 +447,26 @@ static auto CALLBACK Shared_windowProc(WindowProc windowProc, HWND hwnd, UINT ms
#if defined(Hiro_TableView)
case AppMessage::TableView_doPaint: {
if(auto tableView = (mTableView*)lparam) {
if(auto self = tableView->self()) InvalidateRect(self->hwnd, nullptr, true);
if(auto self = tableView->self()) {
InvalidateRect(self->hwnd, nullptr, true);
}
}
break;
}
case AppMessage::TableView_onActivate: {
if(auto tableView = (mTableView*)lparam) tableView->doActivate({});
if(auto tableView = (mTableView*)lparam) {
if(auto self = tableView->self()) {
tableView->doActivate(self->activateCell);
}
}
break;
}
case AppMessage::TableView_onChange: {
if(auto tableView = (mTableView*)lparam) tableView->doChange();
if(auto tableView = (mTableView*)lparam) {
tableView->doChange();
}
}
#endif
}

View File

@@ -105,6 +105,21 @@ auto pTableView::onActivate(LPARAM lparam) -> void {
auto nmlistview = (LPNMLISTVIEW)lparam;
if(ListView_GetSelectedCount(hwnd) == 0) return;
if(!locked()) {
activateCell = TableViewCell();
LVHITTESTINFO hitTest{};
GetCursorPos(&hitTest.pt);
ScreenToClient(nmlistview->hdr.hwndFrom, &hitTest.pt);
ListView_SubItemHitTest(nmlistview->hdr.hwndFrom, &hitTest);
if(hitTest.flags & LVHT_ONITEM) {
int row = hitTest.iItem;
if(row >= 0 && row < state().items.size()) {
int column = hitTest.iSubItem;
if(column >= 0 && column < state().columns.size()) {
auto item = state().items[row];
activateCell = item->cell(column);
}
}
}
//LVN_ITEMACTIVATE is not re-entrant until DispatchMessage() completes
//thus, we don't call self().doActivate() here
PostMessageOnce(_parentHandle(), AppMessage::TableView_onActivate, 0, (LPARAM)&reference);

View File

@@ -35,6 +35,7 @@ struct pTableView : pWidget {
auto _setIcons() -> void;
auto _width(unsigned column) -> unsigned;
TableViewCell activateCell;
HIMAGELIST imageList = 0;
vector<image> icons;
};