forked from OSchip/llvm-project
[LLDB][GUI] Handle extra navigation keys in forms
This patch handles the up and down keys if they weren't handled by the selected field. Moreover, it makes sure the form always absorb the key to take full control until the form is canceled or submitted. Differential Revision: https://reviews.llvm.org/D108414
This commit is contained in:
parent
cb661df58f
commit
292f013395
|
@ -2801,6 +2801,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always return eKeyHandled to absorb all events since forms are always
|
||||||
|
// added as pop-ups that should take full control until canceled or submitted.
|
||||||
HandleCharResult WindowDelegateHandleChar(Window &window, int key) override {
|
HandleCharResult WindowDelegateHandleChar(Window &window, int key) override {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case '\r':
|
case '\r':
|
||||||
|
@ -2815,9 +2817,11 @@ public:
|
||||||
ExecuteAction(window, 0);
|
ExecuteAction(window, 0);
|
||||||
return eKeyHandled;
|
return eKeyHandled;
|
||||||
case '\t':
|
case '\t':
|
||||||
return SelectNext(key);
|
SelectNext(key);
|
||||||
|
return eKeyHandled;
|
||||||
case KEY_SHIFT_TAB:
|
case KEY_SHIFT_TAB:
|
||||||
return SelectPrevious(key);
|
SelectPrevious(key);
|
||||||
|
return eKeyHandled;
|
||||||
case KEY_ESCAPE:
|
case KEY_ESCAPE:
|
||||||
window.GetParent()->RemoveSubWindow(&window);
|
window.GetParent()->RemoveSubWindow(&window);
|
||||||
return eKeyHandled;
|
return eKeyHandled;
|
||||||
|
@ -2829,10 +2833,24 @@ public:
|
||||||
// to that field.
|
// to that field.
|
||||||
if (m_selection_type == SelectionType::Field) {
|
if (m_selection_type == SelectionType::Field) {
|
||||||
FieldDelegate *field = m_delegate_sp->GetField(m_selection_index);
|
FieldDelegate *field = m_delegate_sp->GetField(m_selection_index);
|
||||||
return field->FieldDelegateHandleChar(key);
|
if (field->FieldDelegateHandleChar(key) == eKeyHandled)
|
||||||
|
return eKeyHandled;
|
||||||
}
|
}
|
||||||
|
|
||||||
return eKeyNotHandled;
|
// If the key wasn't handled by the possibly selected field, handle some
|
||||||
|
// extra keys for navigation.
|
||||||
|
switch (key) {
|
||||||
|
case KEY_DOWN:
|
||||||
|
SelectNext(key);
|
||||||
|
return eKeyHandled;
|
||||||
|
case KEY_UP:
|
||||||
|
SelectPrevious(key);
|
||||||
|
return eKeyHandled;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eKeyHandled;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue