mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Make Tab work if selected widget is marked as not needing keyfocus
This commit is contained in:
parent
ad8d0c5302
commit
c035548f37
1 changed files with 9 additions and 17 deletions
|
@ -63,12 +63,6 @@ void KeyboardNavigation::_unlinkWidget(MyGUI::Widget *widget)
|
||||||
w.second = nullptr;
|
w.second = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isButtonFocus()
|
|
||||||
{
|
|
||||||
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
|
||||||
return focus->getTypeName().find("Button") != std::string::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Direction
|
enum Direction
|
||||||
{
|
{
|
||||||
D_Left,
|
D_Left,
|
||||||
|
@ -106,7 +100,13 @@ bool KeyboardNavigation::switchFocus(int direction, bool wrap)
|
||||||
{
|
{
|
||||||
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
|
||||||
if (!focus && (direction == D_Next || direction == D_Prev))
|
if ((focus && focus->getTypeName().find("Button") == std::string::npos) && direction != D_Prev && direction != D_Next)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (focus && (direction == D_Prev || direction == D_Next) && focus->getUserString("AcceptTab") == "true")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ((!focus || !focus->getNeedKeyFocus()) && (direction == D_Next || direction == D_Prev))
|
||||||
{
|
{
|
||||||
// if nothing is selected, select the first widget
|
// if nothing is selected, select the first widget
|
||||||
MyGUI::VectorWidgetPtr keyFocusList;
|
MyGUI::VectorWidgetPtr keyFocusList;
|
||||||
|
@ -120,20 +120,12 @@ bool KeyboardNavigation::switchFocus(int direction, bool wrap)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!focus)
|
if (!focus)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!isButtonFocus() && direction != D_Prev && direction != D_Next)
|
MyGUI::Widget* window = focus;
|
||||||
return false;
|
while (window && window->getParent())
|
||||||
|
|
||||||
if ((direction == D_Prev || direction == D_Next) && focus->getUserString("AcceptTab") == "true")
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MyGUI::Widget* window = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
|
||||||
while (window->getParent())
|
|
||||||
window = window->getParent();
|
window = window->getParent();
|
||||||
|
|
||||||
MyGUI::VectorWidgetPtr keyFocusList;
|
MyGUI::VectorWidgetPtr keyFocusList;
|
||||||
getKeyFocusWidgets(window, keyFocusList);
|
getKeyFocusWidgets(window, keyFocusList);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue