MCPcopy Create free account
hub / github.com/aiekick/ImGuiFileDialog / inToggleButton

Function inToggleButton

ImGuiFileDialog.cpp:394–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392#endif // PLACES_PANE_DEFAULT_SHOWN
393#ifndef IMGUI_TOGGLE_BUTTON
394inline bool inToggleButton(const char* vLabel, bool* vToggled) {
395 bool pressed = false;
396
397 if (vToggled && *vToggled) {
398 ImVec4 bua = ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive);
399 // ImVec4 buh = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered);
400 // ImVec4 bu = ImGui::GetStyleColorVec4(ImGuiCol_Button);
401 ImVec4 te = ImGui::GetStyleColorVec4(ImGuiCol_Text);
402 ImGui::PushStyleColor(ImGuiCol_Button, te);
403 ImGui::PushStyleColor(ImGuiCol_ButtonActive, te);
404 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, te);
405 ImGui::PushStyleColor(ImGuiCol_Text, bua);
406 }
407
408 pressed = IMGUI_BUTTON(vLabel);
409
410 if (vToggled && *vToggled) {
411 ImGui::PopStyleColor(4); //-V112
412 }
413
414 if (vToggled && pressed) *vToggled = !*vToggled;
415
416 return pressed;
417}
418#define IMGUI_TOGGLE_BUTTON inToggleButton
419#endif // IMGUI_TOGGLE_BUTTON
420#endif // USE_PLACES_FEATURE

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected