small sample cleanup (formatting, use stock menu items)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41135 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
{
|
||||
public:
|
||||
// ctor(s)
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
MyFrame(const wxString& title);
|
||||
|
||||
// event handlers (these functions should _not_ be virtual)
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
@@ -55,23 +55,6 @@
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About,
|
||||
Minimal_Back,
|
||||
Minimal_Forward,
|
||||
|
||||
// controls start here (the numbers are, of course, arbitrary)
|
||||
Minimal_Text = 1000
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables and other macros for wxWidgets
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -80,8 +63,8 @@
|
||||
// handlers) which process them. It can be also done at run-time, but for the
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Create a new application object: this macro will allow wxWidgets to create
|
||||
@@ -98,19 +81,16 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// `Main program' equivalent: the program execution "starts" here
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// we use a PNG image in our HTML page
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
// Create the main application window
|
||||
MyFrame *frame = new MyFrame(_("wxHtmlWindow testing application"),
|
||||
wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Show it and tell the application that it's our main window
|
||||
// @@@ what does it do exactly, in fact? is it necessary here?
|
||||
frame->Show(true);
|
||||
SetTopWindow(frame);
|
||||
|
||||
// create and show the main application window
|
||||
MyFrame *frame = new MyFrame(_("wxHtmlWindow testing application"));
|
||||
frame->Show();
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned false here, the
|
||||
@@ -122,16 +102,15 @@
|
||||
// main frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
|
||||
MyFrame::MyFrame(const wxString& title)
|
||||
: wxFrame((wxFrame *)NULL, wxID_ANY, title)
|
||||
{
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
menuFile->Append(Minimal_About, _("&About"));
|
||||
menuFile->Append(Minimal_Quit, _("E&xit"));
|
||||
menuFile->Append(wxID_ABOUT);
|
||||
menuFile->Append(wxID_EXIT);
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
|
Reference in New Issue
Block a user