void LLPanelLogin::updateGridCombo() { const std::string &defaultGrid = gHippoGridManager->getDefaultGridNick(); const std::string ¤tGrid = gHippoGridManager->getCurrentGridNick(); LLComboBox *grids = getChild<LLComboBox>("grids_combo"); S32 selectIndex = -1, i = 0; grids->removeall(); if (defaultGrid != "") { grids->add(defaultGrid); selectIndex = i++; } HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); for (it = gHippoGridManager->beginGrid(); it != end; ++it) { const std::string &grid = it->second->getGridName(); if (grid != defaultGrid) { grids->add(grid); if (grid == currentGrid) selectIndex = i; i++; } } if (selectIndex >= 0) { grids->setCurrentByIndex(selectIndex); } else { grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label } }
// static void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata) { // Note: item is the LLScrollListCtrl LLComboBox *self = (LLComboBox *) userdata; const std::string name = self->mList->getSelectedItemLabel(); S32 cur_id = self->getCurrentIndex(); if (cur_id != -1) { self->setLabel(name); if (self->mAllowTextEntry) { gFocusMgr.setKeyboardFocus(self->mTextEntry); self->mTextEntry->selectAll(); } } // hiding the list reasserts the old value stored in the text editor/dropdown button self->hideList(); // commit does the reverse, asserting the value in the list self->onCommit(); }
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); 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 || it->second == curGrid) continue; grids->add(grid); } if(curGrid || defGrid) { if(defGrid) grids->add(defGrid->getGridName(),ADD_TOP); if(curGrid && defGrid != curGrid) grids->add(curGrid->getGridName(),ADD_TOP); grids->setCurrentByIndex(0); } else { grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label } }
// called from setFocus() // called internally too void HippoPanelGridsImpl::refresh() { const std::string &defaultGrid = gHippoGridManager->getDefaultGridName(); LLComboBox *grids = getChild<LLComboBox>("grid_selector"); S32 selectIndex = -1, i = 0; grids->removeall(); if (defaultGrid != "") { grids->add(defaultGrid); selectIndex = i++; } HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); for (it = gHippoGridManager->beginGrid(); it != end; ++it) { const std::string &grid = it->second->getGridName(); if (grid != defaultGrid) { grids->add(grid); if (grid == mCurGrid) selectIndex = i; i++; } } if ((mState == ADD_NEW) || (mState == ADD_COPY)) { grids->add("<new>"); selectIndex = i++; } if (selectIndex >= 0) { grids->setCurrentByIndex(selectIndex); } else { grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label } childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); childSetEnabled("btn_delete", (selectIndex >= 0)); childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0)); childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0)); childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY)); if (childGetValue("platform").asString() == "SecondLife") { // disable platform selector, if logged into the grid edited and it is SL // so object export restrictions cannot be circumvented by changing the platform bool enablePlatform = (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) || (mCurGrid != gHippoGridManager->getConnectedGrid()->getGridName()); childSetEnabled("platform", enablePlatform); childSetEnabled("search", false); childSetText("search", LLStringExplicit("")); childSetEnabled("render_compat", false); childSetValue("render_compat", false); } else { childSetEnabled("platform", true); childSetEnabled("search", true); childSetText("search", gHippoGridManager->getConnectedGrid()->getSearchUrl()); childSetEnabled("render_compat", true); } }
// called from setFocus() // called internally too void HippoPanelGridsImpl::refresh() { const std::string &defaultGrid = gHippoGridManager->getDefaultGridName(); LLComboBox *grids = getChild<LLComboBox>("grid_selector"); S32 selectIndex = -1, i = 0; grids->removeall(); if (defaultGrid != "") { grids->add(defaultGrid); selectIndex = i++; } HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); for (it = gHippoGridManager->beginGrid(); it != end; ++it) { const std::string &grid = it->second->getGridName(); if (grid != defaultGrid) { grids->add(grid); if (grid == mCurGrid) selectIndex = i; i++; } } if ((mState == ADD_NEW) || (mState == ADD_COPY)) { grids->add("<new>"); selectIndex = i++; } if (selectIndex >= 0) { grids->setCurrentByIndex(selectIndex); } else { grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label } childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable ); childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0)); childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0)); childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY)); }