diff --git a/src/xrUICore/TabControl/UITabControl.cpp b/src/xrUICore/TabControl/UITabControl.cpp index c0cb93fe4e0..7ce2634afc3 100644 --- a/src/xrUICore/TabControl/UITabControl.cpp +++ b/src/xrUICore/TabControl/UITabControl.cpp @@ -227,15 +227,8 @@ bool CUITabControl::OnKeyboardAction(int dik, EUIMessages keyboard_action) { switch (GetBindedAction(dik, EKeyContext::UI)) { - case kUI_TAB_PREV: - if (WINDOW_KEY_PRESSED == keyboard_action) - SetNextActiveTab(false, true); - return true; - - case kUI_TAB_NEXT: - if (WINDOW_KEY_PRESSED == keyboard_action) - SetNextActiveTab(true, true); - return true; + case kUI_TAB_PREV: return SetNextActiveTab(false, true); + case kUI_TAB_NEXT: return SetNextActiveTab(true, true); } } if (GetButtonsAcceleratorsMode()) @@ -253,6 +246,25 @@ bool CUITabControl::OnKeyboardAction(int dik, EUIMessages keyboard_action) return false; } +bool CUITabControl::OnControllerAction(int axis, float x, float y, EUIMessages controller_action) +{ + if (WINDOW_KEY_PRESSED == controller_action) + { + if (GetButtonsAcceleratorsMode()) + { + for (const auto& button : m_TabsArr) + { + if (button->IsAccelerator(axis)) + { + SetActiveTab(button->m_btn_id); + return true; + } + } + } + } + return false; +} + CUITabButton* CUITabControl::GetButtonById(const shared_str& id) { TABS_VECTOR::const_iterator it = std::find(m_TabsArr.begin(), m_TabsArr.end(), id); diff --git a/src/xrUICore/TabControl/UITabControl.h b/src/xrUICore/TabControl/UITabControl.h index f82bfa453a2..58ecd156822 100644 --- a/src/xrUICore/TabControl/UITabControl.h +++ b/src/xrUICore/TabControl/UITabControl.h @@ -22,6 +22,7 @@ class XRUICORE_API CUITabControl : public CUIWindow, public CUIOptionsItem virtual bool IsChangedOptValue() const; // backup!=current virtual bool OnKeyboardAction(int dik, EUIMessages keyboard_action); + bool OnControllerAction(int axis, float x, float y, EUIMessages controller_action) override; virtual void OnTabChange(const shared_str& sCur, const shared_str& sPrev); virtual void OnStaticFocusReceive(CUIWindow* pWnd); virtual void OnStaticFocusLost(CUIWindow* pWnd);