Click handler for the ExtCmdRequestor widget
| 348 | |
| 349 | // Click handler for the ExtCmdRequestor widget |
| 350 | int NetHackQtExtCmdRequestor::Button(int butnum) |
| 351 | { |
| 352 | // 0..3 are control buttons, 4..N+3 are choice buttons. |
| 353 | // Widget return value is -1 for cancel (via reject), xcmdNoMatch |
| 354 | // for filter, layout, reset (via accept if circumstances warrant), |
| 355 | // 1..N for command choices (choice 0 is '#' and it isn't shown as |
| 356 | // a candidate since picking it is not useful). |
| 357 | switch (butnum) { |
| 358 | case 0: |
| 359 | Cancel(); |
| 360 | /*NOTREACHED*/ |
| 361 | break; |
| 362 | case 1: |
| 363 | Filter(); |
| 364 | break; |
| 365 | case 2: |
| 366 | Layout(); |
| 367 | break; |
| 368 | case 3: |
| 369 | Reset(); |
| 370 | break; |
| 371 | default: |
| 372 | // 4..N-3 are the extended commands |
| 373 | done(butnum - butoffset + 1); |
| 374 | /*NOTREACHED*/ |
| 375 | break; |
| 376 | } |
| 377 | return 0; |
| 378 | } |
| 379 | |
| 380 | // Respond to a click on the [Cancel] button |
| 381 | void NetHackQtExtCmdRequestor::Cancel() |