MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / buttonUnique

Function buttonUnique

source/MRViewer/MRUIStyle.cpp:375–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375bool buttonUnique( const char* label, int* value, int ownValue, const Vector2f& size /*= Vector2f( 0, 0 )*/, ImGuiKey key /*= ImGuiKey_None*/ )
376{
377 Color clearBlue = ColorTheme::getRibbonColor( ColorTheme::RibbonColorsType::SelectedObjectFrame );
378 Color bgColor = ColorTheme::getRibbonColor( ColorTheme::RibbonColorsType::BackgroundSecStyle );
379 Color textColor = ColorTheme::getRibbonColor( ColorTheme::RibbonColorsType::Text );
380
381 StyleParamHolder sh;
382 sh.addVar( ImGuiStyleVar_FramePadding, { ( cButtonPadding + 1 ) * UI::scale(), cButtonPadding * UI::scale() } );
383 sh.addVar( ImGuiStyleVar_ItemSpacing, { ImGui::GetStyle().ItemSpacing.x * 0.7f, cDefaultItemSpacing * 2 * UI::scale() } );
384
385 sh.addColor( ImGuiCol_Button, *value == ownValue ? clearBlue : bgColor );
386 sh.addColor( ImGuiCol_Text, *value == ownValue ? Color::white() : textColor );
387
388 ButtonCustomizationParams params;
389 params.forceImGuiBackground = true;
390 params.forceImguiTextColor = true;
391 params.underlineFirstLetter = std::string_view( ImGui::GetKeyName( key ) ) == std::string_view( label, 1 );
392
393 auto res = buttonEx( label, ImVec2( size.x, size.y ), params ) || checkKey( key );
394 if ( res )
395 value[0] = ownValue;
396
397 return res;
398}
399
400void drawPoltHorizontalAxis( const PlotAxis& plotAxis )
401{

Callers

nothing calls this directly

Calls 6

buttonExFunction · 0.85
ImVec2Class · 0.85
checkKeyFunction · 0.85
addVarMethod · 0.80
addColorMethod · 0.80
scaleFunction · 0.70

Tested by

no test coverage detected