| 498 | } |
| 499 | |
| 500 | S32 GuiListBoxCtrl::findItemText( StringTableEntry text, bool caseSensitive ) |
| 501 | { |
| 502 | // Check Proper Arguments |
| 503 | if( !text || !text[0] || text == StringTable->lookup("") ) |
| 504 | { |
| 505 | Con::warnf("GuiListBoxCtrl::findItemText - No Text Specified!"); |
| 506 | return -1; |
| 507 | } |
| 508 | |
| 509 | // Check Items Exist. |
| 510 | if( mItems.empty() ) |
| 511 | return -1; |
| 512 | |
| 513 | // Lookup the index of an item in our list, by the pointer to the item |
| 514 | for( S32 i = 0; i < mItems.size(); i++ ) |
| 515 | { |
| 516 | // Case Sensitive Compare? |
| 517 | if( caseSensitive && ( String::compare( mItems[i]->itemText, text ) == 0 ) ) |
| 518 | return i; |
| 519 | else if (!caseSensitive && ( dStricmp( mItems[i]->itemText, text ) == 0 )) |
| 520 | return i; |
| 521 | } |
| 522 | |
| 523 | // Not Found! |
| 524 | return -1; |
| 525 | } |
| 526 | |
| 527 | DefineEngineMethod( GuiListBoxCtrl, setCurSel, void, (S32 indexId),, |
| 528 | "@brief Sets the currently selected item at the specified index.\n\n" |