have basic wxwidgets gui working

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

1
.gitignore vendored

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

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

@ -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;
//}

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

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