Implemented wxWindowCocoa::Cocoa_drawRect
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
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
#include "wx/hashmap.h"
|
#include "wx/hashmap.h"
|
||||||
#include "wx/cocoa/ObjcPose.h"
|
#include "wx/cocoa/ObjcPose.h"
|
||||||
|
|
||||||
|
typedef struct _NSRect NSRect;
|
||||||
|
|
||||||
WX_DECLARE_OBJC_HASHMAP(NSView);
|
WX_DECLARE_OBJC_HASHMAP(NSView);
|
||||||
class wxCocoaNSView
|
class wxCocoaNSView
|
||||||
{
|
{
|
||||||
@@ -27,6 +29,7 @@ protected:
|
|||||||
static void *sm_cocoaObserver;
|
static void *sm_cocoaObserver;
|
||||||
public:
|
public:
|
||||||
virtual void Cocoa_FrameChanged(void) = 0;
|
virtual void Cocoa_FrameChanged(void) = 0;
|
||||||
|
virtual bool Cocoa_drawRect(const NSRect &rect) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_COCOA_NSVIEW_H_
|
#endif // _WX_COCOA_NSVIEW_H_
|
||||||
|
@@ -53,8 +53,9 @@ public:
|
|||||||
inline WX_NSView GetNSView() { return m_cocoaNSView; }
|
inline WX_NSView GetNSView() { return m_cocoaNSView; }
|
||||||
void CocoaAddChild(wxWindowCocoa *child);
|
void CocoaAddChild(wxWindowCocoa *child);
|
||||||
void CocoaRemoveFromParent(void);
|
void CocoaRemoveFromParent(void);
|
||||||
virtual void Cocoa_FrameChanged(void);
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void Cocoa_FrameChanged(void);
|
||||||
|
virtual bool Cocoa_drawRect(const NSRect &rect);
|
||||||
void SetNSView(WX_NSView cocoaNSView);
|
void SetNSView(WX_NSView cocoaNSView);
|
||||||
WX_NSView m_cocoaNSView;
|
WX_NSView m_cocoaNSView;
|
||||||
WX_NSView m_dummyNSView;
|
WX_NSView m_dummyNSView;
|
||||||
|
@@ -53,11 +53,19 @@ void wxCocoaNSView::DisassociateNSView(WX_NSView cocoaNSView)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)drawRect: (NSRect)rect;
|
||||||
@end // wxPoserNSView
|
@end // wxPoserNSView
|
||||||
|
|
||||||
WX_IMPLEMENT_POSER(wxPoserNSView);
|
WX_IMPLEMENT_POSER(wxPoserNSView);
|
||||||
@implementation wxPoserNSView : NSView
|
@implementation wxPoserNSView : NSView
|
||||||
|
|
||||||
|
- (void)drawRect: (NSRect)rect
|
||||||
|
{
|
||||||
|
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||||
|
if( !win || !win->Cocoa_drawRect(rect) )
|
||||||
|
[super drawRect:rect];
|
||||||
|
}
|
||||||
|
|
||||||
@end // implementation wxPoserNSView
|
@end // implementation wxPoserNSView
|
||||||
|
|
||||||
@interface wxNSViewNotificationObserver : NSObject
|
@interface wxNSViewNotificationObserver : NSObject
|
||||||
|
@@ -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]);
|
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)
|
void wxWindowCocoa::Cocoa_FrameChanged(void)
|
||||||
{
|
{
|
||||||
wxLogDebug("Cocoa_FrameChanged");
|
wxLogDebug("Cocoa_FrameChanged");
|
||||||
|
Reference in New Issue
Block a user