MCPcopy Create free account
hub / github.com/audacity/audacity / DoMessageBox

Method DoMessageBox

libraries/lib-wx-init/wxWidgetsBasicUI.cpp:92–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92BasicUI::MessageBoxResult
93wxWidgetsBasicUI::DoMessageBox(
94 const TranslatableString &message,
95 MessageBoxOptions options)
96{
97 // Compute the style argument to pass to wxWidgets
98 long style = 0;
99 switch (options.iconStyle) {
100 case Icon::Warning :
101 style = wxICON_WARNING;
102 break;
103 case Icon::Error :
104 style = wxICON_ERROR;
105 break;
106 case Icon::Question :
107 style = wxICON_QUESTION;
108 break;
109 case Icon::Information :
110 style = wxICON_INFORMATION;
111 break;
112 default:
113 break;
114 }
115 switch (options.buttonStyle) {
116 case Button::Ok :
117 style |= wxOK;
118 break;
119 case Button::YesNo :
120 style |= wxYES_NO;
121 break;
122 default:
123 break;
124 }
125 if (!options.yesOrOkDefaultButton && options.buttonStyle == Button::YesNo)
126 style |= wxNO_DEFAULT;
127 if (options.cancelButton)
128 style |= wxCANCEL;
129 if (options.centered)
130 style |= wxCENTER;
131
132 // Preserving the default style AudacityMessageBox had,
133 // when none of the above were explicitly specified
134 if (!style)
135 style = wxOK | wxCENTRE;
136
137 // This calls through to ::wxMessageBox:
138 auto wxResult =
139 ::AudacityMessageBox(message, options.caption, style,
140 options.parent
141 ? wxWidgetsWindowPlacement::GetParent(*options.parent)
142 : nullptr);
143 // This switch exhausts all possibilities for the return from::wxMessageBox.
144 // see utilscmn.cpp in wxWidgets.
145 // Remap to our toolkit-neutral enumeration.
146 switch (wxResult) {
147 case wxYES:
148 return MessageBoxResult::Yes;
149 case wxNO:

Callers 1

ShowMessageBoxFunction · 0.45

Calls 2

AudacityMessageBoxFunction · 0.85
GetParentFunction · 0.85

Tested by

no test coverage detected