Helper function for `checkboxOrModifier` and `radioButtonOrModifier`
| 946 | |
| 947 | // Helper function for `checkboxOrModifier` and `radioButtonOrModifier` |
| 948 | static std::string modifiersToString( int modifiers ) |
| 949 | { |
| 950 | std::string modsText; |
| 951 | for ( const auto& [bit, name] : { |
| 952 | std::pair( ImGuiMod_Ctrl, getImGuiPrimaryCtrlName() ), |
| 953 | std::pair( ImGuiMod_Super, getSuperModName() ), |
| 954 | std::pair( ImGuiMod_Shift, "Shift" ), |
| 955 | std::pair( ImGuiMod_Alt, getAltModName() ), |
| 956 | } ) |
| 957 | { |
| 958 | if ( modifiers & bit ) |
| 959 | { |
| 960 | modifiers &= ~bit; |
| 961 | if ( !modsText.empty() ) |
| 962 | modsText += '+'; |
| 963 | modsText += name; |
| 964 | } |
| 965 | } |
| 966 | assert( modifiers == 0 && "Don't know the name of this modifier!" ); |
| 967 | return modsText; |
| 968 | } |
| 969 | |
| 970 | bool checkboxOrModifier( const char* label, CheckboxOrModifierState& value, int modifiers, int respectedModifiers, std::optional<bool> valueOverride ) |
| 971 | { |
no test coverage detected