have basic wxwidgets gui working

pull/1/head
Clyne 4 years ago
parent 5233ad146e
commit 876bbbec3a

1
.gitignore vendored

@ -1,4 +1,5 @@
build build
ChibiOS_* ChibiOS_*
**/.* **/.*
gui/stmdspgui

@ -1,13 +1,17 @@
CXX = clang++-10 CXX = g++-10
CXXFLAGS = --std=c++20 -Wall -Wextra -pedantic CXXFLAGS = --std=c++20 \
-Wall -Wextra -pedantic \
-Wno-deprecated-copy \
$(shell wx-config --cxxflags)
CXXFILES = $(wildcard *.cpp) CXXFILES = $(wildcard *.cpp)
LIBS = $(shell wx-config --libs)
OUTELF = stmdspgui OUTELF = stmdspgui
all: $(CXXFILES) all: $(CXXFILES)
@echo " CXX " $(CXXFILES) @echo " CXX " $(CXXFILES)
@$(CXX) $(CXXFLAGS) $(CXXFILES) -o $(OUTELF) @$(CXX) $(CXXFLAGS) $(CXXFILES) $(LIBS) -o $(OUTELF)
clean: clean:
@echo " CLEAN" @echo " CLEAN"

@ -1,15 +1,19 @@
#include "stmdsp.hpp" #include "stmdsp.hpp"
#include "wxapp.hpp"
#include <iostream> #include <iostream>
#include <wx/app.h>
int main() wxIMPLEMENT_APP(MainApp);
{
stmdsp::scanner scanner;
scanner.scan(); //int main()
for (const auto& device : scanner.devices()) //{
std::cout << "Found stmdsp at: " << device.path() << std::endl; // stmdsp::scanner scanner;
//
return 0; // scanner.scan();
} // for (const auto& device : scanner.devices())
// std::cout << "Found stmdsp at: " << device.path() << std::endl;
//
// return 0;
//}

@ -1,5 +1,5 @@
#ifndef STMDSPSCANNER_H #ifndef STMDSP_HPP_
#define STMDSPSCANNER_H #define STMDSP_HPP_
#include <fstream> #include <fstream>
#include <set> #include <set>
@ -57,4 +57,5 @@ namespace stmdsp
}; };
} }
#endif // STMDSPSCANNER_H #endif // STMDSP_HPP_

@ -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_

@ -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_
Loading…
Cancel
Save