int GUIListBox::NotifyVarChange(const std::string& varName, const std::string& value) { GUIScrollList::NotifyVarChange(varName, value); if(!isConditionTrue()) return 0; // Check to see if the variable that we are using to store the list selected value has been updated if (varName == mVariable) { int i, listSize = mList.size(); currentValue = value; for (i = 0; i < listSize; i++) { if (mList.at(i).variableValue == currentValue) { mList.at(i).selected = 1; SetVisibleListLocation(i); } else mList.at(i).selected = 0; } mUpdate = 1; return 0; } return 0; }
int GUIConsole::Update(void) { if (mSlideout && mSlideoutState != visible) { if (mSlideoutState == hidden) return 0; if (mSlideoutState == request_hide) mSlideoutState = hidden; if (mSlideoutState == request_show) mSlideoutState = visible; // Any time we activate the console, we reset the position SetVisibleListLocation(rConsole.size() - 1); mUpdate = 1; scrollToEnd = true; } if (AddLines()) { // someone added new text // at least the scrollbar must be updated, even if the new lines are currently not visible mUpdate = 1; } if (scrollToEnd) { // keep the last line in view SetVisibleListLocation(rConsole.size() - 1); } GUIScrollList::Update(); if (mUpdate) { mUpdate = 0; if (Render() == 0) return 2; } return 0; }