mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
Changed ListBox to pass-on left/right key events.
This commit is contained in:
parent
629efdbd3c
commit
023b9ac6cc
3 changed files with 26 additions and 14 deletions
|
|
@ -403,23 +403,38 @@ bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, const MouseWheelD
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool isUpDownKeyPress (const KeyPress& key)
|
||||
{
|
||||
return key == KeyPress::upKey
|
||||
|| key == KeyPress::downKey
|
||||
|| key == KeyPress::pageUpKey
|
||||
|| key == KeyPress::pageDownKey
|
||||
|| key == KeyPress::homeKey
|
||||
|| key == KeyPress::endKey;
|
||||
}
|
||||
|
||||
static bool isLeftRightKeyPress (const KeyPress& key)
|
||||
{
|
||||
return key == KeyPress::leftKey
|
||||
|| key == KeyPress::rightKey;
|
||||
}
|
||||
|
||||
bool Viewport::keyPressed (const KeyPress& key)
|
||||
{
|
||||
const bool isUpDownKey = key == KeyPress::upKey
|
||||
|| key == KeyPress::downKey
|
||||
|| key == KeyPress::pageUpKey
|
||||
|| key == KeyPress::pageDownKey
|
||||
|| key == KeyPress::homeKey
|
||||
|| key == KeyPress::endKey;
|
||||
const bool isUpDownKey = isUpDownKeyPress (key);
|
||||
|
||||
if (verticalScrollBar.isVisible() && isUpDownKey)
|
||||
return verticalScrollBar.keyPressed (key);
|
||||
|
||||
const bool isLeftRightKey = key == KeyPress::leftKey
|
||||
|| key == KeyPress::rightKey;
|
||||
const bool isLeftRightKey = isLeftRightKeyPress (key);
|
||||
|
||||
if (horizontalScrollBar.isVisible() && (isUpDownKey || isLeftRightKey))
|
||||
return horizontalScrollBar.keyPressed (key);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Viewport::respondsToKey (const KeyPress& key)
|
||||
{
|
||||
return isUpDownKeyPress (key) || isLeftRightKeyPress (key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,6 +246,8 @@ public:
|
|||
void componentMovedOrResized (Component&, bool wasMoved, bool wasResized) override;
|
||||
/** @internal */
|
||||
bool useMouseWheelMoveIfNeeded (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
static bool respondsToKey (const KeyPress&);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -304,12 +304,7 @@ public:
|
|||
|
||||
bool keyPressed (const KeyPress& key) override
|
||||
{
|
||||
if (key.isKeyCode (KeyPress::upKey)
|
||||
|| key.isKeyCode (KeyPress::downKey)
|
||||
|| key.isKeyCode (KeyPress::pageUpKey)
|
||||
|| key.isKeyCode (KeyPress::pageDownKey)
|
||||
|| key.isKeyCode (KeyPress::homeKey)
|
||||
|| key.isKeyCode (KeyPress::endKey))
|
||||
if (Viewport::respondsToKey (key))
|
||||
{
|
||||
const int allowableMods = owner.multipleSelection ? ModifierKeys::shiftModifier : 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue