@interface wxNSSlider : NSSlider
{
- wxWidgetImpl* impl;
+ WXCOCOAIMPL_COMMON_MEMBERS
}
-- (void)setImplementation: (wxWidgetImpl *) theImplementation;
-- (wxWidgetImpl*) implementation;
-- (BOOL) isFlipped;
+WXCOCOAIMPL_COMMON_INTERFACE
+
- (void) clickedAction: (id) sender;
@end
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
long style,
long extraStyle)
{
- NSView* sv = (wxpeer->GetParent()->GetHandle() );
-
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSSlider* v = [[wxNSSlider alloc] initWithFrame:r];
[v setMinValue: minimum];
[v setMaxValue: maximum];
[v setFloatValue: (double) value];
- [sv addSubview:v];
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
[v setImplementation:c];
return c;