void InstallEventHandler( WXWidget control = NULL );
- virtual void DoHandleMouseEvent(NSEvent *event);
+ virtual bool DoHandleMouseEvent(NSEvent *event);
protected:
WXWidget m_osxView;
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 );
-(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];\
+ if ( !impl->DoHandleMouseEvent(event) )\
+ [super mouseDown:event];\
}\
-(void)rightMouseDown:(NSEvent *)event\
{\
- [self handleMouseEvent:event];\
+ if ( !impl->DoHandleMouseEvent(event) )\
+ [super rightMouseDown:event];\
}\
-(void)otherMouseDown:(NSEvent *)event\
{\
- [self handleMouseEvent:event];\
+ if ( !impl->DoHandleMouseEvent(event) )\
+ [super otherMouseDown:event];\
}\
-(void)mouseUp:(NSEvent *)event\
{\
- [self handleMouseEvent:event];\
+ if ( !impl->DoHandleMouseEvent(event) )\
+ [super mouseUp:event];\
}\
-(void)rightMouseUp:(NSEvent *)event\
{\
- [self handleMouseEvent:event];\
+ if ( !impl->DoHandleMouseEvent(event) )\
+ [super rightMouseUp:event];\
}\
-(void)otherMouseUp:(NSEvent *)event\
{\
- [self handleMouseEvent:event];\
- }\
- -(void)handleMouseEvent:(NSEvent *)event\
- {\
- impl->DoHandleMouseEvent(event);\
+ if ( !impl->DoHandleMouseEvent(event) )\
+ [super otherMouseUp:event];\
}
+ #define WXCOCOAIMPL_COMMON_MEMBERS wxWidgetCocoaImpl* impl;
+
+ #define WXCOCOAIMPL_COMMON_INTERFACE \
+ - (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;\
+ - (wxWidgetCocoaImpl*) implementation;\
+ - (BOOL) isFlipped;\
+ WXCOCOAIMPL_COMMON_MOUSE_INTERFACE
+
+ #define WXCOCOAIMPL_COMMON_IMPLEMENTATION WXCOCOAIMPL_COMMON_MOUSE_IMPLEMENTATION \
+ - (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation\
+ {\
+ impl = theImplementation;\
+ }\
+ - (wxWidgetCocoaImpl*) implementation\
+ {\
+ return impl;\
+ }\
+ - (BOOL) isFlipped\
+ {\
+ return YES;\
+ }\
+
+ // used for many wxControls
+
+ @interface wxNSButton : NSButton
+ {
+ WXCOCOAIMPL_COMMON_MEMBERS
+ }
+
+ WXCOCOAIMPL_COMMON_INTERFACE
+ - (void) clickedAction: (id) sender;
+
+ @end
+
+ @interface wxNSBox : NSBox
+ {
+ WXCOCOAIMPL_COMMON_MEMBERS
+ }
+
+ WXCOCOAIMPL_COMMON_INTERFACE
+
+ @end
+
+ @interface wxNSTextField : NSTextField
+ {
+ WXCOCOAIMPL_COMMON_MEMBERS
+ }
+
+ WXCOCOAIMPL_COMMON_INTERFACE
+
+ @end
+
+
#endif // __OBJC__
// NSCursor
return self;
}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
+
- (void) clickedAction: (id) sender
{
if ( impl )
}
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
-
- (int) intValue
{
switch ( [self state] )
@interface wxNSPopUpButton : NSPopUpButton
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
+
- (void) clickedAction: (id) sender;
@end
}
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
- (int) intValue
{
@interface wxNSProgressIndicator : NSProgressIndicator
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
@end
return self;
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
@end
@interface wxNSCustomOpenGLView : NSView
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
NSOpenGLContext* context;
}
- (id)initWithFrame:(NSRect)frame;
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+
+WXCOCOAIMPL_COMMON_INTERFACE
@end
return self;
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
- (BOOL)isOpaque
{
@interface wxNSTabView : NSTabView
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
@end
@implementation wxNSTabView
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
@end
@interface wxNSScroller : NSScroller
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
+
- (void) clickedAction: (id) sender;
@end
}
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl ;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
@end
@interface wxNSSlider : NSSlider
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
+
- (void) clickedAction: (id) sender;
@end
}
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
@end
@interface wxNSStepper : NSStepper
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
+
- (void) clickedAction: (id) sender;
@end
}
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
@end
@interface wxNSSearchField : NSSearchField
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
+WXCOCOAIMPL_COMMON_INTERFACE
+
@end
@implementation wxNSSearchField
return self;
}
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
// use our common calls
- (void) setTitle:(NSString *) title
@implementation wxNSTextField
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
// use our common calls
- (void) setTitle:(NSString *) title
@interface wxNSView : NSView
{
- wxWidgetCocoaImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
- (void)drawRect: (NSRect) rect;
-WXCOCOAIMPL_COMMON_MOUSE_INTERFACE
-
- (void)keyDown:(NSEvent *)event;
- (void)keyUp:(NSEvent *)event;
- (void)flagsChanged:(NSEvent *)event;
- (void)handleKeyEvent:(NSEvent *)event;
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation;
-- (wxWidgetCocoaImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
+
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
- (BOOL) canBecomeKeyView;
}
}
-WXCOCOAIMPL_COMMON_MOUSE_IMPLEMENTATION
+WXCOCOAIMPL_COMMON_IMPLEMENTATION
- (void)keyDown:(NSEvent *)event
{
impl->GetWXPeer()->HandleWindowEvent(wxevent);
}
-
-- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation
-{
- impl = theImplementation;
-}
-
-- (wxWidgetCocoaImpl*) implementation
-{
- return impl;
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
-
- (BOOL) becomeFirstResponder
{
BOOL r = [super becomeFirstResponder];
{
}
-void wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event)
+bool wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event)
{
NSPoint clickLocation;
clickLocation = [m_osxView convertPoint:[event locationInWindow] fromView:nil];
SetupMouseEvent( wxevent , event ) ;
wxevent.m_x = pt.x;
wxevent.m_y = pt.y;
- GetWXPeer()->HandleWindowEvent(wxevent);
+
+ return GetWXPeer()->HandleWindowEvent(wxevent);
}