int ControllerProperty::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (BaseProperty::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here DebuggingProcessProp * process = (DebuggingProcessProp *)this->target; CString strMode; if (process->traceMode == DebuggingProcessProp::MODE_TRACE_GRAPH) strMode.SetString(L"display data"); else strMode.SetString(L"raw data"); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Trace Type"), strMode.GetBuffer(), _T("Specifies the trace type of the track bar")); pProp->AddOption(_T("display data")); pProp->AddOption(_T("raw data")); pProp->AllowEdit(FALSE); this->AddProperty(pProp); //pProp = new CMFCPropertyGridProperty( _T("Threshold"), (_variant_t) process->threshold, _T("Specifies the threshold for the channel circular buffer")); //this->AddProperty(pProp); return 0; }
void CFileView::OnGroupAddprop() { HTREEITEM hGroupItem = GetSelectItemGroup(); ASSERT(hGroupItem != NULL); CMFCPropertyGridProperty* pPropGroup = new CMFCPropertyGridProperty(_T("PROPERTY")); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("NAME"), (COleVariant)_T("New")); pPropGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("TYPE"), (COleVariant)_T("Combo"), _T(""), PROP_DATA_TYPE); pProp->AddOption(_T("Combo")); pProp->AddOption(_T("Number")); pProp->AddOption(_T("Text")); pProp->AllowEdit(FALSE); pPropGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T("No")); pPropGroup->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty(_T("ITEMS"), PROP_DATA_ITEMS, TRUE); pPropGroup->AddSubItem(pProp); CString strValues[2] = { _T("Yes"), _T("No") }; for (int i = 0; i < 2; i++) { CMFCPropertyGridProperty* pPropItem = new CMFCPropertyGridProperty(_T("ITEM"), 0, TRUE); pProp->AddSubItem(pPropItem); pProp->Expand(TRUE); CMFCPropertyGridProperty* pPropChild = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)strValues[i]); pPropItem->AddSubItem(pPropChild); pPropChild = new CMFCPropertyGridProperty(_T("SHORT"), (COleVariant)_T("")); pPropItem->AddSubItem(pPropChild); pPropChild = new CMFCPropertyGridProperty(_T("PREVIEW"), (COleVariant)_T("")); pPropItem->AddSubItem(pPropChild); pPropItem->Expand(TRUE); } HTREEITEM hItem = m_wndFileView.InsertItem(_T("New"), 2, 2, hGroupItem); m_wndFileView.SetItemData(hItem, (DWORD_PTR)pPropGroup); if (hGroupItem) { m_wndFileView.Expand(hGroupItem, TVE_EXPAND); m_wndFileView.SelectItem(hItem); } }
void xRenderSettingPane::_ToCtrl(CMFCPropertyGridProperty * gp, IPropertyObj * obj, const Property * p) { if (p->type == PT_Bool) { bool data = p->AsBool(obj->GetPropertyData(p)); gp->AddSubItem(new CMFCPropertyGridProperty(p->name.c_str(), (_variant_t)(data), "")); } else if (p->type == PT_Int) { int val = p->AsInt(obj->GetPropertyData(p)); const cEnum * e = p->enumObj->GetEnum(val); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(p->name.c_str(), e->name.c_str()); for (int i = 0; i < p->enumObj->GetEnumCount(); ++i) { e = p->enumObj->GetEnum(i); pProp->AddOption(e->name.c_str()); } pProp->AllowEdit(FALSE); gp->AddSubItem(pProp); } }
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; }
CMFCPropertyGridProperty * ChannelGrid::CreateRemote() { CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(_T("设备端口")); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("类型"), _T("串口"), _T("信道类型选择")); pProp->AddOption(_T("串口")); pProp->AddOption(_T("TCP客户端")); pProp->AddOption(_T("TCP服务器")); pProp->AddOption(_T("UDP")); pProp->AddOption(_T("插件")); pProp->AddOption(_T("测试")); pProp->AllowEdit(FALSE); pGroup->AddSubItem(pProp); return pGroup; }
void COptionWnd::loadMaterialTemplateAndCity() { CMainFrame* pMain=(CMainFrame*)AfxGetApp()->m_pMainWnd; CBuildLightAnalysisDoc* pDoc = (CBuildLightAnalysisDoc*)pMain->GetActiveDocument(); CString strMat; vector<Material>& mats = pDoc->getMaterials(); CMFCPropertyGridProperty* pOutWallMaterial = m_wndPropList.GetProperty(OPTION_OUTWALL_MAT);pOutWallMaterial->AllowEdit(FALSE); CMFCPropertyGridProperty* pInWallMaterial = m_wndPropList.GetProperty(OPTION_INWALL_MAT);pInWallMaterial->AllowEdit(FALSE); CMFCPropertyGridProperty* pWindowMaterial = m_wndPropList.GetProperty(OPTION_WINDOW_MAT);pWindowMaterial->AllowEdit(FALSE); CMFCPropertyGridProperty* pFloorMaterial = m_wndPropList.GetProperty(OPTION_FLOOR_MAT);pFloorMaterial->AllowEdit(FALSE); CMFCPropertyGridProperty* pRoofMaterial = m_wndPropList.GetProperty(OPTION_ROOF_MAT);pRoofMaterial->AllowEdit(FALSE); for (int i = 0; i < mats.size(); i++) { strMat = StringToCString(mats[i].name); pOutWallMaterial->AddOption(strMat); pInWallMaterial->AddOption(strMat); pWindowMaterial->AddOption(strMat); pFloorMaterial->AddOption(strMat); pRoofMaterial->AddOption(strMat); } CMFCPropertyGridProperty* pCitys = m_wndPropList.GetProperty(OPTION_CITY); vector<CString>& citys = pDoc->getCitys(); for (int i = 0; i < citys.size(); i++) { pCitys->AddOption(citys[i]); } pCitys->AllowEdit(FALSE); }
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::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); }
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 CLegoBrickPropertiesWnd::Update() { m_wndPropList.RemoveAll(); CMainFrame* pFrame = (CMainFrame*) AfxGetMainWnd(); HTREEITEM hSelected = pFrame->GetClassView()->GetTreeView()->GetSelectedItem(); if (hSelected == NULL) { m_wndPropList.RedrawWindow(); return; } CString str = pFrame->GetClassView()->GetTreeView()->GetItemText(hSelected); CString str1 = pFrame->GetClassView()->GetTreeView()->GetItemText(pFrame->GetClassView()->hRoot1); CString str2 = pFrame->GetClassView()->GetTreeView()->GetItemText(pFrame->GetClassView()->hRoot2); if (str == str1 || str == str2) { m_wndPropList.RedrawWindow(); return; } LBInfoNode* pBrickNode = (LBInfoNode*)pFrame->GetClassView()->GetTreeView()->GetItemData(hSelected); BricksInfo* pBrick = &(pBrickNode->bi); CMFCPropertyGridProperty* pG = new CMFCPropertyGridProperty(_T("Lego")); pGroup = pG; int i; for (i=0; i<NUMOFBRICKTYPE; i++) { if (strmap[i].bt == pBrick->brick.type) break; } CMFCPropertyGridProperty* pT = new CMFCPropertyGridProperty(_T("brick type"), strmap[i].str, _T("brick type")); pPropType = pT; for (i=0; i<NUMOFBRICKTYPE; i++) pT->AddOption(strmap[i].str, TRUE); //TRUE to add the list item only if it does not already exist; // CClientDC dc(&m_wndPropList); // pT->OnDrawValue(&dc, NULL); pT->AllowEdit(FALSE); pG->AddSubItem(pT); /* // CMFCPropertyGridColorProperty *pC = new CMFCPropertyGridColorProperty(_T("Color"), RGB(255, 0, 0), NULL, _T("set LEGO brick color")); CMFCPropertyGridColorProperty *pC = new CMFCPropertyGridColorProperty(_T("Color"), pBrick->brick.color, NULL, _T("set LEGO brick color")); pPropColor = pC; // pC->AddOption(_T("Lego Color"), TRUE); // no use pC->EnableOtherButton(_T("Other color")); // pC->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE)); pC->SetColor(RGB(255,0,0)); pC->SetColumnsNumber(6); // pPropColor->EnableAutomaticButton(_T("預設"), ::GetSysColor(COLOR_3DFACE)); pG->AddSubItem(pC); */ CPHPropertyGridColorProperty *pPH; if (pBrick->brick.pLegoColor != NULL) pPH = new CPHPropertyGridColorProperty(_T("Color"), pBrick->brick.pLegoColor->rgb); else pPH = new CPHPropertyGridColorProperty(_T("Color"), pBrick->brick.color); pPropColor = pPH; pG->AddSubItem(pPH); CMFCPropertyGridProperty *pN = new CMFCPropertyGridProperty(_T("num bricks"), (_variant_t) pBrick->numBricks, _T("number of bricks: -1 for unlimited")); pPropNum = pN; pG->AddSubItem(pN); m_wndPropList.AddProperty(pG); // m_wndPropList.RedrawWindow(); return; }
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 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); }