]> code.bitgloo.com Git - clyne/stmdsp.git/commitdiff
have basic wxwidgets gui working
authorClyne Sullivan <clyne@bitgloo.com>
Fri, 12 Jun 2020 22:49:09 +0000 (18:49 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Fri, 12 Jun 2020 22:49:09 +0000 (18:49 -0400)
.gitignore
gui/Makefile
gui/main.cpp
gui/stmdsp.hpp
gui/wxapp.hpp [new file with mode: 0644]
gui/wxmain.hpp [new file with mode: 0644]

index ccfe58214cad0bbfa48e462218e5b9705518a77f..804a3826c6254e63241c2e23d82d01d4fd3897e9 100644 (file)
@@ -1,4 +1,5 @@
 build
 ChibiOS_*
 **/.*
+gui/stmdspgui
 
index 419ed338dffd2d08c7822eb6c9eca3b3de5ce9a8..7cb0315ffaef7058cb51b869b00f938ea8ecc3f6 100644 (file)
@@ -1,13 +1,17 @@
-CXX = clang++-10
-CXXFLAGS = --std=c++20 -Wall -Wextra -pedantic
+CXX = g++-10
+CXXFLAGS = --std=c++20 \
+                  -Wall -Wextra -pedantic \
+                  -Wno-deprecated-copy \
+                  $(shell wx-config --cxxflags)
 
 CXXFILES = $(wildcard *.cpp)
 
+LIBS = $(shell wx-config --libs)
 OUTELF = stmdspgui
 
 all: $(CXXFILES)
        @echo "  CXX    " $(CXXFILES)
-       @$(CXX) $(CXXFLAGS) $(CXXFILES) -o $(OUTELF)
+       @$(CXX) $(CXXFLAGS) $(CXXFILES) $(LIBS) -o $(OUTELF)
 
 clean:
        @echo "  CLEAN"
index 48f2990bbbc8818e584952befeb458b35875d7a7..ae6ecb47d06ecbd535494f4904ba5b45b1e3add2 100644 (file)
@@ -1,15 +1,19 @@
 #include "stmdsp.hpp"
+#include "wxapp.hpp"
 
 #include <iostream>
+#include <wx/app.h>
 
-int main()
-{
-    stmdsp::scanner scanner;
+wxIMPLEMENT_APP(MainApp);
 
-    scanner.scan();
-    for (const auto& device : scanner.devices())
-        std::cout << "Found stmdsp at: " << device.path() << std::endl;
-
-    return 0;
-}
+//int main()
+//{
+//    stmdsp::scanner scanner;
+//
+//    scanner.scan();
+//    for (const auto& device : scanner.devices())
+//        std::cout << "Found stmdsp at: " << device.path() << std::endl;
+//
+//    return 0;
+//}
 
index 12e4578d070bda62234eda04a883777543058801..99a3bd33b96a84a01a767b47cb5f3c86f925bb3f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef STMDSPSCANNER_H
-#define STMDSPSCANNER_H
+#ifndef STMDSP_HPP_
+#define STMDSP_HPP_
 
 #include <fstream>
 #include <set>
@@ -57,4 +57,5 @@ namespace stmdsp
     };
 }
 
-#endif // STMDSPSCANNER_H
+#endif // STMDSP_HPP_
+
diff --git a/gui/wxapp.hpp b/gui/wxapp.hpp
new file mode 100644 (file)
index 0000000..6536554
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef WXAPP_HPP_
+#define WXAPP_HPP_
+
+#include "wxmain.hpp"
+
+#include <wx/app.h>
+
+class MainApp : public wxApp
+{
+public:
+    virtual bool OnInit() final {
+        auto mainFrame = new MainFrame;
+        mainFrame->Show(true);
+        SetTopWindow(mainFrame);
+        return true;
+    }
+};
+
+#endif // WXAPP_HPP_
+
diff --git a/gui/wxmain.hpp b/gui/wxmain.hpp
new file mode 100644 (file)
index 0000000..b5122f6
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef WXMAIN_HPP_
+#define WXMAIN_HPP_
+
+#include <wx/frame.h>
+#include <wx/stattext.h>
+
+class MainFrame : public wxFrame
+{
+public:
+    MainFrame() : wxFrame(nullptr, -1, "Hello world", wxPoint(50, 50), wxSize(640, 480))
+    {
+        auto lTitle = new wxStaticText(this, wxID_ANY, "Welcome to the GUI.");
+    }
+};
+
+#endif // WXMAIN_HPP_
+