diff options
author | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-03-05 15:41:25 +0200 |
---|---|---|
committer | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-03-05 15:41:25 +0200 |
commit | a8e1c2ed134b88b55b713ac53cd63cab4bb526b3 (patch) | |
tree | 7949ef63bb34cf8c09e116269efa73d5d65bbd1a /indra/llui/llcombobox.cpp | |
parent | baafdf216f482535d675eebcf4220510451d7332 (diff) |
Implemented (EXT-4705) Show maturity icon on Region/Estate tab.
- Added LLIconsComboBox class - a combobox with icons for maturity ratings.
- Fixed scroll list maximum width calculation. The width was calculated based on text value width for non-text columns.
- Added image overlay alignment getter method to LLButton.
--HG--
branch : product-engine
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r-- | indra/llui/llcombobox.cpp | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 9d23daf56d..98c9217306 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -703,19 +703,12 @@ void LLComboBox::onListMouseUp() void LLComboBox::onItemSelected(const LLSD& data) { - const std::string name = mList->getSelectedItemLabel(); + setValue(data); - S32 cur_id = getCurrentIndex(); - mLastSelectedIndex = cur_id; - if (cur_id != -1) + if (mAllowTextEntry && mLastSelectedIndex != -1) { - setLabel(name); - - 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 @@ -1069,3 +1062,33 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last ) { return mList->selectItemRange(first, last); } + + +static LLDefaultChildRegistry::Register<LLIconsComboBox> register_icons_combo_box("icons_combo_box"); + +LLIconsComboBox::Params::Params() +: icon_column("icon_column", ICON_COLUMN), + label_column("label_column", LABEL_COLUMN) +{} + +LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p) +: LLComboBox(p), + mIconColumnIndex(p.icon_column), + mLabelColumnIndex(p.label_column) +{} + +void LLIconsComboBox::setValue(const LLSD& value) +{ + BOOL found = mList->selectByValue(value); + if (found) + { + LLScrollListItem* item = mList->getFirstSelected(); + if (item) + { + mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); + + setLabel(mList->getSelectedItemLabel(mLabelColumnIndex)); + } + mLastSelectedIndex = mList->getFirstSelectedIndex(); + } +} |