summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-03-08 16:09:18 -0800
committerMerov Linden <merov@lindenlab.com>2011-03-08 16:09:18 -0800
commit75cc20848e5d0a95fee0b8cc54e0dbaa2dffe3ae (patch)
tree01d2c7afa7526394a0db169bafeab987a3dafecc /indra/llui
parent0bc84cea2e81292af45645ad3e3a87d7606aacb1 (diff)
parent1c3b95f5cc2c5e5bcf1f8b34a63ba8aa9d23ad81 (diff)
STORM-1015 : pull into viewer-development
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp29
-rw-r--r--indra/llui/llcombobox.h3
2 files changed, 26 insertions, 6 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 8b6a73af56..6f9893b07a 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -316,7 +316,7 @@ void LLComboBox::setValue(const LLSD& value)
LLScrollListItem* item = mList->getFirstSelected();
if (item)
{
- setLabel(getSelectedItemLabel());
+ updateLabel();
}
mLastSelectedIndex = mList->getFirstSelectedIndex();
}
@@ -384,6 +384,23 @@ void LLComboBox::setLabel(const LLStringExplicit& name)
}
}
+void LLComboBox::updateLabel()
+{
+ // Update the combo editor with the selected
+ // item label.
+ if (mTextEntry)
+ {
+ mTextEntry->setText(getSelectedItemLabel());
+ mTextEntry->setTentative(FALSE);
+ }
+
+ // If combo box doesn't allow text entry update
+ // the combo button label.
+ if (!mAllowTextEntry)
+ {
+ mButton->setLabel(getSelectedItemLabel());
+ }
+}
BOOL LLComboBox::remove(const std::string& name)
{
@@ -701,13 +718,13 @@ void LLComboBox::onItemSelected(const LLSD& data)
mLastSelectedIndex = getCurrentIndex();
if (mLastSelectedIndex != -1)
{
- setLabel(getSelectedItemLabel());
+ updateLabel();
if (mAllowTextEntry)
- {
- gFocusMgr.setKeyboardFocus(mTextEntry);
- mTextEntry->selectAll();
- }
+ {
+ gFocusMgr.setKeyboardFocus(mTextEntry);
+ mTextEntry->selectAll();
+ }
}
// hiding the list reasserts the old value stored in the text editor/dropdown button
hideList();
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 74d64269bd..e9ef9d07e4 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -148,6 +148,9 @@ public:
// This is probably a UI abuse.
void setLabel(const LLStringExplicit& name);
+ // Updates the combobox label to match the selected list item.
+ void updateLabel();
+
BOOL remove(const std::string& name); // remove item "name", return TRUE if found and removed
BOOL setCurrentByIndex( S32 index );