Menu bar buttons are now toggles.

This commit is contained in:
Bartosz Taudul 2018-12-18 16:13:11 +01:00
parent 85fbfeccf0
commit 9e18db01c9

View File

@ -267,6 +267,11 @@ static void TextFocused( const char* label, const char* value )
ImGui::Text( "%s", value ); ImGui::Text( "%s", value );
} }
static void ToggleButton( const char* label, bool& toggle )
{
if( ImGui::Button( label ) ) toggle = !toggle;
}
enum { MinVisSize = 3 }; enum { MinVisSize = 3 };
enum { MinFrameSize = 5 }; enum { MinFrameSize = 5 };
@ -614,45 +619,45 @@ bool View::DrawImpl()
} }
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_COG " Options" ) ) m_showOptions = true; ToggleButton( ICON_FA_COG " Options", m_showOptions );
#else #else
if( ImGui::Button( "Options" ) ) m_showOptions = true; ToggleButton( "Options", m_showOptions );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_TAGS " Messages" ) ) m_showMessages = true; ToggleButton( ICON_FA_TAGS " Messages", m_showMessages );
#else #else
if( ImGui::Button( "Messages" ) ) m_showMessages = true; ToggleButton( "Messages", m_showMessages );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_SEARCH " Find zone" ) ) m_findZone.show = true; ToggleButton( ICON_FA_SEARCH " Find zone", m_findZone.show );
#else #else
if( ImGui::Button( "Find zone" ) ) m_findZone.show = true; ToggleButton( "Find zone", m_findZone.show );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_SORT_AMOUNT_UP " Statistics" ) ) m_showStatistics = true; ToggleButton( ICON_FA_SORT_AMOUNT_UP " Statistics", m_showStatistics );
#else #else
if( ImGui::Button( "Statistics" ) ) m_showStatistics = true; ToggleButton( "Statistics", m_showStatistics );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_MEMORY " Memory" ) ) m_memInfo.show = true; ToggleButton( ICON_FA_MEMORY " Memory", m_memInfo.show );
#else #else
if( ImGui::Button( "Memory" ) ) m_memInfo.show = true; ToggleButton( "Memory", m_memInfo.show );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_BALANCE_SCALE " Compare" ) ) m_compare.show = true; ToggleButton( ICON_FA_BALANCE_SCALE " Compare", m_compare.show );
#else #else
if( ImGui::Button( "Compare" ) ) m_compare.show = true; ToggleButton( "Compare", m_compare.show );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_FINGERPRINT " Info" ) ) m_showInfo = true; ToggleButton( ICON_FA_FINGERPRINT " Info", m_showInfo );
#else #else
if( ImGui::Button( "Info" ) ) m_showInfo = true; ToggleButton( "Info", m_showInfo );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
@ -699,7 +704,7 @@ bool View::DrawImpl()
} }
ImGui::SameLine(); ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
m_goToFrame |= ImGui::Button( ICON_FA_CROSSHAIRS ); ToggleButton( ICON_FA_CROSSHAIRS, m_goToFrame );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
@ -707,7 +712,7 @@ bool View::DrawImpl()
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
#else #else
m_goToFrame |= ImGui::Button( "Go to" ); ToggleButton( "Go to", m_goToFrame );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();