1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,52 @@ |
1 |
+#ifdef GLBACKEND_WXWIDGETS |
|
2 |
+ |
|
3 |
+ |
|
4 |
+// #include <wx/wx.h> |
|
5 |
+#include <wx/app.h> |
|
6 |
+#include <wx/defs.h> |
|
7 |
+#include <wx/event.h> |
|
8 |
+#include <wx/frame.h> |
|
9 |
+#include <wx/window.h> |
|
10 |
+ |
|
11 |
+ |
|
12 |
+class App : public wxApp |
|
13 |
+{ |
|
14 |
+public: |
|
15 |
+ bool OnInit() override |
|
16 |
+ { |
|
17 |
+ // The default close event handler for wxFrame destroys the frame using |
|
18 |
+ // Destroy(). |
|
19 |
+ // https://docs.wxwidgets.org/3.0/overview_windowdeletion.html#overview_windowdeletion_default |
|
20 |
+ auto * frame = new wxFrame(nullptr, wxID_ANY, "baseline_wdwidgets"); |
|
21 |
+ if (!frame) |
|
22 |
+ return false; |
|
23 |
+ frame->Show(true); |
|
24 |
+ return true; |
|
25 |
+ } |
|
26 |
+ void OnIdle(wxIdleEvent & event) |
|
27 |
+ { |
|
28 |
+ (void)event; |
|
29 |
+ // Apparently, we only trigger LeakSanitizer if we handle a few |
|
30 |
+ // messages. |
|
31 |
+ auto static count = 0; |
|
32 |
+ if (count++ == 3) |
|
33 |
+ GetTopWindow()->Close(); |
|
34 |
+ } |
|
35 |
+ wxDECLARE_EVENT_TABLE(); //NOLINT |
|
36 |
+}; |
|
37 |
+ |
|
38 |
+ |
|
39 |
+#pragma GCC diagnostic push |
|
40 |
+#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" |
|
41 |
+wxBEGIN_EVENT_TABLE(App, wxApp) // NOLINT |
|
42 |
+ EVT_IDLE(App::OnIdle) // NOLINT |
|
43 |
+wxEND_EVENT_TABLE() // NOLINT |
|
44 |
+#pragma GCC diagnostic pop |
|
45 |
+ |
|
46 |
+ |
|
47 |
+wxIMPLEMENT_APP(App); |
|
48 |
+ |
|
49 |
+ |
|
50 |
+#else |
|
51 |
+int main() {} |
|
52 |
+#endif |