Last active
December 21, 2015 22:59
-
-
Save vadz/6378729 to your computer and use it in GitHub Desktop.
A simple wxWidgets example converted to C++11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wx/wx.h> | |
class MyFrame : public wxFrame | |
{ | |
public: | |
MyFrame() : wxFrame(nullptr, wxID_ANY, "Test") | |
{ | |
auto sizer = new wxBoxSizer(wxHORIZONTAL); | |
sizer->Add(new wxStaticText(this, wxID_ANY, "Press to enlarge"), wxSizerFlags().Border().Centre()); | |
auto btn = new wxButton(this, wxID_OK); | |
btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) { | |
for ( auto& w: GetChildren() ) | |
w->SetFont(w->GetFont().Larger()); | |
Fit(); | |
}); | |
sizer->Add(btn, wxSizerFlags().Border().Centre()); | |
SetSizerAndFit(sizer); | |
Show(true); | |
} | |
}; | |
class MyApp : public wxApp | |
{ | |
public: | |
virtual bool OnInit() override { new MyFrame; return true; } | |
}; | |
wxIMPLEMENT_APP(MyApp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment