From fc7f77eb7a5ca8a4a7d1eef3425b5a19d7afb6af Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 14 Oct 2019 20:06:57 +0200 Subject: [PATCH] Add implementation of disablable button. --- server/TracyImGui.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index 98b2db1e..023c7f88 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -74,6 +74,21 @@ namespace tracy ImGui::PopStyleVar(); } + static inline bool ButtonDisablable( const char* label, bool disabled ) + { + if( disabled ) + { + ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor( 0.3f, 0.3f, 0.3f, 1.0f ) ); + ImGui::ButtonEx( label, ImVec2( 0, 0 ), ImGuiButtonFlags_Disabled ); + ImGui::PopStyleColor( 1 ); + return false; + } + else + { + return ImGui::Button( label ); + } + } + } #endif