checkbox click handler for table cells (*,1); presence of a checkbox in the clicked cell prevents the table cell click handler above from being called even if this handler doesn't get set up
| 884 | // presence of a checkbox in the clicked cell prevents the table cell click |
| 885 | // handler above from being called even if this handler doesn't get set up |
| 886 | void NetHackQtMenuWindow::CheckboxClicked(bool on_off UNUSED) |
| 887 | { |
| 888 | // find which checkbox just got toggled by looking for one whose |
| 889 | // check state doesn't match corresponding itemlist[].selected flag |
| 890 | // [there's got to be a more direct way of achieving this...] |
| 891 | for (int row = 0; row < itemcount; ++row) { |
| 892 | // for pick-one menu, ToggleSelect() will return to menu's caller |
| 893 | if (itemlist[row].Selectable()) { |
| 894 | if (!isSelected(row) ^ !itemlist[row].selected) { |
| 895 | // signal dispatcher has already checked or unchecked this box |
| 896 | ToggleSelect(row, true); |
| 897 | return; |
| 898 | } |
| 899 | } |
| 900 | } |
| 901 | // didn't find any changed checkbox; should never happen; what to do? |
| 902 | } |
| 903 | |
| 904 | bool NetHackQtMenuWindow::isSelected(int row) |
| 905 | { |
nothing calls this directly
no test coverage detected