]> git.saurik.com Git - wxWidgets.git/commitdiff
Implemented wxWindowCocoa::Cocoa_drawRect
authorDavid Elliott <dfe@tgwbd.org>
Tue, 1 Apr 2003 17:59:54 +0000 (17:59 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Tue, 1 Apr 2003 17:59:54 +0000 (17:59 +0000)
Implemented drawRect override in wxPoserNSView
Declared pure virtual wxCocoaNSView::Cocoa_drawRect
Made wxWindowCocoa::Cocoa_FrameChanged protected (unrelated)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/cocoa/NSView.h
include/wx/cocoa/window.h
src/cocoa/NSView.mm
src/cocoa/window.mm

index 10a172fa81fbeb64a3e71edb991c632ba00b01d9..3fc6c7904f2d49987123e55e7b107b984fbd0cfc 100644 (file)
@@ -15,6 +15,8 @@
 #include "wx/hashmap.h"
 #include "wx/cocoa/ObjcPose.h"
 
+typedef struct _NSRect NSRect;
+
 WX_DECLARE_OBJC_HASHMAP(NSView);
 class wxCocoaNSView
 {
@@ -27,6 +29,7 @@ protected:
     static void *sm_cocoaObserver;
 public:
     virtual void Cocoa_FrameChanged(void) = 0;
+    virtual bool Cocoa_drawRect(const NSRect &rect) = 0;
 };
 
 #endif // _WX_COCOA_NSVIEW_H_
index b0542e1bfa63a2bb7ae6e018db3b8c95caeec4d9..760d6661a6915f2a8b665457bc9b0da2d13e63af 100644 (file)
@@ -53,8 +53,9 @@ public:
     inline WX_NSView GetNSView() { return m_cocoaNSView; }
     void CocoaAddChild(wxWindowCocoa *child);
     void CocoaRemoveFromParent(void);
-    virtual void Cocoa_FrameChanged(void);
 protected:
+    virtual void Cocoa_FrameChanged(void);
+    virtual bool Cocoa_drawRect(const NSRect &rect);
     void SetNSView(WX_NSView cocoaNSView);
     WX_NSView m_cocoaNSView;
     WX_NSView m_dummyNSView;
index 0238c5c50a0583312f8ac369e219f0bf59802246..ea6965631670e69471d79e4c84300e7cd33f11c7 100644 (file)
@@ -53,11 +53,19 @@ void wxCocoaNSView::DisassociateNSView(WX_NSView cocoaNSView)
 {
 }
 
+- (void)drawRect: (NSRect)rect;
 @end // wxPoserNSView
 
 WX_IMPLEMENT_POSER(wxPoserNSView);
 @implementation wxPoserNSView : NSView
 
+- (void)drawRect: (NSRect)rect
+{
+    wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
+    if( !win || !win->Cocoa_drawRect(rect) )
+        [super drawRect:rect];
+}
+
 @end // implementation wxPoserNSView
 
 @interface wxNSViewNotificationObserver : NSObject
index e877d7371bf415cd6d68eb2a9a27e96eb572fb9d..31c729fcca4e6c8022e04a88ade01b47157011fa 100644 (file)
@@ -116,6 +116,15 @@ void wxWindowCocoa::SetNSView(WX_NSView cocoaNSView)
     if(need_debug) wxLogDebug("wxWindowCocoa=%p::SetNSView [cocoaNSView=%p retainCount]=%d",this,cocoaNSView,[cocoaNSView retainCount]);
 }
 
+bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect)
+{
+    wxLogDebug("Cocoa_drawRect");
+    //FIXME: should probably turn that rect into the update region
+    wxPaintEvent event(m_windowId);
+    event.SetEventObject(this);
+    return GetEventHandler()->ProcessEvent(event);
+}
+
 void wxWindowCocoa::Cocoa_FrameChanged(void)
 {
     wxLogDebug("Cocoa_FrameChanged");