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

Function notificationFrame

source/MRViewer/MRUIStyle.cpp:2072–2100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2070}
2071
2072void notificationFrame( NotificationType type, const std::string& str )
2073{
2074 auto drawList = ImGui::GetWindowDrawList();
2075 if ( !drawList )
2076 return;
2077
2078 auto width = ImGui::GetContentRegionAvail().x;
2079 Color bgColor = ColorTheme::getRibbonColor( ColorTheme::RibbonColorsType::BackgroundSecStyle );
2080 auto textSize = ImGui::CalcTextSize( str.c_str(), nullptr, false, width - StyleConsts::Notification::cTextFramePadding.x * UI::scale() );
2081
2082 auto pos = ImGui::GetCursorPos();
2083 auto sPos = ImGui::GetCursorScreenPos();
2084 drawList->AddRectFilled( sPos, sPos + ImVec2( width, textSize.y + 2 * StyleConsts::Notification::cTextFramePadding.y * UI::scale() ), bgColor.getUInt32(),
2085 UI::scale() * StyleConsts::Notification::cTextFrameRounding );
2086 ImGui::SetCursorPos( pos + StyleConsts::Notification::cTextFramePadding * UI::scale() );
2087 transparentTextWrapped( "%s", str.c_str() );
2088
2089 RibbonFontHolder iconsFont( RibbonFontManager::FontType::Icons, 0.7f );
2090
2091 ImGui::SetCursorPos( pos + ImVec2( StyleConsts::Notification::cTextFramePadding.y * UI::scale(), StyleConsts::Notification::cTextFramePadding.y * UI::scale() ) );
2092 ImGui::PushStyleColor( ImGuiCol_Text, UI::notificationChar( type ).second );
2093 ImGui::Text( "%s", UI::notificationChar( type ).first );
2094 ImGui::PopStyleColor();
2095
2096 iconsFont.popFont();
2097
2098 ImGui::SetCursorPos( pos );
2099 ImGui::Dummy( ImVec2( width, textSize.y + 2 * StyleConsts::Notification::cTextFramePadding.y * UI::scale() ) );
2100}
2101
2102void setTooltipIfHovered( const std::string& text )
2103{

Callers

nothing calls this directly

Calls 6

ImVec2Class · 0.85
transparentTextWrappedFunction · 0.85
TextClass · 0.85
getUInt32Method · 0.80
popFontMethod · 0.80
scaleFunction · 0.70

Tested by

no test coverage detected