From c2485fbcb04898a6d229b5419d07915a019c91d7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 18 Dec 2018 16:22:12 +0100 Subject: [PATCH] Add visual notification of an active toggle. --- server/TracyView.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 697c6000..c4796383 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -269,7 +269,15 @@ static void TextFocused( const char* label, const char* value ) static void ToggleButton( const char* label, bool& toggle ) { + const auto active = toggle; + if( active ) + { + ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor::HSV( 0.45f, 0.6f, 0.6f ) ); + ImGui::PushStyleColor( ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV( 0.45f, 0.7f, 0.7f ) ); + ImGui::PushStyleColor( ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV( 0.45f, 0.8f, 0.8f ) ); + } if( ImGui::Button( label ) ) toggle = !toggle; + if( active ) ImGui::PopStyleColor( 3 ); } enum { MinVisSize = 3 };