本文整理汇总了C++中LLComboBox::getItemCount方法的典型用法代码示例。如果您正苦于以下问题:C++ LLComboBox::getItemCount方法的具体用法?C++ LLComboBox::getItemCount怎么用?C++ LLComboBox::getItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLComboBox
的用法示例。
在下文中一共展示了LLComboBox::getItemCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCustomResControls
// virtual
void LLPanelSnapshot::updateCustomResControls()
{
// Only show width/height spinners and the aspect ratio checkbox
// when a custom resolution is chosen.
LLComboBox* combo = getChild<LLComboBox>(getImageSizeComboName());
const bool show = combo->getFirstSelectedIndex() == (combo->getItemCount() - 1);
getChild<LLUICtrl>(getImageSizePanelName())->setVisible(show);
}
示例2: setLoginMRUEnabled
// static
void LLPanelLogin::setLoginMRUEnabled(bool enabled)
{
if (!sInstance)
{
return;
}
LLComboBox* combo = sInstance->getChild<LLComboBox>("name_combo");
if (!enabled) combo->removeall();
combo->setButtonVisible(enabled);
combo->setEnabled(enabled && combo->getItemCount() != 0);
}
示例3: addFavoritesToStartLocation
void LLPanelLogin::addFavoritesToStartLocation()
{
// <FS:Ansariel> Clear password field while typing (FIRE-6266)
getChild<LLLineEditor>("password_edit")->clear();
// </FS:Ansariel> Clear password field while typing (FIRE-6266)
// Clear the combo.
LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
if (!combo) return;
int num_items = combo->getItemCount();
for (int i = num_items - 1; i > 2; i--)
{
combo->remove(i);
}
// Load favorites into the combo.
std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
std::string canonical_user_name = canonicalize_username(user_defined_name);
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
file.open(filename);
if (!file.is_open()) return;
LLSDSerialize::fromXML(fav_llsd, file);
for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
iter != fav_llsd.endMap(); ++iter)
{
// The account name in stored_favorites.xml has Resident last name even if user has
// a single word account name, so it can be compared case-insensitive with the
// user defined "firstname lastname".
S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first);
if (res != 0)
{
lldebugs << "Skipping favorites for " << iter->first << llendl;
continue;
}
combo->addSeparator();
lldebugs << "Loading favorites for " << iter->first << llendl;
LLSD user_llsd = iter->second;
for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
iter1 != user_llsd.endArray(); ++iter1)
{
std::string label = (*iter1)["name"].asString();
std::string value = (*iter1)["slurl"].asString();
if(label != "" && value != "")
{
combo->add(label, value);
}
}
break;
}
}
示例4: onSelectGrid
// static
void HippoPanelGridsImpl::onSelectGrid(LLUICtrl* ctrl, void *data)
{
HippoPanelGridsImpl *self = (HippoPanelGridsImpl*)data;
std::string newGrid = ctrl->getValue().asString();
if (!self->saveCurGrid()) {
// creating new grid failed
LLComboBox *grids = self->getChild<LLComboBox>("grid_selector");
grids->setCurrentByIndex(grids->getItemCount() - 1);
return;
}
self->mCurGrid = newGrid;
self->loadCurGrid();
}
示例5: updateGridCombo
void LLPanelLogin::updateGridCombo()
{
const std::string &defaultGrid = gHippoGridManager->getDefaultGridName();
LLComboBox *grids = getChild<LLComboBox>("grids_combo");
std::string top_entry;
grids->removeall();
const HippoGridInfo *curGrid = gHippoGridManager->getCurrentGrid();
const HippoGridInfo *defGrid = gHippoGridManager->getGrid(defaultGrid);
S32 idx(-1);
HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid();
for (it = gHippoGridManager->beginGrid(); it != end; ++it)
{
std::string grid = it->second->getGridName();
if (grid.empty() || it->second == defGrid)
continue;
if (it->second == curGrid) idx = grids->getItemCount();
grids->add(grid);
}
if (curGrid || defGrid)
{
if (defGrid)
{
grids->add(defGrid->getGridName(),ADD_TOP);
++idx;
}
grids->setCurrentByIndex(idx);
}
else
{
grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label
}
}
示例6: onTextEntry
//static
void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
{
LLComboBox* self = (LLComboBox*)user_data;
if (self->mTextEntryCallback)
{
(*self->mTextEntryCallback)(line_editor, self->mCallbackUserData);
}
KEY key = gKeyboard->currentKey();
if (key == KEY_BACKSPACE ||
key == KEY_DELETE)
{
if (self->mList->selectItemByLabel(line_editor->getText(), FALSE))
{
line_editor->setTentative(FALSE);
}
else
{
if (!self->mSuppressTentative) line_editor->setTentative(self->mTextEntryTentative);
self->mList->deselectAllItems();
}
return;
}
if (key == KEY_LEFT ||
key == KEY_RIGHT)
{
return;
}
if (key == KEY_DOWN)
{
self->setCurrentByIndex(llmin(self->getItemCount() - 1, self->getCurrentIndex() + 1));
if (!self->mList->getVisible())
{
if( self->mPrearrangeCallback )
{
self->mPrearrangeCallback( self, self->mCallbackUserData );
}
if (self->mList->getItemCount() != 0)
{
self->showList();
}
}
line_editor->selectAll();
line_editor->setTentative(FALSE);
}
else if (key == KEY_UP)
{
self->setCurrentByIndex(llmax(0, self->getCurrentIndex() - 1));
if (!self->mList->getVisible())
{
if( self->mPrearrangeCallback )
{
self->mPrearrangeCallback( self, self->mCallbackUserData );
}
if (self->mList->getItemCount() != 0)
{
self->showList();
}
}
line_editor->selectAll();
line_editor->setTentative(FALSE);
}
else
{
// RN: presumably text entry
self->updateSelection();
}
}
示例7: addFavoritesToStartLocation
void FSPanelLogin::addFavoritesToStartLocation()
{
mShowFavorites = false;
// Clear the combo.
LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
if (!combo) return;
int num_items = combo->getItemCount();
for (int i = num_items - 1; i > 2; i--)
{
combo->remove(i);
}
// Load favorites into the combo.
std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
std::string canonical_user_name = canonicalize_username(user_defined_name);
U32 resident_pos = canonical_user_name.find("Resident");
if (resident_pos > 0)
{
canonical_user_name = canonical_user_name.substr(0, resident_pos - 1);
}
std::string current_grid = getChild<LLComboBox>("server_combo")->getSimple();
std::string current_user = canonical_user_name + " @ " + current_grid;
LL_DEBUGS("Favorites") << "Current user: \"" << current_user << "\"" << LL_ENDL;
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
file.open(filename.c_str());
if (!file.is_open())
{
return;
}
LLSDSerialize::fromXML(fav_llsd, file);
for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
iter != fav_llsd.endMap(); ++iter)
{
// The account name in stored_favorites.xml has Resident last name even if user has
// a single word account name, so it can be compared case-insensitive with the
// user defined "firstname lastname".
S32 res = LLStringUtil::compareInsensitive(current_user, iter->first);
if (res != 0)
{
LL_DEBUGS() << "Skipping favorites for " << iter->first << LL_ENDL;
continue;
}
combo->addSeparator();
LL_DEBUGS() << "Loading favorites for " << iter->first << LL_ENDL;
LLSD user_llsd = iter->second;
for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
iter1 != user_llsd.endArray(); ++iter1)
{
std::string label = (*iter1)["name"].asString();
std::string value = (*iter1)["slurl"].asString();
if(label != "" && value != "")
{
mShowFavorites = true;
combo->add(label, value);
}
}
break;
}
LLFloaterPreference::updateShowFavoritesCheckbox(mShowFavorites);
}