diff options
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r-- | indra/llui/llcombobox.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index ac56d15d1b..58aeb61728 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -55,6 +55,7 @@ #include "lllineeditor.h" #include "v2math.h" #include "lluictrlfactory.h" +#include "lltooltip.h" // Globals S32 LLCOMBOBOX_HEIGHT = 0; @@ -77,6 +78,7 @@ LLComboBox::ItemParams::ItemParams() LLComboBox::Params::Params() : allow_text_entry("allow_text_entry", false), + allow_new_values("allow_new_values", false), show_text_as_tentative("show_text_as_tentative", true), max_chars("max_chars", 20), list_position("list_position", BELOW), @@ -96,6 +98,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mTextEntryTentative(p.show_text_as_tentative), mHasAutocompletedText(false), mAllowTextEntry(p.allow_text_entry), + mAllowNewValues(p.allow_new_values), mMaxChars(p.max_chars), mPrearrangeCallback(p.prearrange_callback()), mTextEntryCallback(p.text_entry_callback()), @@ -620,7 +623,15 @@ void LLComboBox::hideList() if (mList->getVisible()) { // assert selection in list - mList->selectNthItem(mLastSelectedIndex); + if(mAllowNewValues) + { + // mLastSelectedIndex = -1 means that we entered a new value, don't select + // any of existing items in this case. + if(mLastSelectedIndex >= 0) + mList->selectNthItem(mLastSelectedIndex); + } + else + mList->selectNthItem(mLastSelectedIndex); mButton->setToggleState(FALSE); mList->setVisible(FALSE); @@ -704,7 +715,7 @@ void LLComboBox::onItemSelected(const LLSD& data) } } -BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) +BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect& sticky_rect_screen) { std::string tool_tip; @@ -713,25 +724,17 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_re return TRUE; } - if (LLUI::sShowXUINames) + tool_tip = getToolTip(); + if (tool_tip.empty()) { - tool_tip = getShowNamesToolTip(); - } - else - { - tool_tip = getToolTip(); - if (tool_tip.empty()) - { - tool_tip = getSelectedItemLabel(); - } + tool_tip = getSelectedItemLabel(); } if( !tool_tip.empty() ) { - msg = tool_tip; - - // Convert rect local to screen coordinates - *sticky_rect_screen = calcScreenRect(); + LLToolTipMgr::instance().show(LLToolTipParams() + .message(tool_tip) + .sticky_rect(calcScreenRect())); } return TRUE; } |