From 74e55f584c9baecc2e26c42058f4f24367623181 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 3 May 2020 20:49:21 +0200 Subject: [PATCH] Small toggle button. --- server/TracyImGui.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index f8b1a6b3..bcbf34b7 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -117,6 +117,16 @@ namespace tracy if( active ) ImGui::PopStyleColor( 3 ); } + static void SmallToggleButton( const char* label, bool& toggle ) + { + const auto active = toggle; + if( active ) SetButtonHighlightColor(); + ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); + if( ImGui::Button( label ) ) toggle = !toggle; + ImGui::PopStyleVar( 1 ); + if( active ) ImGui::PopStyleColor( 3 ); + } + } #endif