Esempio n. 1
0
void DotsPlotWndProperty::UpdatePropertyValue(const wchar_t * propertyName)
{

	CMFCPropertyGridProperty * property = NULL;
	for (int i = 0; i < this->GetPropertyCount(); i++)
	{
		 CMFCPropertyGridProperty * aProperty = this->GetProperty(i);
		 if (wcscmp(aProperty->GetName(), propertyName) == 0)
		 {
			 property = aProperty;
			 break;
		 }
	}

	if (property == NULL)
		return;

	_variant_t value = property->GetValue();
	
	PlotWndPropDots * objProp = (PlotWndPropDots *)this->target;
	if (wcscmp(propertyName, L"Max Value") == 0)
	{
		_variant_t value = property->GetValue();
		value.intVal = (int)objProp->GetMaxValue();
		property->SetValue(value);
	}
	//else if (wcscmp(propertyName, L"Frame Count") == 0)
	//{
	//	_variant_t value = property->GetValue();
	//	value.intVal = (int)objProp->frameCount;
	//	property->SetValue(value);
	//}
}
Esempio n. 2
0
// MFC bug, this does not work!
// Details : can not retrieve the data just input.
bool CReflectiveUI::ValidateItemData(CMFCPropertyGridProperty* pProp)
{
	CMFCPropertyGridProperty* pItem = pProp;

	assert( _GridPropertyMap.find(pItem) != _GridPropertyMap.end() );
	SPropertyObject PO = _GridPropertyMap[pItem];

	bool bValid = true;

	switch ( PO._pProperty->GetTypeID() )
	{
	case eptBool:
		{
			TypedProperty<bool>* pTypedProperty = (TypedProperty<bool>*)PO._pProperty;
			bValid = pTypedProperty->ValidateValue( pItem->GetValue().boolVal != 0);
			break;
		}
	case eptByte:
		{
			TypedProperty<char>* pTypedProperty = (TypedProperty<char>*)PO._pProperty;
			bValid = pTypedProperty->ValidateValue( pItem->GetValue().bVal );
			break;
		}
	case eptShort:
		{
			TypedProperty<short>* pTypedProperty = (TypedProperty<short>*)PO._pProperty;
			bValid = pTypedProperty->ValidateValue( pItem->GetValue().iVal );

			break;
		}
	case eptInt:
		{
			TypedProperty<int>* pTypedProperty = (TypedProperty<int>*)PO._pProperty;
			bValid = pTypedProperty->ValidateValue( pItem->GetValue().intVal );

			break;
		}
	case eptLong:
		{
			TypedProperty<long>* pTypedProperty = (TypedProperty<long>*)PO._pProperty;
			bValid = pTypedProperty->ValidateValue( pItem->GetValue().lVal );
			break;
		}
	case eptPtr:
		{
			break;
		}
	case eptOgreReal:
		{
			TypedProperty<Ogre::Real>* pTypedProperty = (TypedProperty<Ogre::Real>*)PO._pProperty;
			bValid = pTypedProperty->ValidateValue( pItem->GetValue().fltVal );

			break;
		}
	case eptOgreString:
		{
			TypedProperty<Ogre::String>* pTypedProperty = (TypedProperty<Ogre::String>*)PO._pProperty;
			GString gStr(pItem->GetValue().bstrVal);
			bValid = pTypedProperty->ValidateValue( gStr.ToMbcs() );

			break;
		}
	};

	if (!bValid)
	{
		pItem->SetValue(pItem->GetOriginalValue());
	}

	return bValid;
}
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;
}
Esempio n. 4
-1
LRESULT CWorkspaceBar::OnPropertyChanged (WPARAM,LPARAM lParam)
{
	CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty*) lParam;

	BOOL bResetMDIChild = FALSE;

	switch ((int) pProp->GetData ())
	{
	case idShowMDITabs:
		{
			CString strShowMdiTabOption = (LPCTSTR) (_bstr_t)pProp->GetValue ();
			bResetMDIChild = TRUE;

			for (int i = 0; lpszMDITabsStyles [i] != NULL; i++)
			{
				if (strShowMdiTabOption == lpszMDITabsStyles [i])
				{
					switch (i)
					{
					case 0:
						theApp.m_Options.m_nMDITabsType = CMDITabOptions::None;
						break;

					case 1:
						theApp.m_Options.m_nMDITabsType = CMDITabOptions::MDITabsStandard;
						break;

					case 2:
						theApp.m_Options.m_nMDITabsType = CMDITabOptions::MDITabbedGroups;
						theApp.m_Options.m_bMaximizeMDIChild = FALSE;
						CMFCPropertyGridProperty* pMaximizeChildProp = m_wndPropList.GetProperty (1);
						if (pMaximizeChildProp != NULL)
						{
							_variant_t var ((short)theApp.m_Options.m_bMaximizeMDIChild, VT_BOOL);
							pMaximizeChildProp->SetValue (var);
							pMaximizeChildProp->Enable (FALSE);
						}
						bResetMDIChild = FALSE;
						break;
					}
					break;
				}
			}
			
			SetPropState ();
		}
		break;

	case idMaximizeMDIChild:
		theApp.m_Options.m_bMaximizeMDIChild = (bool) pProp->GetValue ();
		bResetMDIChild = TRUE;
		break;

	case idTabsOnTop:
		theApp.m_Options.m_bTabsOnTop = (bool) pProp->GetValue ();
		break;

	case idActiveTabCloseButton:
		theApp.m_Options.m_bActiveTabCloseButton = (bool) pProp->GetValue ();
		break;

	case idTabsStyle:
		{
			CString strStyle = (LPCTSTR) (_bstr_t)pProp->GetValue ();

			for (int i = 0; lpszStyles [i] != NULL; i++)
			{
				if (strStyle == lpszStyles [i])
				{
					switch (i)
					{
					case 0:
						theApp.m_Options.m_nTabsStyle = CMFCTabCtrl::STYLE_3D_SCROLLED;
						break;

					case 1:
						theApp.m_Options.m_nTabsStyle = CMFCTabCtrl::STYLE_3D_ONENOTE;
						break;

					case 2:
						theApp.m_Options.m_nTabsStyle = CMFCTabCtrl::STYLE_3D_VS2005;
						break;
					}
					break;
				}
			}
		}
		break;

	case idTabsAutoColor:
		theApp.m_Options.m_bTabsAutoColor = (bool) pProp->GetValue ();
		break;

	case idMDITabsIcons:
		theApp.m_Options.m_bMDITabsIcons = (bool) pProp->GetValue ();
		break;

	case idMDITabsDocMenu:
		theApp.m_Options.m_bMDITabsDocMenu = (bool) pProp->GetValue ();
		break;

	case idDragMDITabs:
		theApp.m_Options.m_bDragMDITabs = (bool) pProp->GetValue ();
		break;

	case idMDITabsContextMenu:
		theApp.m_Options.m_bMDITabsContextMenu = (bool) pProp->GetValue ();
		break;

	case idMDITabsBorderSize:
		{
			int nBorderSize = pProp->GetValue ().iVal;
			theApp.m_Options.m_nMDITabsBorderSize = min (10, max (0, nBorderSize));
		}
		break;

	case idDisableMDIChildRedraw:
		theApp.m_Options.m_bDisableMDIChildRedraw = (bool) pProp->GetValue ();
		break;

	case idFlatFrame:
		theApp.m_Options.m_bFlatFrame = (bool) pProp->GetValue ();
		break;

	case idCustomTooltips:
		theApp.m_Options.m_bCustomTooltips = (bool) pProp->GetValue ();
		break;
	}

	theApp.UpdateMDITabs (bResetMDIChild);
	return 0;
}