| 9072 | } |
| 9073 | |
| 9074 | bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) |
| 9075 | { |
| 9076 | ImGuiContext& g = *GImGui; |
| 9077 | |
| 9078 | // When using (owner_id == 0/Any): SetShortcutRouting() will use CurrentFocusScopeId and filter with this, so IsKeyPressed() is fine with he 0/Any. |
| 9079 | if ((flags & ImGuiInputFlags_RouteMask_) == 0) |
| 9080 | flags |= ImGuiInputFlags_RouteFocused; |
| 9081 | if (!SetShortcutRouting(key_chord, owner_id, flags)) |
| 9082 | return false; |
| 9083 | |
| 9084 | if (key_chord & ImGuiMod_Shortcut) |
| 9085 | key_chord = ConvertShortcutMod(key_chord); |
| 9086 | ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_); |
| 9087 | if (g.IO.KeyMods != mods) |
| 9088 | return false; |
| 9089 | |
| 9090 | // Special storage location for mods |
| 9091 | ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_); |
| 9092 | if (key == ImGuiKey_None) |
| 9093 | key = ConvertSingleModFlagToKey(&g, mods); |
| 9094 | |
| 9095 | if (!IsKeyPressed(key, owner_id, (flags & (ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateMask_)))) |
| 9096 | return false; |
| 9097 | IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByShortcut) == 0); // Passing flags not supported by this function! |
| 9098 | |
| 9099 | return true; |
| 9100 | } |
| 9101 | |
| 9102 | //----------------------------------------------------------------------------- |
| 9103 | // [SECTION] ERROR CHECKING |
nothing calls this directly
no test coverage detected