void CReflectiveUI::AddPropertyToGrid(CMFCPropertyGridProperty* root, RTTIObject* pObject, BaseProperty* pProp) { CMFCPropertyGridProperty* pGrid; TypedProperty<T>* pTypedProperty = (TypedProperty<T>*)pProp; EValueSpecify e = pProp->GetValueSpecify(); const std::vector<std::string>& Values = pProp->GetSpeValues(); if ( e == eValueRange ) { T s = TypeValueFromString<T>(Values[0]); T e = TypeValueFromString<T>(Values[1]); pGrid = new CMFCPropertyGridProperty( pTypedProperty->GetName().c_str() , (_variant_t)pTypedProperty->GetValue( pObject ) , pTypedProperty->GetDescription().c_str() ); pGrid->EnableSpinControl(TRUE, s, e); } else if ( e == eValueList ) { pGrid = new CMFCPropertyGridProperty( pTypedProperty->GetName().c_str() , (_variant_t)pTypedProperty->GetValue( pObject ) , pTypedProperty->GetDescription().c_str() ); for (size_t t = 0; t < Values.size(); ++t) { pGrid->AddOption(Values[t].c_str()); } pGrid->AllowEdit(FALSE); } else if ( e == eFilePathName ) { pGrid = new CMFCPropertyGridFileProperty( pTypedProperty->GetName().c_str() , (_variant_t)pTypedProperty->GetValue( pObject ) , pTypedProperty->GetDescription().c_str() ); } else if ( e == eValueColor ) { } else { pGrid = new CMFCPropertyGridProperty( pTypedProperty->GetName().c_str() , (_variant_t)pTypedProperty->GetValue( pObject ) , pTypedProperty->GetDescription().c_str() ); } root->AddSubItem( pGrid ); CReflectiveUI::SPropertyObject PO(pProp, pObject); _GridPropertyMap[pGrid] = PO; }
void CPropertiesWnd::InitPropList() { SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("外观")); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("三维外观"), (_variant_t) false, _T("指定窗口的字体不使用粗体,并且控件将使用三维边框"))); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("边框"), _T("对话框外框"), _T("其中之一: “无”、“细”、“可调整大小”或“对话框外框”")); pProp->AddOption(_T("无")); pProp->AddOption(_T("细")); pProp->AddOption(_T("可调整大小")); pProp->AddOption(_T("对话框外框")); pProp->AllowEdit(FALSE); pGroup1->AddSubItem(pProp); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("标题"), (_variant_t) _T("关于"), _T("指定窗口标题栏中显示的文本"))); m_wndPropList.AddProperty(pGroup1); CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("窗口大小"), 0, TRUE); pProp = new CMFCPropertyGridProperty(_T("高度"), (_variant_t) 250l, _T("指定窗口的高度")); pProp->EnableSpinControl(TRUE, 50, 300); pSize->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("宽度"), (_variant_t) 150l, _T("指定窗口的宽度")); pProp->EnableSpinControl(TRUE, 50, 200); pSize->AddSubItem(pProp); m_wndPropList.AddProperty(pSize); CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("字体")); LOGFONT lf; CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); font->GetLogFont(&lf); _tcscpy_s(lf.lfFaceName, _T("宋体, Arial")); pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("字体"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("指定窗口的默认字体"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("使用系统字体"), (_variant_t) true, _T("指定窗口使用“MS Shell Dlg”字体"))); m_wndPropList.AddProperty(pGroup2); CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("杂项")); pProp = new CMFCPropertyGridProperty(_T("(名称)"), _T("应用程序")); pProp->Enable(FALSE); pGroup3->AddSubItem(pProp); CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("窗口颜色"), RGB(210, 192, 254), NULL, _T("指定默认的窗口颜色")); pColorProp->EnableOtherButton(_T("其他...")); pColorProp->EnableAutomaticButton(_T("默认"), ::GetSysColor(COLOR_3DFACE)); pGroup3->AddSubItem(pColorProp); static const TCHAR szFilter[] = _T("图标文件(*.ico)|*.ico|所有文件(*.*)|*.*||"); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("图标"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("指定窗口图标"))); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("文件夹"), _T("c:\\"))); m_wndPropList.AddProperty(pGroup3); CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("层次结构")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("第一个子级")); pGroup4->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("第二个子级")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 1"), (_variant_t) _T("值 1"), _T("此为说明"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 2"), (_variant_t) _T("值 2"), _T("此为说明"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 3"), (_variant_t) _T("值 3"), _T("此为说明"))); pGroup4->Expand(FALSE); m_wndPropList.AddProperty(pGroup4); }
void CPropertiesWnd::PropertyChanged(CMFCPropertyGridProperty* pProp) { CString strName(pProp->GetName()); if (strName.CompareNoCase(_T("TYPE")) == 0) { CMFCPropertyGridProperty* pPropGroup = pProp->GetParent(); for (int i = pPropGroup->GetSubItemsCount() - 1; i >= 0; i--) { CMFCPropertyGridProperty* pChildProp = pPropGroup->GetSubItem(i); if (pChildProp == pProp) { break; } pPropGroup->RemoveSubItem(pChildProp); } CString strType(pProp->GetValue()); if (strType.CompareNoCase(_T("Combo")) == 0) { CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T("")); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("ITEMS"), PROP_DATA_ITEMS, TRUE); pPropGroup->AddSubItem(pNewProp); } else if (strType.CompareNoCase(_T("Number")) == 0) { CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (_variant_t)0, _T("")); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("RANGE MIN"), (_variant_t)0, _T("")); pNewProp->EnableSpinControl(TRUE, -9999, 9999); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("RANGE MAX"), (_variant_t)100, _T("")); pNewProp->EnableSpinControl(TRUE, -9999, 9999); pPropGroup->AddSubItem(pNewProp); BOOL bBuddy = FALSE; pNewProp = new CMFCPropertyGridProperty(_T("BUDDY"), (_variant_t)(bBuddy == TRUE), _T("")); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("SHORT"), (_variant_t)_T(""), _T("")); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("PREVIEW"), (_variant_t)_T(""), _T("")); pPropGroup->AddSubItem(pNewProp); } else if (strType.CompareNoCase(_T("Text")) == 0) { CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T("")); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("SHORT"), (COleVariant)_T("")); pPropGroup->AddSubItem(pNewProp); pNewProp = new CMFCPropertyGridProperty(_T("PREVIEW"), (COleVariant)_T("")); pPropGroup->AddSubItem(pNewProp); } m_wndPropList.AdjustLayout(); } else if (strName.CompareNoCase(_T("PREVIEW")) == 0) { ((CMainFrame*)AfxGetMainWnd())->GetClassView()->RefreshPreview(); } else if (strName.CompareNoCase(_T("NAME")) == 0) { ((CMainFrame*)AfxGetMainWnd())->GetFileView()->RefreshPropName(pProp); } ((CMainFrame*)AfxGetMainWnd())->GetFileView()->SetFileModifiedFlag(TRUE); }
void CPropertiesWnd::InitPropList() { //SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(FALSE); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); return; CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Appearance")); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D Look"), (_variant_t) false, _T("Specifies the window's font will be non-bold and controls will have a 3D border"))); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Border"), _T("Dialog Frame"), _T("One of: None, Thin, Resizable, or Dialog Frame")); pProp->AddOption(_T("None")); pProp->AddOption(_T("Thin")); pProp->AddOption(_T("Resizable")); pProp->AddOption(_T("Dialog Frame")); pProp->AllowEdit(FALSE); pGroup1->AddSubItem(pProp); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Caption"), (_variant_t) _T("About"), _T("Specifies the text that will be displayed in the window's title bar"))); m_wndPropList.AddProperty(pGroup1); CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("Window Size"), 0, TRUE); pProp = new CMFCPropertyGridProperty(_T("Height"), (_variant_t) 250l, _T("Specifies the window's height")); pProp->EnableSpinControl(TRUE, 50, 300); pSize->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Width"), (_variant_t) 150l, _T("Specifies the window's width")); pProp->EnableSpinControl(TRUE, 50, 200); pSize->AddSubItem(pProp); m_wndPropList.AddProperty(pSize); CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("Font")); LOGFONT lf; CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); font->GetLogFont(&lf); lstrcpy(lf.lfFaceName, _T("Arial")); pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("Font"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("Specifies the default font for the window"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("Use System Font"), (_variant_t) true, _T("Specifies that the window uses MS Shell Dlg font"))); m_wndPropList.AddProperty(pGroup2); CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("Misc")); pProp = new CMFCPropertyGridProperty(_T("(Name)"), _T("Application")); pProp->Enable(FALSE); pGroup3->AddSubItem(pProp); CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("Window Color"), RGB(210, 192, 254), NULL, _T("Specifies the default window color")); pColorProp->EnableOtherButton(_T("Other...")); pColorProp->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE)); pGroup3->AddSubItem(pColorProp); static const TCHAR szFilter[] = _T("Icon Files(*.ico)|*.ico|All Files(*.*)|*.*||"); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Icon"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("Specifies the window icon"))); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Folder"), _T("c:\\"))); m_wndPropList.AddProperty(pGroup3); CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("Hierarchy")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("First sub-level")); pGroup4->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("Second sub-level")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 1"), (_variant_t) _T("Value 1"), _T("This is a description"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 2"), (_variant_t) _T("Value 2"), _T("This is a description"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 3"), (_variant_t) _T("Value 3"), _T("This is a description"))); pGroup4->Expand(FALSE); m_wndPropList.AddProperty(pGroup4); }
void CPropertiesWnd::InitPropList() { SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("모양")); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D 모양"), (_variant_t) false, _T("창에 굵은 글꼴이 아닌 글꼴을 지정하고, 컨트롤에 3D 테두리를 지정합니다."))); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("테두리"), _T("Dialog Frame"), _T("None, Thin, Resizable 또는 Dialog Frame 중 하나를 지정합니다.")); pProp->AddOption(_T("None")); pProp->AddOption(_T("Thin")); pProp->AddOption(_T("Resizable")); pProp->AddOption(_T("Dialog Frame")); pProp->AllowEdit(FALSE); pGroup1->AddSubItem(pProp); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("캡션"), (_variant_t) _T("정보"), _T("창의 제목 표시줄에 표시되는 텍스트를 지정합니다."))); m_wndPropList.AddProperty(pGroup1); CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("창 크기"), 0, TRUE); pProp = new CMFCPropertyGridProperty(_T("높이"), (_variant_t) 250l, _T("창의 높이를 지정합니다.")); pProp->EnableSpinControl(TRUE, 50, 300); pSize->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("너비"), (_variant_t) 150l, _T("창의 너비를 지정합니다.")); pProp->EnableSpinControl(TRUE, 50, 200); pSize->AddSubItem(pProp); m_wndPropList.AddProperty(pSize); CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("글꼴")); LOGFONT lf; CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); font->GetLogFont(&lf); lstrcpy(lf.lfFaceName, _T("맑은 고딕")); pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("글꼴"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("창의 기본 글꼴을 지정합니다."))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("시스템 글꼴을 사용합니다."), (_variant_t) true, _T("창에서 MS Shell Dlg 글꼴을 사용하도록 지정합니다."))); m_wndPropList.AddProperty(pGroup2); CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("기타")); pProp = new CMFCPropertyGridProperty(_T("(이름)"), _T("응용 프로그램")); pProp->Enable(FALSE); pGroup3->AddSubItem(pProp); CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("창 색상"), RGB(210, 192, 254), NULL, _T("창의 기본 색상을 지정합니다.")); pColorProp->EnableOtherButton(_T("기타...")); pColorProp->EnableAutomaticButton(_T("기본값"), ::GetSysColor(COLOR_3DFACE)); pGroup3->AddSubItem(pColorProp); static TCHAR BASED_CODE szFilter[] = _T("아이콘 파일(*.ico)|*.ico|모든 파일(*.*)|*.*||"); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("아이콘"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("창 아이콘을 지정합니다."))); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("폴더"), _T("c:\\"))); m_wndPropList.AddProperty(pGroup3); CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("계층")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("첫번째 하위 수준")); pGroup4->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("두 번째 하위 수준")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("항목 1"), (_variant_t) _T("값 1"), _T("설명입니다."))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("항목 2"), (_variant_t) _T("값 2"), _T("설명입니다."))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("항목 3"), (_variant_t) _T("값 3"), _T("설명입니다."))); pGroup4->Expand(FALSE); m_wndPropList.AddProperty(pGroup4); }
//更新卡属性编辑框 void CDlgAddCards::UpdateProCard() { m_proCard.RemoveAll();//删除所有 //2 根据列号决定列是否可编辑 typedef vector<CCardField*>::size_type sztype_vect; for (sztype_vect i = 1; i < m_swiCard.m_allFields.size(); ++i) { //从1开始,跳过第0项,第0项是卡名,不需要显示 CCardField* pField = m_swiCard.m_allFields.at(i); if(!pField) continue; CString sKeyname = pField->sKeyName.c_str(); if (sKeyname.IsEmpty()) continue; CString sCap = pField->sCaption.c_str(); if (sCap.IsEmpty() || sCap == _T("空")) continue; CString sValue; //如果示例值为空,就以默认值来代替实例值 if (pField->sInstantValue.empty()) sValue = pField->sDefaultValue.c_str(); else sValue = pField->sInstantValue.c_str(); CMFCPropertyGridProperty * pProp = 0; if(pField->sFormat[0] == 'I') { long val = std::atol(sValue); long mi = 0, ma = 10000; if( !pField->sMinValue.empty()) mi = std::atol(pField->sMinValue.c_str()); if(!pField->sMaxValue.empty()) ma = std::atol(pField->sMaxValue.c_str()); pProp = new CBoundedNumberSubProp(sCap, val, mi, ma, pField->sComment.c_str()); pProp->SetData((DWORD_PTR)pField);//存储字段指针 pProp->EnableSpinControl(TRUE, mi, ma); } else if(pField->sFormat[0] == 'F') { double val = std::atof(sValue); double mi = 0; double ma = 10000; if( !pField->sMinValue.empty()) mi = std::atof(pField->sMinValue.c_str()); if(!pField->sMaxValue.empty()) ma = std::atof(pField->sMaxValue.c_str()); pProp = new CBoundedNumberSubProp(sCap, val, mi, ma, pField->sComment.c_str()); pProp->SetData((DWORD_PTR)pField);//存储字段指针 } else { pProp = new CMFCPropertyGridProperty(sCap,pField->sInstantValue.c_str(), pField->sComment.c_str()); pProp->SetData((DWORD_PTR)pField);//存储字段指针 } //1 根据关键字决定列是否可用 if(TYPE_BUS == m_type) { if (sKeyname == _T("NAME") || sKeyname == _T("VOLT")) pProp->Enable(FALSE);//不可编辑 } else if(TYPE_GEN == m_type) { if (sKeyname == _T("NAME") || sKeyname == _T("VOLT") || sKeyname == _T("ID")) pProp->Enable(FALSE);//不可编辑 } else if(TYPE_LINE == m_type) { if (sKeyname == _T("NAME") || sKeyname == _T("VOLT") || sKeyname == _T("NAME1") || sKeyname == _T("VOLT1") || sKeyname == _T("CIRCUIT")) pProp->Enable(FALSE);//不可编辑 } m_proCard.AddProperty(pProp); } }
int CWorkspaceBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1; CRect rectDummy; rectDummy.SetRectEmpty (); if (!m_wndPropList.Create (WS_VISIBLE | WS_CHILD, rectDummy, this, 1)) { TRACE0("Failed to create Properies Grid \n"); return -1; // fail to create } m_wndPropList.EnableHeaderCtrl (FALSE); m_wndPropList.EnableDescriptionArea (); m_wndPropList.SetVSDotNetLook (); CMFCPropertyGridProperty* pMDITabsProp = new CMFCPropertyGridProperty (_T("Enable MDI Tabs"), lpszMDITabsStyles [1], _T("Enable or disable either the standard MDI Tabs feature, or MDI Tabbed Groups feature"), idShowMDITabs); pMDITabsProp->AddOption (_T ("None")); pMDITabsProp->AddOption (_T ("MDI Tabs (Standard)")); pMDITabsProp->AddOption (_T ("MDI Tabbed Groups")); int i = 0; for (i = 0; lpszMDITabsStyles [i] != NULL; i++) { pMDITabsProp->AddOption (lpszMDITabsStyles [i]); } switch (theApp.m_Options.m_nMDITabsType) { case CMDITabOptions::None: pMDITabsProp->SetValue (lpszMDITabsStyles [0]); break; case CMDITabOptions::MDITabsStandard: pMDITabsProp->SetValue (lpszMDITabsStyles [1]); break; case CMDITabOptions::MDITabbedGroups: pMDITabsProp->SetValue (lpszMDITabsStyles [2]); theApp.m_Options.m_bMaximizeMDIChild = TRUE; break; } pMDITabsProp->AllowEdit (FALSE); m_wndPropList.AddProperty (pMDITabsProp); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Maximize child"), (_variant_t) (theApp.m_Options.m_bMaximizeMDIChild == TRUE), _T("Always maximize MDI child windows"), idMaximizeMDIChild)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Tabs on top"), (_variant_t) (theApp.m_Options.m_bTabsOnTop == TRUE), _T("Show MDI tabs on top"), idTabsOnTop)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Active tab \"Close\" button"), (_variant_t) (theApp.m_Options.m_bActiveTabCloseButton == TRUE), _T("Show \"Close\" button on the active tab right side"), idActiveTabCloseButton)); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty (_T("MDI Tabs style"), _T(""), _T("One of: VS.NET, OneNote or Visual Studio 2005"), idTabsStyle); for (i = 0; lpszStyles [i] != NULL; i++) { pProp->AddOption (lpszStyles [i]); } switch (theApp.m_Options.m_nTabsStyle) { case CMFCTabCtrl::STYLE_3D_SCROLLED: pProp->SetValue (lpszStyles [0]); break; case CMFCTabCtrl::STYLE_3D_ONENOTE: pProp->SetValue (lpszStyles [1]); break; case CMFCTabCtrl::STYLE_3D_VS2005: pProp->SetValue (lpszStyles [2]); break; } pProp->AllowEdit (FALSE); m_wndPropList.AddProperty (pProp); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Tabs auto-color"), (_variant_t) (theApp.m_Options.m_bTabsAutoColor == TRUE), _T("Set MDI tabs automatic color"), idTabsAutoColor)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Tab icons"), (_variant_t) (theApp.m_Options.m_bMDITabsIcons == TRUE), _T("Show document icons on MDI tabs"), idMDITabsIcons)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Tabs document menu"), (_variant_t) (theApp.m_Options.m_bMDITabsDocMenu == TRUE), _T("Show menu with a list of opened documents"), idMDITabsDocMenu)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Drag tabs"), (_variant_t) (theApp.m_Options.m_bDragMDITabs == TRUE), _T("Enable MDI tabs order changing"), idDragMDITabs)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Context Menu"), (_variant_t) (theApp.m_Options.m_bMDITabsContextMenu == TRUE), _T("Enable MDI tabs context menu"), idMDITabsContextMenu)); CMFCPropertyGridProperty* pBorderProp = new CMFCPropertyGridProperty (_T("Border Size"), (_variant_t) ((short) theApp.m_Options.m_nMDITabsBorderSize), _T("Set MDI border"), idMDITabsBorderSize); pBorderProp->EnableSpinControl (TRUE, 0, 10); m_wndPropList.AddProperty (pBorderProp); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("No optimize MDI child redraw"), (_variant_t) (theApp.m_Options.m_bDisableMDIChildRedraw == TRUE), _T("Disable MDI Child redraw optimization"), idDisableMDIChildRedraw)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Flat Frame"), (_variant_t) (theApp.m_Options.m_bFlatFrame == TRUE), _T("Enable or disable 3D frame around MDI client area"), idFlatFrame)); m_wndPropList.AddProperty (new CMFCPropertyGridProperty (_T("Custom Tooltips"), (_variant_t) (theApp.m_Options.m_bCustomTooltips == TRUE), _T("Enable MDI tabs custom tooltips"), idCustomTooltips)); SetPropState (); return 0; }
void CPropertiesWnd::InitPropList() { SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("表示")); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D 表示"), (_variant_t) false, _T("ウィンドウのフォントが太字以外になり、また、コントロールが 3D ボーダーで描画されます"))); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("罫線"), _T("ダイアログ枠"), _T("次のうちのどれかです : なし、細枠、サイズ変更可能枠、ダイアログ枠")); pProp->AddOption(_T("なし")); pProp->AddOption(_T("細枠")); pProp->AddOption(_T("サイズ変更可能枠")); pProp->AddOption(_T("ダイアログ枠")); pProp->AllowEdit(FALSE); pGroup1->AddSubItem(pProp); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("キャプション"), (_variant_t) _T("バージョン情報"), _T("ウィンドウのタイトル バーに表示されるテキストを指定します"))); m_wndPropList.AddProperty(pGroup1); CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("ウィンドウ サイズ"), 0, TRUE); pProp = new CMFCPropertyGridProperty(_T("高さ"), (_variant_t) 250l, _T("ウィンドウの高さを指定します")); pProp->EnableSpinControl(TRUE, 50, 300); pSize->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("幅"), (_variant_t) 150l, _T("ウィンドウの幅を指定します")); pProp->EnableSpinControl(TRUE, 50, 200); pSize->AddSubItem(pProp); m_wndPropList.AddProperty(pSize); CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("フォント")); LOGFONT lf; CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); font->GetLogFont(&lf); lstrcpy(lf.lfFaceName, _T("MS Pゴシック")); pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("フォント"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("ウィンドウの既定フォントを指定します"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("システム フォントを使用する"), (_variant_t) true, _T("ウィンドウで MS Shell Dlg フォントを使用するように指定します"))); m_wndPropList.AddProperty(pGroup2); CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("その他")); pProp = new CMFCPropertyGridProperty(_T("(名前)"), _T("アプリケーション")); pProp->Enable(FALSE); pGroup3->AddSubItem(pProp); CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("ウィンドウの色"), RGB(210, 192, 254), NULL, _T("ウィンドウの既定の色を指定します")); pColorProp->EnableOtherButton(_T("その他...")); pColorProp->EnableAutomaticButton(_T("既定値"), ::GetSysColor(COLOR_3DFACE)); pGroup3->AddSubItem(pColorProp); static const TCHAR szFilter[] = _T("アイコン ファイル (*.ico)|*.ico|すべてのファイル (*.*)|*.*||"); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("アイコン"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("ウィンドウ アイコンを指定します"))); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("フォルダー"), _T("c:\\"))); m_wndPropList.AddProperty(pGroup3); CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("階層")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("1 番目のサブレベル")); pGroup4->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("2 番目のサブレベル")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("項目 1"), (_variant_t) _T("値 1"), _T("これは説明です"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("項目 2"), (_variant_t) _T("値 2"), _T("これは説明です"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("項目 3"), (_variant_t) _T("値 3"), _T("これは説明です"))); pGroup4->Expand(FALSE); m_wndPropList.AddProperty(pGroup4); }
void CShaderSrcDoc::ParseVars(VariableElementRef & variable, CMFCPropertyGridProperty * parentProperty) { variable->m_propGroup = parentProperty; switch (variable->m_typeDesc.Class) { case D3D_SVC_SCALAR: { CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Value"), (_variant_t)0l, _T("")); pProp->EnableSpinControl(TRUE, 0, 0); parentProperty->AddSubItem(pProp); variable->m_lProps.push_back(pProp); } break; case D3D_SVC_VECTOR: { variable->m_propType = new CMFCPropertyGridProperty(_T("Type"), _T("Vector"), _T("")); variable->m_propType->AddOption(_T("Vector")); variable->m_propType->AddOption(_T("Color")); variable->m_propType->AllowEdit(FALSE); parentProperty->AddSubItem(variable->m_propType); const char *fields_names = "XYZW"; for (size_t i= 0; i<variable->m_typeDesc.Columns; ++i) { CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(CString(fields_names[i]), (_variant_t)0l, _T("")); pProp->EnableSpinControl(TRUE, 0, 0); parentProperty->AddSubItem(pProp); variable->m_lProps.push_back(pProp); } } break; case D3D_SVC_MATRIX_ROWS: case D3D_SVC_MATRIX_COLUMNS: break; case D3D_SVC_OBJECT: case D3D_SVC_STRUCT: break; } switch (variable->m_typeDesc.Class) { case D3D_SVT_INT: case D3D_SVT_FLOAT: case D3D_SVT_UINT: case D3D_SVT_UINT8: case D3D_SVT_DOUBLE: break; case D3D_SVT_TEXTURE2D: case D3D_SVT_SAMPLER2D: break; } variable->m_propSource = new CMFCPropertyGridProperty(_T("Source"), _T("Manual"), _T("")); variable->m_propSource->AddOption(_T("Manual")); variable->m_propSource->AddOption(_T("Scenegraph")); variable->m_propSource->AllowEdit(FALSE); parentProperty->AddSubItem(variable->m_propSource); }
void CPropertiesWnd::InitPropList() { SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Вид")); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Трехмерный вид"), (_variant_t) false, _T("В окне используется обычный (не жирный) шрифт, а у элементов управления есть визуально трехмерная граница."))); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Граница"), _T("Диалоговое окно"), _T("Одно из значений: \"Нет\", \"Тонкая\", \"Изменяемая\" или \"Диалоговое окно\"")); pProp->AddOption(_T("Нет")); pProp->AddOption(_T("Тонкая")); pProp->AddOption(_T("Изменяемая")); pProp->AddOption(_T("Диалоговое окно")); pProp->AllowEdit(FALSE); pGroup1->AddSubItem(pProp); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Заголовок"), (_variant_t) _T("О программе"), _T("Указывает текст, который будет отображаться в строке заголовка окна"))); m_wndPropList.AddProperty(pGroup1); CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("Размер окна"), 0, TRUE); pProp = new CMFCPropertyGridProperty(_T("Высота"), (_variant_t) 250l, _T("Указывает высоту окна")); pProp->EnableSpinControl(TRUE, 50, 300); pSize->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Ширина"), (_variant_t) 150l, _T("Указывает ширину окна")); pProp->EnableSpinControl(TRUE, 50, 200); pSize->AddSubItem(pProp); m_wndPropList.AddProperty(pSize); CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("Шрифт")); LOGFONT lf; CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); font->GetLogFont(&lf); lstrcpy(lf.lfFaceName, _T("Arial")); pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("Шрифт"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("Указывает шрифт окна по умолчанию"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("Использование системного шрифта"), (_variant_t) true, _T("Указывает, что в окне используется шрифт MS Shell Dlg"))); m_wndPropList.AddProperty(pGroup2); CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("Разное")); pProp = new CMFCPropertyGridProperty(_T("(Имя)"), _T("Приложение")); pProp->Enable(FALSE); pGroup3->AddSubItem(pProp); CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("Цвет окна"), RGB(210, 192, 254), NULL, _T("Указывает цвет окна по умолчанию")); pColorProp->EnableOtherButton(_T("Другое...")); pColorProp->EnableAutomaticButton(_T("По умолчанию"), ::GetSysColor(COLOR_3DFACE)); pGroup3->AddSubItem(pColorProp); static const TCHAR szFilter[] = _T("Файлы значков(*.ico)|*.ico|Все файлы(*.*)|*.*||"); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Значок"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("Указывает значок окна"))); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Папка"), _T("c:\\"))); m_wndPropList.AddProperty(pGroup3); CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("Иерархия")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("Первый подуровень")); pGroup4->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("Второй подуровень")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Элемент 1"), (_variant_t) _T("Значение 1"), _T("Это описание"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Элемент 2"), (_variant_t) _T("Значение 2"), _T("Это описание"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Элемент 3"), (_variant_t) _T("Значение 3"), _T("Это описание"))); pGroup4->Expand(FALSE); m_wndPropList.AddProperty(pGroup4); }