summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llradiogroup.cpp53
-rw-r--r--indra/llui/llradiogroup.h4
2 files changed, 42 insertions, 15 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()
{
}
diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h
index 8bd5698538..dcb2f43bfe 100644
--- a/indra/llui/llradiogroup.h
+++ b/indra/llui/llradiogroup.h
@@ -66,8 +66,6 @@ public:
virtual BOOL postBuild();
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
-
virtual BOOL handleKeyHere(KEY key, MASK mask);
void setIndexEnabled(S32 index, BOOL enabled);
@@ -75,6 +73,8 @@ public:
S32 getSelectedIndex() const { return mSelectedIndex; }
// set the index value programatically
BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE);
+ // foxus child by index if it can get focus
+ void focusSelectedRadioBtn();
// Accept and retrieve strings of the radio group control names
virtual void setValue(const LLSD& value );