From 1d5f879ad2eb017df4f853024cd5f11be5ffab59 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Thu, 17 Jan 2002 00:20:05 +0000 Subject: [PATCH] Do not process mouse down events if the slider is disabled git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12128 72102866-910b-0410-8b05-ffd578937521 --- Source/NSSlider.m | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Source/NSSlider.m b/Source/NSSlider.m index 7726af744..de81b5167 100644 --- a/Source/NSSlider.m +++ b/Source/NSSlider.m @@ -417,31 +417,33 @@ static Class cellClass; - (void) mouseDown: (NSEvent *)theEvent { - NSPoint location = [self convertPoint: [theEvent locationInWindow] - fromView: nil]; - NSRect rect; - - rect = [_cell knobRectFlipped: _rFlags.flipped_view]; - if (![self mouse: location inRect: rect]) + if ([_cell isEnabled]) { - // Mouse is not on the knob, move the knob to the mouse position - float floatValue; - floatValue = _floatValueForMousePoint (location, rect, - [_cell trackRect], - [_cell isVertical], - [_cell minValue], - [_cell maxValue], _cell, - _rFlags.flipped_view); - [_cell setFloatValue: floatValue]; - if ([_cell isContinuous]) + NSPoint location = [self convertPoint: [theEvent locationInWindow] + fromView: nil]; + NSRect rect; + + rect = [_cell knobRectFlipped: _rFlags.flipped_view]; + if (![self mouse: location inRect: rect]) { - [self sendAction: [_cell action] to: [_cell target]]; + // Mouse is not on the knob, move the knob to the mouse position + float floatValue; + floatValue = _floatValueForMousePoint (location, rect, + [_cell trackRect], + [_cell isVertical], + [_cell minValue], + [_cell maxValue], _cell, + _rFlags.flipped_view); + [_cell setFloatValue: floatValue]; + if ([_cell isContinuous]) + { + [self sendAction: [_cell action] to: [_cell target]]; + } + [_cell drawWithFrame: _bounds inView: self]; + [_window flushWindow]; } - [_cell drawWithFrame: _bounds inView: self]; - [_window flushWindow]; + + [self trackKnob: theEvent knobRect: rect]; } - - [self trackKnob: theEvent knobRect: rect]; } - @end