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

Method drawModalMessage_

source/MRViewer/ImGuiMenu.cpp:1116–1169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1114}
1115
1116void ImGuiMenu::drawModalMessage_()
1117{
1118 ImGui::PushStyleColor( ImGuiCol_ModalWindowDimBg, ImVec4( 1, 0.125f, 0.125f, ImGui::GetStyle().Colors[ImGuiCol_ModalWindowDimBg].w ) );
1119
1120 std::string titleKey;
1121 std::string titleDisplay;
1122 if ( modalMessageType_ == NotificationType::Error )
1123 {
1124 titleKey = "Error";
1125 titleDisplay = s_tr( "Error" );
1126 }
1127 else if ( modalMessageType_ == NotificationType::Warning )
1128 {
1129 titleKey = "Warning";
1130 titleDisplay = s_tr( "Warning" );
1131 }
1132 else //if ( modalMessageType_ == MessageType::Info )
1133 {
1134 titleKey = "Info";
1135 titleDisplay = s_tr( "Info" );
1136 }
1137
1138 const std::string titleImGui = " " + titleKey + "##modal";
1139
1140 if ( showInfoModal_ &&
1141 !ImGui::IsPopupOpen( " Error##modal" ) && !ImGui::IsPopupOpen( " Warning##modal" ) && !ImGui::IsPopupOpen( " Info##modal" ) )
1142 {
1143 ImGui::OpenPopup( titleImGui.c_str() );
1144 showInfoModal_ = false;
1145 }
1146
1147 ModalDialog modal( titleImGui, {
1148 .headline = titleDisplay,
1149 .text = storedModalMessage_,
1150 .closeOnClickOutside = true,
1151 } );
1152 if ( modal.beginPopup() )
1153 {
1154 const auto style = ImGui::GetStyle();
1155 ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, { style.FramePadding.x, cButtonPadding * UI::scale() } );
1156 if ( UI::button( _tr( "Okay" ), Vector2f( -1, 0 ), ImGuiKey_Enter ) )
1157 ImGui::CloseCurrentPopup();
1158 ImGui::PopStyleVar();
1159
1160 modal.endPopup();
1161 needModalBgChange_ = true;
1162 }
1163 else
1164 {
1165 needModalBgChange_ = false;
1166 }
1167
1168 ImGui::PopStyleColor();
1169}
1170
1171void ImGuiMenu::setDrawTimeMillisecThreshold( long long maxGoodTimeMillisec )
1172{

Callers

nothing calls this directly

Calls 5

ImVec4Class · 0.85
beginPopupMethod · 0.80
endPopupMethod · 0.80
scaleFunction · 0.70
buttonFunction · 0.70

Tested by

no test coverage detected