mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 23:11:45 +02:00
v108.3
* 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:
@@ -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
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -35,6 +35,7 @@ struct pTableView : pWidget {
|
||||
auto _setIcons() -> void;
|
||||
auto _width(unsigned column) -> unsigned;
|
||||
|
||||
TableViewCell activateCell;
|
||||
HIMAGELIST imageList = 0;
|
||||
vector<image> icons;
|
||||
};
|
||||
|
Reference in New Issue
Block a user