MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / checkKey

Function checkKey

source/MRViewer/MRUIStyle.cpp:111–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109//////////////////////////////////////////////////////////////////////////
110
111bool checkKey( ImGuiKey passedKey )
112{
113 if ( passedKey == ImGuiKey_None || ImGui::GetIO().KeyMods != ImGuiMod_None )
114 return false;
115
116 // if modal is open ImGui::GetIO().WantCaptureKeyboard will be always true,
117 // so use special case for modals
118 bool isAnyOpen = bool( ImGui::GetTopMostPopupModal() );
119 if ( ( isAnyOpen && ImGui::IsAnyItemActive() ) || ( !isAnyOpen && ImGui::GetIO().WantCaptureKeyboard ) )
120 return false;
121
122 reserveKeyEvent( passedKey );
123 bool pressed = false;
124 if ( passedKey == ImGuiKey_Enter || passedKey == ImGuiKey_KeypadEnter )
125 pressed = ImGui::IsKeyPressed( ImGuiKey_Enter ) || ImGui::IsKeyPressed( ImGuiKey_KeypadEnter );
126 else
127 pressed = ImGui::IsKeyPressed( passedKey );
128 return pressed;
129}
130
131//////////////////////////////////////////////////////////////////////////
132

Callers 5

buttonFunction · 0.85
buttonCommonSizeFunction · 0.85
buttonUniqueFunction · 0.85
buttonUniqueIconFunction · 0.85
buttonIconFlatBGFunction · 0.85

Calls 1

reserveKeyEventFunction · 0.85

Tested by

no test coverage detected