summaryrefslogtreecommitdiff
path: root/indra/llui/llradiogroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llradiogroup.cpp')
-rw-r--r--indra/llui/llradiogroup.cpp53
1 files changed, 40 insertions, 13 deletions
diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp
index 8cf72928ff..2c7e7ab13d 100644
--- a/indra/llui/llradiogroup.cpp
+++ b/indra/llui/llradiogroup.cpp
@@ -54,6 +54,7 @@ public:
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ BOOL postBuild();
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
LLSD getPayload() { return mPayload; }
@@ -224,6 +225,22 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
return TRUE;
}
+void LLRadioGroup::focusSelectedRadioBtn()
+{
+ if (mSelectedIndex >= 0)
+ {
+ LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex];
+ if (radio_item->hasTabStop() && radio_item->getEnabled())
+ {
+ radio_item->focusFirstItem(FALSE, FALSE);
+ }
+ }
+ else if (mRadioButtons[0]->hasTabStop() || hasTabStop())
+ {
+ focusFirstItem(FALSE, FALSE);
+ }
+}
+
BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask)
{
BOOL handled = FALSE;
@@ -283,19 +300,6 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask)
return handled;
}
-BOOL LLRadioGroup::handleMouseDown(S32 x, S32 y, MASK mask)
-{
- // grab focus preemptively, before child button takes mousecapture
- //
- if (hasTabStop())
- {
- focusFirstItem(FALSE, FALSE);
- }
-
- return LLUICtrl::handleMouseDown(x, y, mask);
-}
-
-
// Handle one button being clicked. All child buttons must have this
// function as their callback function.
@@ -466,6 +470,29 @@ BOOL LLRadioCtrl::postBuild()
return TRUE;
}
+BOOL LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
+{
+ // Grab focus preemptively, before button takes mousecapture
+ if (hasTabStop() && getEnabled())
+ {
+ focusFirstItem(FALSE, FALSE);
+ }
+ else
+ {
+ // Only currently selected item in group has tab stop as result it is
+ // unclear how focus should behave on click, just let the group handle
+ // focus and LLRadioGroup::onClickButton() will set correct state later
+ // if needed
+ LLRadioGroup* parent = (LLRadioGroup*)getParent();
+ if (parent)
+ {
+ parent->focusSelectedRadioBtn();
+ }
+ }
+
+ return LLCheckBoxCtrl::handleMouseDown(x, y, mask);
+}
+
LLRadioCtrl::~LLRadioCtrl()
{
}