void CAutoInfo::UpdateList() { CExchangePost* object = static_cast<CExchangePost*>(m_object); Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); if (pw == nullptr) return; Ui::CList* pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO)); if (pl == nullptr) return; pl->Flush(); const auto& infoList = object->GetInfoList(); if (infoList.empty()) { pl->ClearState(Ui::STATE_ENABLE); } else { pl->SetState(Ui::STATE_ENABLE); for (int i = 0; i < static_cast<int>(infoList.size()); i++) { char text[100]; sprintf(text, "%s = %.2f", infoList[i].name.c_str(), infoList[i].value); pl->SetItemName(i, text); } } object->SetInfoUpdate(false); }
void CAutoInfo::UpdateListVirus() { Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); if (pw == nullptr) return; Ui::CList* pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO)); if (pl == nullptr) return; pl->SetState(Ui::STATE_ENABLE); pl->Flush(); for (int i = 0; i < 4; ++i) { char text[100]; int max = static_cast< int >(2.0f+Math::Rand()*10.0f); for (int j = 0; j < max; ++j) { do { text[j] = ' '+static_cast<int>(Math::Rand()*94.0f); } while (text[j] == '\\'); } text[max] = 0; pl->SetItemName(i, text); } }
void CAutoInfo::UpdateList() { Ui::CWindow* pw; Ui::CList* pl; Info info; int total, i; char text[100]; pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw == nullptr ) return; pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO)); if ( pl == nullptr ) return; pl->Flush(); total = m_object->GetInfoTotal(); if ( total == 0 ) { pl->ClearState(Ui::STATE_ENABLE); } else { pl->SetState(Ui::STATE_ENABLE); for ( i=0 ; i<total ; i++ ) { info = m_object->GetInfo(i); sprintf(text, "%s = %.2f", info.name, info.value); pl->SetItemName(i, text); } } m_object->SetInfoUpdate(false); }