Created
February 28, 2012 16:29
-
-
Save hajimehoshi/1933478 to your computer and use it in GitHub Desktop.
wxMac 2.8 Test
This file contains hidden or 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
// Ref: http://www.wxwidgets.org/docs/tutorials/hello.htm | |
#include "wx/wx.h" | |
enum { | |
ID_Quit = 1, | |
ID_About, | |
}; | |
class MyFrame : public wxFrame { | |
public: | |
MyFrame(wxString const& title, | |
wxPoint const& pos, | |
wxSize const& size) | |
: wxFrame(0, -1, title, pos, size) { | |
wxMenu* menuFile = new wxMenu(); | |
menuFile->Append(ID_About, _("&About...")); | |
menuFile->AppendSeparator(); | |
menuFile->Append(ID_Quit, _("E&xit")); | |
wxMenuBar* menuBar = new wxMenuBar(); | |
menuBar->Append(menuFile, _("&File")); | |
SetMenuBar(menuBar); | |
CreateStatusBar(); | |
SetStatusText(_("Welcome to wxWidgets!")); | |
} | |
void | |
OnQuit(wxCommandEvent& event) { | |
Close(true); | |
} | |
void | |
OnAbout(wxCommandEvent& event) { | |
wxMessageBox(_("This is a wxWidgets Hello world sample"), | |
_("About Hello World"), | |
wxOK | wxICON_INFORMATION, | |
this); | |
} | |
DECLARE_EVENT_TABLE(); | |
}; | |
BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |
EVT_MENU(ID_Quit, MyFrame::OnQuit) | |
EVT_MENU(ID_About, MyFrame::OnAbout) | |
END_EVENT_TABLE() | |
class MyApp : public wxApp { | |
virtual bool OnInit() { | |
MyFrame* frame = new MyFrame(_("Hello World"), wxPoint(50, 50), wxSize(450, 340)); | |
frame->Show(true); | |
SetTopWindow(frame); | |
return true; | |
} | |
}; | |
IMPLEMENT_APP(MyApp) |
This file contains hidden or 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
TARG := wxtest | |
run: $(TARG).app | |
open $< | |
$(TARG).app: $(TARG) | |
mkdir -p $@/Contents/MacOS | |
cp $< $@/Contents/MacOS | |
$(TARG): main.cpp | |
clang++ -o $@ `wx-config --cppflags --libs` $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment