]> code.bitgloo.com Git - clyne/stmdsp.git/commitdiff
button input
authorClyne Sullivan <clyne@bitgloo.com>
Fri, 12 Jun 2020 23:07:29 +0000 (19:07 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Fri, 12 Jun 2020 23:07:29 +0000 (19:07 -0400)
gui/wxmain.hpp

index b5122f64bb4b4572c9193b288eda9885a89e0d58..793fbc1a103cff46c8d6f38a872a7ecbb1b3c3a7 100644 (file)
@@ -1,15 +1,29 @@
 #ifndef WXMAIN_HPP_
 #define WXMAIN_HPP_
 
+#include <wx/button.h>
 #include <wx/frame.h>
 #include <wx/stattext.h>
 
 class MainFrame : public wxFrame
 {
+    enum Id {
+        Welcome = 1,
+        Single
+    };
+
 public:
     MainFrame() : wxFrame(nullptr, -1, "Hello world", wxPoint(50, 50), wxSize(640, 480))
     {
-        auto lTitle = new wxStaticText(this, wxID_ANY, "Welcome to the GUI.");
+        new wxStaticText(this, Id::Welcome, "Welcome to the GUI.", wxPoint(20, 20));
+        new wxButton(this, Id::Single, "Single", wxPoint(20, 60));
+
+        Bind(wxEVT_BUTTON, &MainFrame::onSinglePressed, this, Id::Single);
+    }
+
+    void onSinglePressed(wxCommandEvent& ce) {
+        auto button = dynamic_cast<wxButton *>(ce.GetEventObject());
+        button->SetLabel("Nice");
     }
 };