/// <summary>Populates the properties window</summary> /// <param name="grid">The grid.</param> void ScriptDocument::OnDisplayProperties(CMFCPropertyGridCtrl& grid) { // Group: General CMFCPropertyGridProperty* general = new CMFCPropertyGridProperty(_T("General")); // Name/Description/Version/CommandID/Signature: general->AddSubItem(new NameProperty(*this)); general->AddSubItem(new DescriptionProperty(*this)); general->AddSubItem(new VersionProperty(*this)); general->AddSubItem(new CommandIDProperty(*this)); general->AddSubItem(new GameVersionProperty(*this)); general->AddSubItem(new SignedProperty(false)); grid.AddProperty(general); // Group: Arguments CMFCPropertyGridProperty* arguments = new CMFCPropertyGridProperty(_T("Arguments")); // Arguments ArgumentProperties.clear(); for (ScriptVariable& v : Script.Variables.Arguments.SortByID) { ArgumentProperties.push_back(new ArgumentProperty(*this, v)); arguments->AddSubItem(ArgumentProperties.back()); } grid.AddProperty(arguments); }
void xEnvironmentPane::_Frush(CMFCPropertyGridCtrl & PropertyGrid, IPropertyObj * obj) { PropertyGrid.RemoveAll(); if (!obj) return ; int propSize = obj->GetPropertySize(); MultiMap<TString128, const Property *> mmap; for (int i = 0; i < propSize; ++i) { const Property * p = obj->GetProperty(i); mmap.Insert(p->group, p); } MultiMap<TString128, const Property *>::Iterator whr = mmap.Begin(); MultiMap<TString128, const Property *>::Iterator end = mmap.End(); while (whr != end) { CMFCPropertyGridProperty * gp = new CMFCPropertyGridProperty(whr->first.c_str()); List<const Property *>::Iterator w = whr->second.Begin(); List<const Property *>::Iterator e = whr->second.End(); while (w != e) { const Property * p = *w; _ToCtrl(gp, obj, p); ++w; } PropertyGrid.AddProperty(gp); ++whr; } }