* Window port helper function for menu invert routines to move the decision * logic into one place instead of 7 different window-port routines. */
| 1559 | * logic into one place instead of 7 different window-port routines. |
| 1560 | */ |
| 1561 | boolean |
| 1562 | menuitem_invert_test( |
| 1563 | int mode UNUSED, /* 0: invert; 1: select; 2: deselect */ |
| 1564 | unsigned itemflags, /* itemflags for the item */ |
| 1565 | boolean is_selected) /* current selection status of the item */ |
| 1566 | { |
| 1567 | boolean skipinvert = (itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0; |
| 1568 | |
| 1569 | if (!skipinvert) /* if not flagged SKIPINVERT, always pass test */ |
| 1570 | return TRUE; |
| 1571 | /* |
| 1572 | * mode 0: inverting current on/off state; |
| 1573 | * 1: unconditionally setting on; |
| 1574 | * 2: unconditionally setting off. |
| 1575 | * menuinvertmode 0: treat entries flagged with skipinvert as ordinary |
| 1576 | * (same as if not flagged); |
| 1577 | * menuinvertmode 1: don't toggle bulk invert or bulk select entries On; |
| 1578 | * allow toggling to Off (for invert and deselect; |
| 1579 | * select doesn't do Off); |
| 1580 | * menuinvertmode 2: don't toggle skipinvert entries either On or Off |
| 1581 | * when any bulk change is performed. |
| 1582 | */ |
| 1583 | if (iflags.menuinvertmode == 2) { |
| 1584 | return FALSE; |
| 1585 | } else if (iflags.menuinvertmode == 1) { |
| 1586 | return is_selected ? TRUE : FALSE; |
| 1587 | } |
| 1588 | return TRUE; |
| 1589 | } |
| 1590 | |
| 1591 | /* |
| 1592 | * helper routine if a window port wants to extract the glyph |
no outgoing calls
no test coverage detected