X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dbeddfb93d3479d03d8ec4c0121dfbe3bbcc422b..33f4afdbc08a2a8b8438420aa9d16aadee0bacc2:/src/osx/cocoa/slider.mm diff --git a/src/osx/cocoa/slider.mm b/src/osx/cocoa/slider.mm index a80fb434d6..cb94d5cf52 100644 --- a/src/osx/cocoa/slider.mm +++ b/src/osx/cocoa/slider.mm @@ -18,12 +18,11 @@ @interface wxNSSlider : NSSlider { - wxWidgetImpl* impl; + WXCOCOAIMPL_COMMON_MEMBERS } -- (void)setImplementation: (wxWidgetImpl *) theImplementation; -- (wxWidgetImpl*) implementation; -- (BOOL) isFlipped; +WXCOCOAIMPL_COMMON_INTERFACE + - (void) clickedAction: (id) sender; @end @@ -39,29 +38,35 @@ return self; } +WXCOCOAIMPL_COMMON_IMPLEMENTATION_NO_MOUSEDOWN + +// we will have a mouseDown, then in the native +// implementation of mouseDown the tracking code +// is calling clickedAction, therefore we wire this +// to thumbtrack and only after super mouseDown +// returns we will call the thumbrelease + - (void) clickedAction: (id) sender { if ( impl ) { wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); if ( wxpeer ) - wxpeer->HandleClicked(0); + wxpeer->TriggerScrollEvent(wxEVT_SCROLL_THUMBTRACK); } } -- (void)setImplementation: (wxWidgetImpl *) theImplementation +-(void)mouseDown:(NSEvent *)event { - impl = theImplementation; -} - -- (wxWidgetImpl*) implementation -{ - return impl; -} + if ( !impl->DoHandleMouseEvent(event) ) + [super mouseDown:event]; -- (BOOL) isFlipped -{ - return YES; + if ( impl ) + { + wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); + if ( wxpeer ) + wxpeer->OSXHandleClicked(0); + } } @end @@ -77,8 +82,6 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, long style, long extraStyle) { - NSView* sv = (wxpeer->GetParent()->GetHandle() ); - NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSSlider* v = [[wxNSSlider alloc] initWithFrame:r]; @@ -99,7 +102,6 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, [v setMinValue: minimum]; [v setMaxValue: maximum]; [v setFloatValue: (double) value]; - [sv addSubview:v]; wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); [v setImplementation:c]; return c;