From 9d180f3ad0459709707ca591295c7c885d09c614 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Wed, 9 Jul 2003 18:38:44 +0000 Subject: [PATCH 1/1] Implement wxWindowDC::Clear() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21802 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/dcclient.h | 3 +++ src/cocoa/dcclient.mm | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/wx/cocoa/dcclient.h b/include/wx/cocoa/dcclient.h index 0c6c3eee38..481c3e672b 100644 --- a/include/wx/cocoa/dcclient.h +++ b/include/wx/cocoa/dcclient.h @@ -26,6 +26,9 @@ public: // Create a DC corresponding to a window wxWindowDC(wxWindow *win); ~wxWindowDC(void); + + // NSView specific functions + virtual void Clear(); protected: wxWindow *m_window; }; diff --git a/src/cocoa/dcclient.mm b/src/cocoa/dcclient.mm index 430f225b10..b64c2ac01c 100644 --- a/src/cocoa/dcclient.mm +++ b/src/cocoa/dcclient.mm @@ -14,6 +14,9 @@ #import #import +#import +#import +#import /* * wxWindowDC @@ -35,6 +38,19 @@ wxWindowDC::~wxWindowDC(void) { }; +void wxWindowDC::Clear() +{ + wxASSERT(m_window); + + NSGraphicsContext *context = [NSGraphicsContext currentContext]; + [context saveGraphicsState]; + + [m_backgroundBrush.GetNSColor() set]; + [NSBezierPath fillRect:[m_window->GetNSView() bounds]]; + + [context restoreGraphicsState]; +} + /* * wxClientDC */ -- 2.45.2