patterns: Added [[hex::spec_name]]

This commit is contained in:
WerWolv
2023-07-23 09:14:00 +02:00
parent 591435761b
commit fdd2e1fcde
6 changed files with 65 additions and 84 deletions

View File

@@ -191,5 +191,6 @@ namespace ImGui {
bool DimmedButton(const char* label);
bool DimmedIconButton(const char *symbol, ImVec4 color, ImVec2 size_arg = ImVec2(0, 0));
bool DimmedIconToggle(const char *icon, bool *v);
}

View File

@@ -788,4 +788,24 @@ namespace ImGui {
return res;
}
bool DimmedIconToggle(const char *icon, bool *v) {
bool pushed = false;
bool toggled = false;
if (*v) {
ImGui::PushStyleColor(ImGuiCol_Border, ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
pushed = true;
}
if (ImGui::DimmedIconButton(icon, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
*v = !*v;
toggled = true;
}
if (pushed)
ImGui::PopStyleColor();
return toggled;
}
}