void LLComboBox::prearrangeList(std::string filter) { if (mPrearrangeCallback) { mPrearrangeCallback(this, LLSD(filter)); } }
void LLComboBox::updateSelection() { if(mSuppressAutoComplete) { return; } LLWString left_wstring = mTextEntry->getWText().substr(0, mTextEntry->getCursor()); // user-entered portion of string, based on assumption that any selected // text was a result of auto-completion LLWString user_wstring = mTextEntry->hasSelection() ? left_wstring : mTextEntry->getWText(); std::string full_string = mTextEntry->getText(); // go ahead and arrange drop down list on first typed character, even // though we aren't showing it... some code relies on prearrange // callback to populate content if( mTextEntry->getWText().size() == 1 ) { if (mPrearrangeCallback) { mPrearrangeCallback( this, mCallbackUserData ); } } if (mList->selectItemByLabel(full_string, FALSE)) { mTextEntry->setTentative(FALSE); } else if (!mList->selectItemByPrefix(left_wstring, FALSE)) { mList->deselectAllItems(); mTextEntry->setText(wstring_to_utf8str(user_wstring)); if (!mSuppressTentative) mTextEntry->setTentative(mTextEntryTentative); } else { LLWString selected_item = utf8str_to_wstring(mList->getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); mTextEntry->endSelection(); mTextEntry->setTentative(FALSE); } }