| 2070 | } |
| 2071 | |
| 2072 | void 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 | |
| 2102 | void setTooltipIfHovered( const std::string& text ) |
| 2103 | { |