Merged trunk 46229 (NOTE: CVS) inside #if 0 pending research into how to do it in an ABI-compatible way:

Implement mouse entered, exited, and synthesize move events while the mouse is inside.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2007-07-28 19:06:06 +00:00
parent 45b891b8e1
commit 19d3db8dec
7 changed files with 303 additions and 4 deletions

View File

@@ -37,6 +37,9 @@ public:
virtual wxWindow* GetWxWindow() const
{ return NULL; }
virtual void Cocoa_FrameChanged(void) = 0;
#if 0 // ABI incompatibility
virtual void Cocoa_synthesizeMouseMoved(void) = 0;
#endif
virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse, WX_NSEvent theEvent)
{ return false; }
virtual bool Cocoa_drawRect(const NSRect &rect)
@@ -67,6 +70,12 @@ public:
{ return false; }
virtual bool Cocoa_resetCursorRects()
{ return false; }
#if 0 // ABI incompatibility
virtual bool Cocoa_viewDidMoveToWindow()
{ return false; }
virtual bool Cocoa_viewWillMoveToWindow(WX_NSWindow newWindow)
{ return false; }
#endif
virtual ~wxCocoaNSView() { }
};

View File

@@ -37,6 +37,8 @@
- (void)otherMouseDragged:(NSEvent *)theEvent;
- (void)otherMouseUp:(NSEvent *)theEvent;
- (void)resetCursorRects;
- (void)viewDidMoveToWindow;
- (void)viewWillMoveToWindow:(NSWindow *)newWindow;
@end // WXNSView
WX_DECLARE_GET_OBJC_CLASS(WXNSView,NSView)

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/cocoa/trackingrectmanager.h
// Purpose: wxCocoaTrackingRectManager
// Notes: Source in window.mm
// Author: David Elliott <dfe@cox.net>
// Modified by:
// Created: 2007/05/02
// RCS-ID: $Id$
// Copyright: (c) 2007 Software 2000 Ltd.
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_TRACKINGRECTMANAGER_H__
#define __WX_COCOA_TRACKINGRECTMANAGER_H__
#include <CoreFoundation/CFRunLoop.h>
class wxCocoaTrackingRectManager
{
DECLARE_NO_COPY_CLASS(wxCocoaTrackingRectManager)
public:
wxCocoaTrackingRectManager(wxWindow *window);
void ClearTrackingRect();
void BuildTrackingRect();
void RebuildTrackingRect();
bool IsOwnerOfEvent(NSEvent *anEvent);
~wxCocoaTrackingRectManager();
void BeginSynthesizingEvents();
void StopSynthesizingEvents();
protected:
wxWindow *m_window;
bool m_isTrackingRectActive;
int m_trackingRectTag;
CFRunLoopObserverRef m_runLoopObserver;
private:
wxCocoaTrackingRectManager();
};
#endif // ndef __WX_COCOA_TRACKINGRECTMANAGER_H__

View File

@@ -22,6 +22,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform);
class wxWindowCocoaHider;
class wxWindowCocoaScrollView;
class wxCocoaTrackingRectManager;
// ========================================================================
// wxWindowCocoa
@@ -33,6 +34,7 @@ class WXDLLEXPORT wxWindowCocoa: public wxWindowBase, protected wxCocoaNSView
DECLARE_EVENT_TABLE()
friend wxWindow *wxWindowBase::GetCapture();
friend class wxWindowCocoaScrollView;
friend class wxCocoaTrackingRectManager;
// ------------------------------------------------------------------------
// initialization
// ------------------------------------------------------------------------
@@ -93,6 +95,11 @@ protected:
void InitMouseEvent(wxMouseEvent &event, WX_NSEvent cocoaEvent);
virtual wxWindow* GetWxWindow() const;
virtual void Cocoa_FrameChanged(void);
#if 0 // ABI incompatibility
virtual void Cocoa_synthesizeMouseMoved(void);
#else
void Cocoa_synthesizeMouseMoved(void);
#endif
virtual bool Cocoa_drawRect(const NSRect &rect);
virtual bool Cocoa_mouseDown(WX_NSEvent theEvent);
virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent);
@@ -107,11 +114,18 @@ protected:
virtual bool Cocoa_otherMouseDragged(WX_NSEvent theEvent);
virtual bool Cocoa_otherMouseUp(WX_NSEvent theEvent);
virtual bool Cocoa_resetCursorRects();
#if 0 // ABI incompatibility
virtual bool Cocoa_viewDidMoveToWindow();
virtual bool Cocoa_viewWillMoveToWindow(WX_NSWindow newWindow);
#endif
void SetNSView(WX_NSView cocoaNSView);
WX_NSView m_cocoaNSView;
wxWindowCocoaHider *m_cocoaHider;
wxWindowCocoaScrollView *m_wxCocoaScrollView;
bool m_isInPaint;
#if 0 // ABI incompatibility
wxCocoaTrackingRectManager *m_visibleTrackingRectManager;
#endif
static wxWindow *sm_capturedWindow;
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
void SetInitialFrameRect(const wxPoint& pos, const wxSize& size);