]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/render/render.cpp
mac paths updated
[wxWidgets.git] / samples / render / render.cpp
index 2136996b180ff7a8e45282a4c5260db7259baf1c..782bd03f70ad8c3ad0b2dfa5c64e897ca63639cd 100644 (file)
@@ -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;
     }
 };
 
@@ -132,8 +133,10 @@ public:
         dc.DrawText(_T("Below is the standard header button drawn"), 10, 10);
         dc.DrawText(_T("using the current renderer:"), 10, 40);
 
-        wxRendererNative::Get().DrawHeaderButton(this, dc,
-                                                 wxRect(20, 70, 100, 60));
+        wxRendererNative& renderer = wxRendererNative::Get();
+        const wxCoord height = renderer.GetHeaderButtonHeight(this);
+
+        renderer.DrawHeaderButton(this, dc, wxRect(20, 70, 100, height));
     }
 
     DECLARE_EVENT_TABLE()
@@ -200,6 +203,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;