MCPcopy Create free account
hub / github.com/chrxh/alien / SelectableButton

Method SelectableButton

source/Gui/AlienImGui.cpp:784–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782}
783
784bool AlienImGui::SelectableButton(SelectableButtonParameters const& parameters, bool& value)
785{
786 auto buttonColor = ImColor(ImGui::GetStyle().Colors[ImGuiCol_Button]);
787 auto buttonColorHovered = ImColor(ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered]);
788 auto buttonColorActive = ImColor(ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
789 if (value) {
790 buttonColor = buttonColorActive;
791 buttonColorHovered = buttonColorActive;
792 }
793
794 ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)buttonColor);
795 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)buttonColorHovered);
796 ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)buttonColorActive);
797 auto result = ImGui::Button(parameters._name.c_str(), {scale(parameters._width), 0});
798 if (result) {
799 value = !value;
800 }
801 ImGui::PopStyleColor(3);
802
803 return result;
804}
805
806void AlienImGui::Text(std::string const& text)
807{

Callers

nothing calls this directly

Calls 1

scaleFunction · 0.85

Tested by

no test coverage detected