mirror of
https://review.haiku-os.org/haiku
synced 2025-02-22 21:48:35 +01:00
* fix keyboard handling to trigger the correct invokation message
* add support for B_HOME and B_END key (jump to min/max value) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23285 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
20817b7706
commit
01c2f44ee8
@ -404,27 +404,33 @@ BSlider::KeyDown(const char *bytes, int32 numBytes)
|
||||
if (!IsEnabled() || IsHidden())
|
||||
return;
|
||||
|
||||
int32 newValue = Value();
|
||||
|
||||
switch (bytes[0]) {
|
||||
case B_LEFT_ARROW:
|
||||
case B_DOWN_ARROW: {
|
||||
int32 oldValue = Value();
|
||||
|
||||
SetValue(Value() - KeyIncrementValue());
|
||||
if (oldValue != Value())
|
||||
Invoke();
|
||||
newValue -= KeyIncrementValue();
|
||||
break;
|
||||
}
|
||||
case B_RIGHT_ARROW:
|
||||
case B_UP_ARROW: {
|
||||
int32 oldValue = Value();
|
||||
|
||||
SetValue(Value() + KeyIncrementValue());
|
||||
if (oldValue != Value())
|
||||
Invoke();
|
||||
newValue += KeyIncrementValue();
|
||||
break;
|
||||
}
|
||||
case B_HOME:
|
||||
newValue = fMinValue;
|
||||
break;
|
||||
case B_END:
|
||||
newValue = fMaxValue;
|
||||
break;
|
||||
default:
|
||||
BControl::KeyDown(bytes, numBytes);
|
||||
return;
|
||||
}
|
||||
|
||||
if (newValue != Value()) {
|
||||
SetValue(newValue);
|
||||
InvokeNotify(ModificationMessage(), B_CONTROL_MODIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user