X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ca21e6dd63f029405c08ab6c4504da5f4949271..9859d369b49e35a1cad0f760173e165f974fb6cb:/samples/render/render.cpp diff --git a/samples/render/render.cpp b/samples/render/render.cpp index 37f7a30736..b8a3ddc525 100644 --- a/samples/render/render.cpp +++ b/samples/render/render.cpp @@ -59,7 +59,7 @@ class MyRenderer : public wxDelegateRendererNative public: MyRenderer() : wxDelegateRendererNative(wxRendererNative::GetDefault()) { } - virtual void DrawHeaderButton(wxWindow *WXUNUSED(win), + virtual int DrawHeaderButton(wxWindow *WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags) = 0, @@ -70,6 +70,7 @@ public: dc.SetTextForeground(*wxWHITE); dc.DrawRoundedRectangle(rect, 5); dc.DrawLabel(_T("MyRenderer"), wxNullBitmap, rect, wxALIGN_CENTER); + return rect.width; } }; @@ -105,8 +106,10 @@ public: virtual ~MyFrame(); // event handlers (these functions should _not_ be virtual) +#if wxUSE_DYNLIB_CLASS void OnLoad(wxCommandEvent& event); void OnUnload(wxCommandEvent& event); +#endif // wxUSE_DYNLIB_CLASS void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); @@ -149,8 +152,10 @@ END_EVENT_TABLE() enum { // our menu items +#if wxUSE_DYNLIB_CLASS Render_Load = 100, Render_Unload, +#endif // wxUSE_DYNLIB_CLASS // standard menu items Render_Quit = wxID_EXIT, @@ -169,8 +174,10 @@ enum // 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) +#if wxUSE_DYNLIB_CLASS EVT_MENU(Render_Load, MyFrame::OnLoad) EVT_MENU(Render_Unload,MyFrame::OnUnload) +#endif // wxUSE_DYNLIB_CLASS EVT_MENU(Render_Quit, MyFrame::OnQuit) EVT_MENU(Render_About, MyFrame::OnAbout) @@ -194,6 +201,9 @@ IMPLEMENT_APP(MyApp) // 'Main program' equivalent: the program execution "starts" here bool MyApp::OnInit() { + if ( !wxApp::OnInit() ) + return false; + // create the main application window new MyFrame; @@ -218,8 +228,10 @@ MyFrame::MyFrame() #if wxUSE_MENUS // create a menu bar wxMenu *menuFile = new wxMenu; +#if wxUSE_DYNLIB_CLASS menuFile->Append(Render_Load, _T("&Load renderer...\tCtrl-L")); menuFile->Append(Render_Unload, _T("&Unload renderer\tCtrl-U")); +#endif // wxUSE_DYNLIB_CLASS menuFile->Append(Render_Quit, _T("E&xit\tCtrl-Q"), _T("Quit this program")); // the "About" item should be in the help menu @@ -254,6 +266,8 @@ MyFrame::~MyFrame() // event handlers +#if wxUSE_DYNLIB_CLASS + void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event)) { static wxString s_name = _T("renddll"); @@ -306,6 +320,8 @@ void MyFrame::OnUnload(wxCommandEvent& WXUNUSED(event)) } } +#endif // wxUSE_DYNLIB_CLASS + void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { // true is to force the frame to close