rename the menu to avoid conflict with a standard Mac menu

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-10 16:51:52 +00:00
parent 25fab0dca9
commit 1f602af615
2 changed files with 14 additions and 13 deletions

View File

@@ -87,10 +87,10 @@ BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_KEY_DOWN(TestGLCanvas::OnKeyDown) EVT_KEY_DOWN(TestGLCanvas::OnKeyDown)
END_EVENT_TABLE() END_EVENT_TABLE()
static /* const */ int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 }; static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
TestGLCanvas::TestGLCanvas(wxWindow *parent) TestGLCanvas::TestGLCanvas(wxWindow *parent)
: wxGLCanvas(parent, wxID_ANY, attribs) : wxGLCanvas(parent, wxID_ANY, NULL /* attribs */)
{ {
m_gllist = 0; m_gllist = 0;
@@ -101,8 +101,6 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent)
// this function is called on each repaint so it should be fast // this function is called on each repaint so it should be fast
void TestGLCanvas::Render() void TestGLCanvas::Render()
{ {
wxGetApp().SetCurrent(this);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glCallList(m_gllist); glCallList(m_gllist);
@@ -112,6 +110,8 @@ void TestGLCanvas::Render()
void TestGLCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) void TestGLCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
wxGetApp().SetCurrent(this);
// initialize if not done yet // initialize if not done yet
InitGL(); InitGL();
@@ -141,8 +141,6 @@ void TestGLCanvas::InitGL()
if ( IsInitialized() ) if ( IsInitialized() )
return; return;
wxGetApp().SetCurrent(this);
/* set viewing projection */ /* set viewing projection */
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
@@ -253,8 +251,8 @@ void TestGLCanvas::OnKeyDown( wxKeyEvent& event )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyFrame, wxFrame) BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
EVT_MENU(wxID_NEW, MyFrame::OnNewWindow) EVT_MENU(wxID_NEW, MyFrame::OnNewWindow)
EVT_MENU(wxID_CLOSE, MyFrame::OnClose)
END_EVENT_TABLE() END_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
@@ -266,18 +264,21 @@ MyFrame::MyFrame()
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
// Make a menubar // Make a menubar
wxMenu *winMenu = new wxMenu; wxMenu *menu = new wxMenu;
winMenu->Append(wxID_EXIT, _T("&Close")); menu->Append(wxID_NEW);
winMenu->Append(wxID_NEW, _T("&New") ); menu->AppendSeparator();
menu->Append(wxID_CLOSE);
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(winMenu, _T("&Window")); menuBar->Append(menu, _T("&Cube"));
SetMenuBar(menuBar); SetMenuBar(menuBar);
CreateStatusBar();
Show(); Show();
} }
void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnClose(wxCommandEvent& WXUNUSED(event))
{ {
// true is to force the frame to close // true is to force the frame to close
Close(true); Close(true);

View File

@@ -45,7 +45,7 @@ public:
void RefreshCanvas(); void RefreshCanvas();
private: private:
void OnExit(wxCommandEvent& event); void OnClose(wxCommandEvent& event);
void OnNewWindow(wxCommandEvent& event); void OnNewWindow(wxCommandEvent& event);
void OnDefRotateLeftKey(wxCommandEvent& event); void OnDefRotateLeftKey(wxCommandEvent& event);
void OnDefRotateRightKey(wxCommandEvent& event); void OnDefRotateRightKey(wxCommandEvent& event);