aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/frameworks/9 wxwidgets
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/frameworks/9 wxwidgets
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/frameworks/9 wxwidgets')
-rw-r--r--meson/test cases/frameworks/9 wxwidgets/mainwin.h23
-rw-r--r--meson/test cases/frameworks/9 wxwidgets/meson.build19
-rw-r--r--meson/test cases/frameworks/9 wxwidgets/wxprog.cpp56
-rw-r--r--meson/test cases/frameworks/9 wxwidgets/wxstc.cpp6
4 files changed, 104 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/9 wxwidgets/mainwin.h b/meson/test cases/frameworks/9 wxwidgets/mainwin.h
new file mode 100644
index 000000000..b5ca18de3
--- /dev/null
+++ b/meson/test cases/frameworks/9 wxwidgets/mainwin.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <wx/wx.h>
+
+class MyApp: public wxApp
+{
+public:
+ virtual bool OnInit();
+};
+class MyFrame: public wxFrame
+{
+public:
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+private:
+ void OnHello(wxCommandEvent& event);
+ void OnExit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ wxDECLARE_EVENT_TABLE();
+};
+
+enum {
+ ID_Hello = 1
+};
diff --git a/meson/test cases/frameworks/9 wxwidgets/meson.build b/meson/test cases/frameworks/9 wxwidgets/meson.build
new file mode 100644
index 000000000..0c7ecaa11
--- /dev/null
+++ b/meson/test cases/frameworks/9 wxwidgets/meson.build
@@ -0,0 +1,19 @@
+project('wxwidgets test', 'cpp', default_options : ['cpp_std=c++11'])
+
+wxd = dependency('wxwidgets', version : '>=5', required : false)
+wxd = dependency('wxwidgets', version : '>=3.0.0', required : false)
+
+if wxd.found()
+ wp = executable('wxprog', 'wxprog.cpp', dependencies : wxd)
+
+ test('wxtest', wp)
+
+ # WxWidgets framework is available, we can use required here
+ wx_stc = dependency('wxwidgets', version : '>=3.0.0', modules : ['std', 'stc'])
+ stc_exe = executable('wxstc', 'wxstc.cpp', dependencies : wx_stc)
+ test('wxstctest', stc_exe)
+
+ # Check we can apply a version constraint
+ dependency('wxwidgets', version: '>=@0@'.format(wxd.version()))
+
+endif
diff --git a/meson/test cases/frameworks/9 wxwidgets/wxprog.cpp b/meson/test cases/frameworks/9 wxwidgets/wxprog.cpp
new file mode 100644
index 000000000..2be5512ee
--- /dev/null
+++ b/meson/test cases/frameworks/9 wxwidgets/wxprog.cpp
@@ -0,0 +1,56 @@
+#include"mainwin.h"
+
+wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
+EVT_MENU(ID_Hello, MyFrame::OnHello)
+EVT_MENU(wxID_EXIT, MyFrame::OnExit)
+EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
+wxEND_EVENT_TABLE()
+
+bool MyApp::OnInit() {
+ MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
+ frame->Show( true );
+ return true;
+}
+
+MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame(NULL, wxID_ANY, title, pos, size) {
+ wxMenu *menuFile = new wxMenu;
+ menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
+ "Help string shown in status bar for this menu item");
+ menuFile->AppendSeparator();
+ menuFile->Append(wxID_EXIT);
+ wxMenu *menuHelp = new wxMenu;
+ menuHelp->Append(wxID_ABOUT);
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+ menuBar->Append(menuHelp, "&Help");
+ SetMenuBar(menuBar);
+ CreateStatusBar();
+ SetStatusText("This is status." );
+}
+
+void MyFrame::OnExit(wxCommandEvent& event) {
+ Close( true );
+}
+
+void MyFrame::OnAbout(wxCommandEvent& event) {
+ //wxMessageBox("Some text", wxOK | wxICON_INFORMATION);
+}
+
+void MyFrame::OnHello(wxCommandEvent& event) {
+ wxLogMessage("Some more text.");
+}
+
+#if 0
+wxIMPLEMENT_APP(MyApp);
+#else
+// Don't open a window because this is an unit test and needs to
+// run headless.
+int main(int, char **) {
+ wxString name("Some app");
+ wxPoint p(0, 0);
+ wxSize s(100, 100);
+ return 0;
+}
+
+#endif
diff --git a/meson/test cases/frameworks/9 wxwidgets/wxstc.cpp b/meson/test cases/frameworks/9 wxwidgets/wxstc.cpp
new file mode 100644
index 000000000..c0c704350
--- /dev/null
+++ b/meson/test cases/frameworks/9 wxwidgets/wxstc.cpp
@@ -0,0 +1,6 @@
+#include <wx/stc/stc.h>
+
+int main(void) {
+ wxStyledTextCtrl *canvas = new wxStyledTextCtrl();
+ delete canvas;
+}