diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llui/llcombobox.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llcombobox.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp index 3aec2ee..28a05c1 100644 --- a/linden/indra/llui/llcombobox.cpp +++ b/linden/indra/llui/llcombobox.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -72,11 +73,12 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: | |||
72 | mTextEntryTentative(TRUE), | 73 | mTextEntryTentative(TRUE), |
73 | mListPosition(BELOW), | 74 | mListPosition(BELOW), |
74 | mPrearrangeCallback( NULL ), | 75 | mPrearrangeCallback( NULL ), |
75 | mTextEntryCallback( NULL ) | 76 | mTextEntryCallback( NULL ), |
77 | mLabel(label) | ||
76 | { | 78 | { |
77 | // Always use text box | 79 | // Always use text box |
78 | // Text label button | 80 | // Text label button |
79 | mButton = new LLButton(label, | 81 | mButton = new LLButton(mLabel, |
80 | LLRect(), | 82 | LLRect(), |
81 | LLStringUtil::null, | 83 | LLStringUtil::null, |
82 | NULL, this); | 84 | NULL, this); |
@@ -87,7 +89,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: | |||
87 | mButton->setScaleImage(TRUE); | 89 | mButton->setScaleImage(TRUE); |
88 | 90 | ||
89 | mButton->setMouseDownCallback(onButtonDown); | 91 | mButton->setMouseDownCallback(onButtonDown); |
90 | mButton->setFont(LLFontGL::sSansSerifSmall); | 92 | mButton->setFont(LLFontGL::getFontSansSerifSmall()); |
91 | mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); | 93 | mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); |
92 | mButton->setHAlign( LLFontGL::LEFT ); | 94 | mButton->setHAlign( LLFontGL::LEFT ); |
93 | mButton->setRightHPad(2); | 95 | mButton->setRightHPad(2); |
@@ -197,7 +199,12 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * | |||
197 | } | 199 | } |
198 | } | 200 | } |
199 | 201 | ||
200 | combo_box->selectFirstItem(); | 202 | // if providing user text entry or descriptive label |
203 | // don't select an item under the hood | ||
204 | if (!combo_box->acceptsTextInput() && combo_box->mLabel.empty()) | ||
205 | { | ||
206 | combo_box->selectFirstItem(); | ||
207 | } | ||
201 | 208 | ||
202 | return combo_box; | 209 | return combo_box; |
203 | } | 210 | } |
@@ -259,7 +266,10 @@ LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOO | |||
259 | { | 266 | { |
260 | LLScrollListItem* item = mList->addSimpleElement(name, pos); | 267 | LLScrollListItem* item = mList->addSimpleElement(name, pos); |
261 | item->setEnabled(enabled); | 268 | item->setEnabled(enabled); |
262 | mList->selectFirstItem(); | 269 | if (!mAllowTextEntry && mLabel.empty()) |
270 | { | ||
271 | selectFirstItem(); | ||
272 | } | ||
263 | return item; | 273 | return item; |
264 | } | 274 | } |
265 | 275 | ||
@@ -268,7 +278,10 @@ LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAd | |||
268 | { | 278 | { |
269 | LLScrollListItem* item = mList->addSimpleElement(name, pos, id); | 279 | LLScrollListItem* item = mList->addSimpleElement(name, pos, id); |
270 | item->setEnabled(enabled); | 280 | item->setEnabled(enabled); |
271 | mList->selectFirstItem(); | 281 | if (!mAllowTextEntry && mLabel.empty()) |
282 | { | ||
283 | selectFirstItem(); | ||
284 | } | ||
272 | return item; | 285 | return item; |
273 | } | 286 | } |
274 | 287 | ||
@@ -278,7 +291,10 @@ LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddP | |||
278 | LLScrollListItem* item = mList->addSimpleElement(name, pos); | 291 | LLScrollListItem* item = mList->addSimpleElement(name, pos); |
279 | item->setEnabled(enabled); | 292 | item->setEnabled(enabled); |
280 | item->setUserdata( userdata ); | 293 | item->setUserdata( userdata ); |
281 | mList->selectFirstItem(); | 294 | if (!mAllowTextEntry && mLabel.empty()) |
295 | { | ||
296 | selectFirstItem(); | ||
297 | } | ||
282 | return item; | 298 | return item; |
283 | } | 299 | } |
284 | 300 | ||
@@ -287,7 +303,10 @@ LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosit | |||
287 | { | 303 | { |
288 | LLScrollListItem* item = mList->addSimpleElement(name, pos, value); | 304 | LLScrollListItem* item = mList->addSimpleElement(name, pos, value); |
289 | item->setEnabled(enabled); | 305 | item->setEnabled(enabled); |
290 | mList->selectFirstItem(); | 306 | if (!mAllowTextEntry && mLabel.empty()) |
307 | { | ||
308 | selectFirstItem(); | ||
309 | } | ||
291 | return item; | 310 | return item; |
292 | } | 311 | } |
293 | 312 | ||
@@ -498,7 +517,7 @@ void LLComboBox::updateLayout() | |||
498 | mTextEntry = new LLLineEditor(std::string("combo_text_entry"), | 517 | mTextEntry = new LLLineEditor(std::string("combo_text_entry"), |
499 | text_entry_rect, | 518 | text_entry_rect, |
500 | LLStringUtil::null, | 519 | LLStringUtil::null, |
501 | LLFontGL::sSansSerifSmall, | 520 | LLFontGL::getFontSansSerifSmall(), |
502 | mMaxChars, | 521 | mMaxChars, |
503 | onTextCommit, | 522 | onTextCommit, |
504 | onTextEntry, | 523 | onTextEntry, |