using subclass as impl ptr, common code in macro because mix-in are not possible in obj-c
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -26,58 +26,8 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __OBJC__
 | 
					#ifdef __OBJC__
 | 
				
			||||||
 | 
					 | 
				
			||||||
    #import <Cocoa/Cocoa.h>
 | 
					    #import <Cocoa/Cocoa.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    #if wxUSE_GUI
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    extern NSRect wxToNSRect( NSView* parent, const wxRect& r );
 | 
					 | 
				
			||||||
    extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect );
 | 
					 | 
				
			||||||
    extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
 | 
					 | 
				
			||||||
    extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p );
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    // used for many wxControls
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    @interface wxNSButton : NSButton
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        wxWidgetImpl* impl;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					 | 
				
			||||||
    - (wxWidgetImpl*) implementation;
 | 
					 | 
				
			||||||
    - (BOOL) isFlipped;
 | 
					 | 
				
			||||||
    - (void) clickedAction: (id) sender;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @interface wxNSBox : NSBox
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        wxWidgetImpl* impl;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					 | 
				
			||||||
    - (wxWidgetImpl*) implementation;
 | 
					 | 
				
			||||||
    - (BOOL) isFlipped;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @interface wxNSTextField : NSTextField
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        wxWidgetImpl* impl;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					 | 
				
			||||||
    - (wxWidgetImpl*) implementation;
 | 
					 | 
				
			||||||
    - (BOOL) isFlipped;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , 
 | 
					 | 
				
			||||||
        bool adjustForOrigin = true );
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    #endif // wxUSE_GUI
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // __OBJC__
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// shared between Cocoa and Carbon
 | 
					// shared between Cocoa and Carbon
 | 
				
			||||||
@@ -166,6 +116,9 @@ public :
 | 
				
			|||||||
    void                SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
 | 
					    void                SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void                InstallEventHandler( WXWidget control = NULL );
 | 
					    void                InstallEventHandler( WXWidget control = NULL );
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    virtual void        DoHandleMouseEvent(NSEvent *event); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    WXWidget m_osxView;
 | 
					    WXWidget m_osxView;
 | 
				
			||||||
    DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
 | 
					    DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
 | 
				
			||||||
@@ -230,6 +183,94 @@ protected :
 | 
				
			|||||||
    DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl)
 | 
					    DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl)
 | 
				
			||||||
};    
 | 
					};    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __OBJC__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    extern NSRect wxToNSRect( NSView* parent, const wxRect& r );
 | 
				
			||||||
 | 
					    extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect );
 | 
				
			||||||
 | 
					    extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
 | 
				
			||||||
 | 
					    extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p );
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    // used for many wxControls
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    @interface wxNSButton : NSButton
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        wxWidgetCocoaImpl* impl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
 | 
					    - (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
 | 
					    - (BOOL) isFlipped;
 | 
				
			||||||
 | 
					    - (void) clickedAction: (id) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @interface wxNSBox : NSBox
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        wxWidgetCocoaImpl* impl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
 | 
					    - (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
 | 
					    - (BOOL) isFlipped;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @interface wxNSTextField : NSTextField
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        wxWidgetCocoaImpl* impl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
 | 
					    - (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
 | 
					    - (BOOL) isFlipped;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , 
 | 
				
			||||||
 | 
					        bool adjustForOrigin = true );
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    // common code snippets for cocoa implementations
 | 
				
			||||||
 | 
					    // later to be done using injection in method table
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    #define WXCOCOAIMPL_COMMON_MOUSE_INTERFACE -(void)mouseDown:(NSEvent *)event ;\
 | 
				
			||||||
 | 
					        -(void)rightMouseDown:(NSEvent *)event ;\
 | 
				
			||||||
 | 
					        -(void)otherMouseDown:(NSEvent *)event ;\
 | 
				
			||||||
 | 
					        -(void)mouseUp:(NSEvent *)event ;\
 | 
				
			||||||
 | 
					        -(void)rightMouseUp:(NSEvent *)event ;\
 | 
				
			||||||
 | 
					        -(void)otherMouseUp:(NSEvent *)event ;\
 | 
				
			||||||
 | 
					        -(void)handleMouseEvent:(NSEvent *)event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #define WXCOCOAIMPL_COMMON_MOUSE_IMPLEMENTATION -(void)mouseDown:(NSEvent *)event \
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            [self handleMouseEvent:event];\
 | 
				
			||||||
 | 
					        }\
 | 
				
			||||||
 | 
					        -(void)rightMouseDown:(NSEvent *)event\
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            [self handleMouseEvent:event];\
 | 
				
			||||||
 | 
					        }\
 | 
				
			||||||
 | 
					        -(void)otherMouseDown:(NSEvent *)event\
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            [self handleMouseEvent:event];\
 | 
				
			||||||
 | 
					        }\
 | 
				
			||||||
 | 
					        -(void)mouseUp:(NSEvent *)event\
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            [self handleMouseEvent:event];\
 | 
				
			||||||
 | 
					        }\
 | 
				
			||||||
 | 
					        -(void)rightMouseUp:(NSEvent *)event\
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            [self handleMouseEvent:event];\
 | 
				
			||||||
 | 
					        }\
 | 
				
			||||||
 | 
					        -(void)otherMouseUp:(NSEvent *)event\
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            [self handleMouseEvent:event];\
 | 
				
			||||||
 | 
					        }\
 | 
				
			||||||
 | 
					        -(void)handleMouseEvent:(NSEvent *)event\
 | 
				
			||||||
 | 
					        {\
 | 
				
			||||||
 | 
					            impl->DoHandleMouseEvent(event);\
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					#endif // __OBJC__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NSCursor
 | 
					// NSCursor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
 | 
					WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,19 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
 | 
				
			|||||||
    NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
 | 
					    NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
 | 
				
			||||||
    wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
 | 
					    wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // trying to get as close as possible to flags
 | 
				
			||||||
 | 
					    if ( style & wxBORDER_NONE )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        [v setBezelStyle:NSShadowlessSquareBezelStyle];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( style & wxBU_AUTODRAW )
 | 
				
			||||||
 | 
					            [v setBezelStyle:NSShadowlessSquareBezelStyle];
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
            [v setBezelStyle:NSRegularSquareBezelStyle];
 | 
					            [v setBezelStyle:NSRegularSquareBezelStyle];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    [v setImage:bitmap.GetNSImage() ];
 | 
					    [v setImage:bitmap.GetNSImage() ];
 | 
				
			||||||
    [v setButtonType:NSMomentaryPushInButton];
 | 
					    [v setButtonType:NSMomentaryPushInButton];
 | 
				
			||||||
    wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
 | 
					    wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,12 +142,12 @@ wxSize wxButton::GetDefaultSize()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,11 +24,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSPopUpButton : NSPopUpButton
 | 
					@interface wxNSPopUpButton : NSPopUpButton
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
- (void) clickedAction: (id) sender;
 | 
					- (void) clickedAction: (id) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -55,12 +55,12 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,10 +19,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSProgressIndicator : NSProgressIndicator
 | 
					@interface wxNSProgressIndicator : NSProgressIndicator
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -37,12 +37,12 @@
 | 
				
			|||||||
    return self;
 | 
					    return self;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -229,13 +229,13 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSCustomOpenGLView : NSView
 | 
					@interface wxNSCustomOpenGLView : NSView
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
    NSOpenGLContext* context;
 | 
					    NSOpenGLContext* context;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (id)initWithFrame:(NSRect)frame;
 | 
					- (id)initWithFrame:(NSRect)frame;
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
@@ -249,12 +249,12 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
 | 
				
			|||||||
    return self;
 | 
					    return self;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,11 +23,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSScroller : NSScroller
 | 
					@interface wxNSScroller : NSScroller
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
 - (void) clickedAction: (id) sender;
 | 
					 - (void) clickedAction: (id) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -54,12 +54,12 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl ;
 | 
					    return impl ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,11 +18,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSSlider : NSSlider
 | 
					@interface wxNSSlider : NSSlider
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
 - (void) clickedAction: (id) sender;
 | 
					 - (void) clickedAction: (id) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,12 +49,12 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,11 +18,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSStepper : NSStepper
 | 
					@interface wxNSStepper : NSStepper
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
 - (void) clickedAction: (id) sender;
 | 
					 - (void) clickedAction: (id) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,12 +49,12 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSSearchField : NSSearchField
 | 
					@interface wxNSSearchField : NSSearchField
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
@@ -47,12 +47,12 @@
 | 
				
			|||||||
    return self;
 | 
					    return self;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,12 +18,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@implementation wxNSBox
 | 
					@implementation wxNSBox
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,31 +29,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
wxSize wxStaticText::DoGetBestSize() const
 | 
					wxSize wxStaticText::DoGetBestSize() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Point bounds;
 | 
					Point bounds;
 | 
				
			||||||
#if wxOSX_USE_CARBON
 | 
					 | 
				
			||||||
    Rect bestsize = { 0 , 0 , 0 , 0 } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // try the built-in best size if available
 | 
					 | 
				
			||||||
    Boolean former = m_peer->GetData<Boolean>( kControlStaticTextIsMultilineTag);
 | 
					 | 
				
			||||||
    m_peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 );
 | 
					 | 
				
			||||||
    m_peer->GetBestRect( &bestsize ) ;
 | 
					 | 
				
			||||||
    m_peer->SetData( kControlStaticTextIsMultilineTag, former );
 | 
					 | 
				
			||||||
    if ( !EmptyRect( &bestsize ) )
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        bounds.h = bestsize.right - bestsize.left ;
 | 
					 | 
				
			||||||
        bounds.v = bestsize.bottom - bestsize.top ;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
#if wxOSX_USE_CARBON
 | 
					 | 
				
			||||||
        ControlFontStyleRec controlFont;
 | 
					 | 
				
			||||||
        OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
 | 
					 | 
				
			||||||
        verify_noerr( err );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        wxCFStringRef str( m_label,  GetFont().GetEncoding() );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if wxOSX_USE_ATSU_TEXT
 | 
					#if wxOSX_USE_ATSU_TEXT
 | 
				
			||||||
 | 
					    OSStatus err = noErr;
 | 
				
			||||||
 | 
					    wxCFStringRef str( m_label,  GetFont().GetEncoding() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SInt16 baseline;
 | 
					    SInt16 baseline;
 | 
				
			||||||
    if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
 | 
					    if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -63,19 +44,20 @@ wxSize wxStaticText::DoGetBestSize() const
 | 
				
			|||||||
        verify_noerr( err );
 | 
					        verify_noerr( err );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        wxClientDC dc(const_cast<wxStaticText*>(this));
 | 
					        wxClientDC dc(const_cast<wxStaticText*>(this));
 | 
				
			||||||
        wxCoord width, height ;
 | 
					        wxCoord width, height ;
 | 
				
			||||||
        dc.GetTextExtent( m_label , &width, &height);
 | 
					        dc.GetTextExtent( m_label , &width, &height);
 | 
				
			||||||
            bounds.h = width;
 | 
					        // Some labels seem to have their last characters
 | 
				
			||||||
 | 
					        // stripped out.  Adding 4 pixels seems to be enough to fix this.
 | 
				
			||||||
 | 
					        bounds.h = width+4;
 | 
				
			||||||
        bounds.v = height;
 | 
					        bounds.v = height;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( m_label.empty() )
 | 
					    if ( m_label.empty() )
 | 
				
			||||||
        bounds.h = 0;
 | 
					        bounds.h = 0;
 | 
				
			||||||
    }
 | 
					
 | 
				
			||||||
    bounds.h += MacGetLeftBorderSize() + MacGetRightBorderSize();
 | 
					    bounds.h += MacGetLeftBorderSize() + MacGetRightBorderSize();
 | 
				
			||||||
    bounds.v += MacGetTopBorderSize() + MacGetBottomBorderSize();
 | 
					    bounds.v += MacGetTopBorderSize() + MacGetBottomBorderSize();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,12 +51,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@implementation wxNSTextField
 | 
					@implementation wxNSTextField
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,26 +32,20 @@ NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@interface wxNSView : NSView
 | 
					@interface wxNSView : NSView
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxWidgetImpl* impl;
 | 
					    wxWidgetCocoaImpl* impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)drawRect: (NSRect) rect;
 | 
					- (void)drawRect: (NSRect) rect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-(void)mouseDown:(NSEvent *)event ;
 | 
					WXCOCOAIMPL_COMMON_MOUSE_INTERFACE
 | 
				
			||||||
-(void)rightMouseDown:(NSEvent *)event ;
 | 
					 | 
				
			||||||
-(void)otherMouseDown:(NSEvent *)event ;
 | 
					 | 
				
			||||||
-(void)mouseUp:(NSEvent *)event ;
 | 
					 | 
				
			||||||
-(void)rightMouseUp:(NSEvent *)event ;
 | 
					 | 
				
			||||||
-(void)otherMouseUp:(NSEvent *)event ;
 | 
					 | 
				
			||||||
-(void)handleMouseEvent:(NSEvent *)event;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)keyDown:(NSEvent *)event;
 | 
					- (void)keyDown:(NSEvent *)event;
 | 
				
			||||||
- (void)keyUp:(NSEvent *)event;
 | 
					- (void)keyUp:(NSEvent *)event;
 | 
				
			||||||
- (void)flagsChanged:(NSEvent *)event;
 | 
					- (void)flagsChanged:(NSEvent *)event;
 | 
				
			||||||
- (void)handleKeyEvent:(NSEvent *)event;
 | 
					- (void)handleKeyEvent:(NSEvent *)event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
 | 
				
			||||||
- (wxWidgetImpl*) implementation;
 | 
					- (wxWidgetCocoaImpl*) implementation;
 | 
				
			||||||
- (BOOL) isFlipped;
 | 
					- (BOOL) isFlipped;
 | 
				
			||||||
- (BOOL) becomeFirstResponder;
 | 
					- (BOOL) becomeFirstResponder;
 | 
				
			||||||
- (BOOL) resignFirstResponder;
 | 
					- (BOOL) resignFirstResponder;
 | 
				
			||||||
@@ -348,47 +342,7 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-(void)mouseDown:(NSEvent *)event 
 | 
					WXCOCOAIMPL_COMMON_MOUSE_IMPLEMENTATION
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [self handleMouseEvent:event];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-(void)rightMouseDown:(NSEvent *)event 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [self handleMouseEvent:event];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-(void)otherMouseDown:(NSEvent *)event 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [self handleMouseEvent:event];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-(void)mouseUp:(NSEvent *)event 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [self handleMouseEvent:event];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-(void)rightMouseUp:(NSEvent *)event 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [self handleMouseEvent:event];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-(void)otherMouseUp:(NSEvent *)event 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    [self handleMouseEvent:event];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-(void)handleMouseEvent:(NSEvent *)event 
 | 
					 | 
				
			||||||
{ 
 | 
					 | 
				
			||||||
    NSPoint clickLocation; 
 | 
					 | 
				
			||||||
    clickLocation = [self convertPoint:[event locationInWindow] fromView:nil]; 
 | 
					 | 
				
			||||||
    wxPoint pt = wxFromNSPoint( self, clickLocation );
 | 
					 | 
				
			||||||
    wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
 | 
					 | 
				
			||||||
    SetupMouseEvent( wxevent , event ) ;
 | 
					 | 
				
			||||||
    wxevent.m_x = pt.x;
 | 
					 | 
				
			||||||
    wxevent.m_y = pt.y;
 | 
					 | 
				
			||||||
    impl->GetWXPeer()->HandleWindowEvent(wxevent);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)keyDown:(NSEvent *)event
 | 
					- (void)keyDown:(NSEvent *)event
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -413,12 +367,12 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
 | 
					- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    impl = theImplementation;
 | 
					    impl = theImplementation;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (wxWidgetImpl*) implementation
 | 
					- (wxWidgetCocoaImpl*) implementation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return impl;
 | 
					    return impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -722,6 +676,19 @@ void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control )
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    NSPoint clickLocation; 
 | 
				
			||||||
 | 
					    clickLocation = [m_osxView convertPoint:[event locationInWindow] fromView:nil]; 
 | 
				
			||||||
 | 
					    wxPoint pt = wxFromNSPoint( m_osxView, clickLocation );
 | 
				
			||||||
 | 
					    wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
 | 
				
			||||||
 | 
					    SetupMouseEvent( wxevent , event ) ;
 | 
				
			||||||
 | 
					    wxevent.m_x = pt.x;
 | 
				
			||||||
 | 
					    wxevent.m_y = pt.y;
 | 
				
			||||||
 | 
					    GetWXPeer()->HandleWindowEvent(wxevent);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Factory methods
 | 
					// Factory methods
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user