/// <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; } }
/** @brief called when a property is changed. @autor BHK */ LRESULT CShowCableDlg::OnPropertyChanged(WPARAM wp, LPARAM lp) { if((wp == m_wndCablePropList.GetDlgCtrlID()) && m_pLoadItem) { CMFCPropEx* pProp = (CMFCPropEx*)(lp); // Name =BUS ID , Value = sds CMFCPropEx* pParent = (CMFCPropEx*)pProp->GetParent(); // Category CMFCPropertyGridCtrl* pPropList = (CMFCPropertyGridCtrl*)(pProp->GetPropertyGridCtrl()); CString rValue = pProp->GetValue(); if((NULL != pPropList) && (NULL != pParent)) { if(pProp->IsKindOf(RUNTIME_CLASS(CMFCCheckBoxProp))) { CMFCCheckBoxProp* pCheckBoxProp = (CMFCCheckBoxProp*)pProp; pCheckBoxProp->OnValueChanged(); } else { CRect rect = pProp->GetRect(); CPoint pt(int((rect.left + rect.right) * 0.5) , int(rect.bottom + rect.Height() * 0.5)); CMFCPropEx* pHitTestProp = (CMFCPropEx*)pPropList->HitTest(pt); if(pHitTestProp) { if(pHitTestProp->IsGroup()) { while(pHitTestProp->IsGroup()) { CRect rect = pHitTestProp->GetRect(); CPoint pt(int((rect.left + rect.right) * 0.5) , int(rect.bottom + rect.Height() * 0.5)); pHitTestProp = (CMFCPropEx*)pPropList->HitTest(pt); } } pPropList->SetCurSel(pHitTestProp); } } if(m_pCableItem) { m_pCableItem->prop()->SetValue( (NULL != pParent) ? pParent->GetName() : "" , pProp->GetName() , rValue.operator LPCSTR()); //! 변경된 property에 대해 등록된 COMMAND가 있는지 확인하고 COMMAND를 수행한다. const CString rCategory = pParent->GetName(); const CString rKey = pProp->GetName(); CELoadDocData& docData = CELoadDocData::GetInstance(); auto_ptr<CEventData> command(docData.CreateAutoCalculateCommandOf(CCableItem::TypeString() , rCategory.operator LPCSTR() , rKey.operator LPCSTR())); if(NULL != command.get()) { BeginWaitCursor(); command->m_SelectionSet.Add(m_pCableItem); command->Execute(); CEventData EventData(CCableItem::TypeString() , CEventData::SELECT_ITEM); EventData.Add(m_pCableItem); m_wndCablePropList.SendMessage(CEventData::SELECT_ITEM , 0 , (LPARAM)(&EventData)); //! 메세지를 통보한다. EndWaitCursor(); } } } } return 0; }