Skip to content

Instantly share code, notes, and snippets.

@vadz
Last active December 21, 2015 22:49
Show Gist options
  • Save vadz/6377493 to your computer and use it in GitHub Desktop.
Save vadz/6377493 to your computer and use it in GitHub Desktop.
A simple wxWidgets example in C++ 98.
#include <wx/wx.h>
class MyFrame : public wxFrame
{
public:
MyFrame() : wxFrame(NULL, wxID_ANY, "Test")
{
wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(new wxStaticText(this, wxID_ANY, "Press to enlarge"), wxSizerFlags().Border().Centre());
wxButton* btn = new wxButton(this, wxID_OK);
btn->Bind(wxEVT_BUTTON, &MyFrame::OnButton, this),
sizer->Add(btn, wxSizerFlags().Border().Centre());
SetSizerAndFit(sizer);
Show(true);
}
private:
void OnButton(wxCommandEvent& event)
{
for ( wxWindowList::iterator it = GetChildren().begin(); it != GetChildren().end(); ++it )
(*it)->SetFont((*it)->GetFont().Larger());
Fit();
}
};
class MyApp : public wxApp
{
public:
virtual bool OnInit() { 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