void CXTPPropertyGridInplaceList::Apply()
{
	int nIndex = GetCurSel();
	if (nIndex != LB_ERR && m_pItem)
	{
		CXTPPropertyGridItemConstraint* pConstraint = (CXTPPropertyGridItemConstraint*)GetItemDataPtr(nIndex);
		if (pConstraint && !pConstraint->m_bEnabled)
			return;


		CXTPPropertyGridItem* pItem = m_pItem;
		m_pItem = NULL;

		CXTPPropertyGridItemConstraints* pList = pItem->GetConstraints();
		pList->SetCurrent(nIndex);

		CString str;
		GetText(nIndex, str);

		if (pItem->OnAfterEdit(str) && str != pItem->GetValue())
			pItem->OnValueChanged(str);
	}

	if (m_hWnd && ::GetFocus() == m_hWnd)
	{
		GetOwner()->SetFocus();
	}
}
Exemplo n.º 2
0
bool PropertyPaneTerrain::_OnCreate()
{
	CXTPPropertyGridItem* pCategory = m_wndPropertyGrid.AddCategory(L"Terrain Info");
	PROPERTY_REG(pCategory, Double, L"World Size"			, 0, propWorldSize		);
	PROPERTY_REG(pCategory, Number, L"Map Size"				, 0, propMapSize		);
	PROPERTY_REG(pCategory, Number, L"Min Batch Size"		, 0, propMinBatchSize	);
	PROPERTY_REG(pCategory, Number, L"Max Batch Size"		, 0, propMaxBatchSize	);
	PROPERTY_REG(pCategory, Number, L"Skirt Size"			, 0, propSkirtSize		);
	pCategory->Expand();

	pCategory = m_wndPropertyGrid.AddCategory(L"Terrain Config");
	PROPERTY_REG(pCategory, Number, L"Max Pixel Error"		, 0, propMaxPixelError	);
	PROPERTY_REG(pCategory, Double, L"CompositeMap Distance", 0, propCompMapDist	);
	pCategory->Expand();

// 	size_t maxLayer = ManipulatorSystem.GetScene()->GetTerrainMaxLayer();
// 	for(size_t iLayer=0; iLayer<maxLayer; ++iLayer)
// 	{
// 		std::string strLayer("Layer");
// 		strLayer += Ogre::StringConverter::toString(iLayer);
// 		std::wstring wcsLayer = Utility::EngineToUnicode(strLayer);
// 
// 		pCategory = m_wndPropertyGrid.AddCategory(wcsLayer.c_str());
// 		PROPERTY_REG(pCategory, Double, L"World Size"			, 0, propLayerWorldSize0 + iLayer);
// 		PROPERTY_REG(pCategory,		, L"Diffuse Map"			, L"",propLayerDiffuseMap0 + iLayer);
// 		PROPERTY_REG(pCategory,		, L"Normal Map"				, L"",propLayerNormalMap0 + iLayer);
// 		pCategory->Expand();
// 
// 		_CreateLayerTexList(propLayerDiffuseMap0 + iLayer);
// 		_CreateLayerTexList(propLayerNormalMap0 + iLayer);
// 	}

	return true;
}
bool PropertyPaneEffect::_OnCreate()
{
    CXTPPropertyGridItem* pCategory = m_wndPropertyGrid.AddCategory(L"Shadow");
    PROPERTY_REG(pCategory,	Double	, L"Far Distance"				, 300						, propShadowFarDist);
    PROPERTY_REG(pCategory,	Double	, L"Split Padding"				, 1							, propShadowSplitPadding);
    PROPERTY_REG(pCategory,	Vec3	, L"Optimal Adjust Factor"		, VEC3(0.5f,0.8f,2)		, propShadowOptimalAdjustFactor);
    PROPERTY_REG(pCategory,	Bool	, L"Use Simple Optimal Adjust"	, TRUE						, propShadowUseSimpleOptimalAdjust);
    PROPERTY_REG(pCategory, Number	, L"Camera Light Direction Threshold", 45					, propShadowCameraLightDirectionThreshold);
    PROPERTY_REG(pCategory, Vec3	, L"Shadow Map Size"			, VEC3(2048,1024,1024)	, propShadowMapSize);
    PROPERTY_REG(pCategory,	Bool	, L"Self Shadow"				, FALSE						, propShadowSelfShadow);
    PROPERTY_REG(pCategory, Bool	, L"Render Back Faces"			, TRUE						, propShadowCasterRenderBackFaces);
    PROPERTY_REG(pCategory,	Double	, L"Lambda"						, 0.75f						, propShadowLambda);
    PROPERTY_REG(pCategory,	Double	, L"Extrusion Distance"			, 10000						, propShadowDirectionalLightExtrusionDistance);
    pCategory->Expand();

    pCategory = m_wndPropertyGrid.AddCategory(L"SSAO");
    PROPERTY_REG(pCategory,	Double	, L"Sample Length"				, 20						, propSSAOSampleLength);
    PROPERTY_REG(pCategory,	Double	, L"Offset Scale"				, 1							, propSSAOOffsetScale);
    PROPERTY_REG(pCategory,	Double	, L"Default Accessibility"		, 0.5f						, propSSAODefaultAccessibility);
    PROPERTY_REG(pCategory,	Double	, L"Edge Highlight"				, 1.99f						, propSSAOEdgeHighlight);
    pCategory->Expand();

    (dynamic_cast<CXTPPropertyGridItemVec3*>(m_mapItem[propShadowOptimalAdjustFactor]))->SetChildItemID(propOptimalAdjustFactor0, propOptimalAdjustFactor1, propOptimalAdjustFactor2);
    (dynamic_cast<CXTPPropertyGridItemVec3*>(m_mapItem[propShadowMapSize]))->SetChildItemID(propShadowMapSize0, propShadowMapSize1, propShadowMapSize2);

    return true;
}
Exemplo n.º 4
0
bool PropertyPaneParticle::_OnCreate()
{
    bool ret = __super::_OnCreate();

    CXTPPropertyGridItem* pCategory = m_wndPropertyGrid.AddCategory(L"Particle");
    PROPERTY_REG(pCategory,			, L"Particle"		, L""	, propParticle		);
    pCategory->Expand();

    m_mapItem[propParticle]->SetFlags(xtpGridItemHasComboButton);

    return ret;
}
void CXTPPropertyGridInplaceMultilineEdit::Apply()
{
	if (m_pItem)
	{
		CXTPPropertyGridItem* pItem = m_pItem;
		m_pItem = NULL;

		CString str;
		GetWindowText(str);

		if (pItem->OnAfterEdit(str) && str != pItem->GetValue())
			pItem->OnValueChanged(str);
	}

	if (m_hWnd && ::GetFocus() == m_hWnd)
	{
		GetOwner()->SetFocus();
	}
}
Exemplo n.º 6
0
void PropertyPaneParticle::_SetProperty( int nID)
{
    if(nID < propDerivedStart)
    {
        __super::_SetProperty(nID);
        return;
    }

    ManipulatorEffect& manEffect = ManipulatorSystem.GetEffect();
    CXTPPropertyGridItem* pItem = m_mapItem[nID];
    std::string paramValue = Utility::UnicodeToEngine(pItem->GetValue());

    switch (nID)
    {
    case propParticle:
        manEffect.SetEffectParam("template", paramValue);
        break;
    default:
        assert(0);
    }
}
Exemplo n.º 7
0
LRESULT CSwissKnifePaneModify::OnGridNotify( WPARAM wParam, LPARAM lParam )
{
	if (wParam == XTP_PGN_INPLACEBUTTONDOWN)
	{
		CXTPPropertyGridInplaceButton* pButton = (CXTPPropertyGridInplaceButton*)lParam;
		if (pButton->GetItem()->GetID() == 510 && pButton->GetID() == XTP_ID_PROPERTYGRID_EXPANDBUTTON) // 2 Buttons
		{
			AfxMessageBox(_T("Expand button"));
			return TRUE;
		}
	}

	if (wParam == XTP_PGN_SORTORDER_CHANGED)
	{
		UpdateData(FALSE);
		TRACE(_T("SortOrder Changed.\n"));
	}
	if (wParam == XTP_PGN_ITEMVALUE_CHANGED)
	{
		CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
		TRACE(_T("Value Changed. Caption = %s, ID = %i, Value = %s\n"), pItem->GetCaption(), pItem->GetID(), pItem->GetValue());

		if (DYNAMIC_DOWNCAST(CXTPPropertyGridItemEnum, pItem))
		{
			if (pItem->GetMetrics(TRUE, FALSE))
			{
				pItem->GetMetrics(TRUE, FALSE)->m_nImage = ((CXTPPropertyGridItemEnum*)pItem)->GetEnum();
			}
		}


		if( pItem->GetID() == ID_CREATE_PHYSIC_LAYER)
		{
			CXTPPropertyGridItemBool* itembool = (CXTPPropertyGridItemBool*)pItem;
			if (m_currTarget && itembool->GetBool())
			{
				if (!m_currTarget->getPhysicLayer())
				{
#ifdef OS_WIN32

						IGameObjectPhysicLayer* pPhysicLayer = gEnv->pPhysics->CreatePhysicLayer();
						m_currTarget->setGameObjectLayer(pPhysicLayer);
						pPhysicLayer->createStatic();

						
#endif

				}
			}
		}
	}
	if (wParam == XTP_PGN_SELECTION_CHANGED)
	{
		CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
		if (pItem)
		{
			if (pItem->IsKindOf(RUNTIME_CLASS(CXTPPropertyGridItemColor)))
			{
				TRACE(_T("Color Item. Selection Changed. Item = %s\n"), pItem->GetCaption());
			}
		}
	}
	if (wParam == XTP_PGN_EDIT_CHANGED)
	{
		CXTPPropertyGridInplaceEdit* pEdit = DYNAMIC_DOWNCAST(CXTPPropertyGridInplaceEdit, (CWnd*)lParam);
		if (pEdit && pEdit->GetItem())
		{
			// Custom Validation
			// Custom Validation
			if (pEdit->GetItem()->GetCaption() == _T("ItemsInMRUList"))
			{
				CString str;
				pEdit->CEdit::GetWindowText(str);

				int i = _ttoi(str);
				if (i > 20)
				{
					MessageBeep((UINT)-1);
					pEdit->SetSel(0, -1);
					pEdit->ReplaceSel(_T("20"));
				}
			}
		}
	}
	return 0;
}
Exemplo n.º 8
0
VOID KSceneSettingDialogV2::InitGrid()
{
	// Add "About..." menu item to system menu.
#if 1
	// get the size of the place holder, this will be used when creating the grid.

	CRect rc(0,0,100,100);
	
	{
		HWND hWnd = NULL;
		this->GetDlgItem(IDC_CUSTOM1, &hWnd);
		if (NULL != hWnd)
		{
			::GetWindowRect(hWnd, &rc);
			ScreenToClient(&rc);
			::ShowWindow(hWnd, SW_HIDE);
		}
	}

	// create the property grid.
	if ( m_Grid.Create( rc, this, IDC_SCENESETTING_GRID) )
	{
		LOGFONT lf;
		GetFont()->GetLogFont( &lf );

		// create document settings category.
		CXTPPropertyGridItem* pSettings        = m_Grid.AddCategory(_T("Document Settings"));

		// add child items to category.
		CXTPPropertyGridItem* pItemSaveOnClose = pSettings->AddChildItem(new CXTPPropertyGridItemBool(_T("SaveOnClose"), TRUE));
		pSettings->AddChildItem(new CXTPPropertyGridItemFont(_T("WindowFont"), lf));
		pSettings->AddChildItem(new CXTPPropertyGridItemSize(_T("WindowSize"), CSize(100, 100)));

		pSettings->Expand();
		pItemSaveOnClose->Select();

		// create global settings category.
		CXTPPropertyGridItem* pGlobals      = m_Grid.AddCategory(_T("Global Settings"));

		// add child items to category.
		CXTPPropertyGridItem* pItemGreeting = pGlobals->AddChildItem(new CXTPPropertyGridItem(_T("Greeting Text"), _T("Welcome to your application!")));
		pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("ItemsInMRUList"), 4));
		CXTPPropertyGridItem* pItemRate     = pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("MaxRepeatRate"), 10));
		pGlobals->AddChildItem(new CXTPPropertyGridItemColor(_T("ToolbarColor"), RGB(255, 192,128)));

		pItemGreeting->SetReadOnly(TRUE);
		pItemRate->SetDescription(_T("The rate in milliseconds that the text will repeat."));

		// create version category.
		CXTPPropertyGridItem* pVersion      = m_Grid.AddCategory(_T("Version"));

		// add child items to category.
		CXTPPropertyGridItem* pItemVersion  = pVersion->AddChildItem(new CXTPPropertyGridItem(_T("AppVerion"), _T("1.0")));
		CXTPPropertyGridItem* pItemLanguage = pVersion->AddChildItem(new CXTPPropertyGridItem(IDC_COMBO1, _T("English (United States)")));

		pItemVersion->SetReadOnly(TRUE);
		pVersion->Expand();

		CXTPPropertyGridItemConstraints* pList = pItemLanguage->GetConstraints();

		pList->AddConstraint(_T("Neutral"));
		pList->AddConstraint(_T("Arabic"));
		pList->AddConstraint(_T("German"));
		pList->AddConstraint(_T("Chinese(Taiwan)"));
		pList->AddConstraint(_T("English (United Kingdom)"));
		pList->AddConstraint(_T("English (United States)"));
		pList->AddConstraint(_T("France"));
		pList->AddConstraint(_T("Russian"));

		pItemLanguage->SetFlags(xtpGridItemHasComboButton | xtpGridItemHasEdit);


		// create standard items category.
		CXTPPropertyGridItem* pStandard   = m_Grid.AddCategory(_T("Standard Items"));
		pStandard->AddChildItem(new CXTPPropertyGridItem(_T("String item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemNumber(_T("Integer item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemDouble(_T("Double item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemColor(_T("Color item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemBool(_T("Bool item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemFont(_T("Font item"), lf));
		COleDateTime dates(1981, 1, 26, 0, 0, 0 );
		pStandard->AddChildItem(new CXTPPropertyGridItemDate(_T("Date item"), dates));
		pStandard->AddChildItem(new CXTPPropertyGridItemSize(_T("Size item")));

		CXTPPropertyGridItem* pItem = pStandard->AddChildItem(new CXTPPropertyGridItemEnum(_T("Enum item"), 2));
		pItem->GetConstraints()->AddConstraint(_T("Windows 98"), 1);
		pItem->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
		pItem->GetConstraints()->AddConstraint(_T("Windows XP"), 3);

		pItem = pStandard->AddChildItem(new CXTPPropertyGridItemFlags(_T("Flag item"), 1 + 2));
		pItem->GetConstraints()->AddConstraint(_T("All Windows"), 1 + 2 + 4);
		pItem->GetConstraints()->AddConstraint(_T("Windows 98"), 1);
		pItem->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
		pItem->GetConstraints()->AddConstraint(_T("Windows XP"), 4);



		// create custom items category.
		//CXTPPropertyGridItem* pCustom   = m_Grid.AddCategory(_T("Custom Items"));

		//// add child items to category.
		//CXTPPropertyGridItem* pItemIcon = pCustom->AddChildItem(new CCustomItemIcon(_T("Icon"), m_hIcon));
		//CXTPPropertyGridItem* pItemDock = pCustom->AddChildItem(new CCustomItemChilds(_T("DockPadding"), CRect(100, 20, 400, 50)));
		//pCustom->AddChildItem(new CCustomItemColor(_T("CustomCombolist"), RGB(0xFF, 0x80, 0x40)));

		//pItemIcon->SetDescription(_T("This sample shows how to override draw function"));
		//pItemDock->SetDescription(_T("This sample shows how to add item with childs"));

		//CXTPPropertyGridItem* pItemSpin = pCustom->AddChildItem(new CCustomItemSpin(_T("SpinButton")));
		//pItemSpin->SetDescription(_T("This sample shows how to add new button type"));
	}

//#ifdef _XTP_INCLUDE_CONTROLS
//	// Set control resizing.
//	SetResize(IDC_PROPERTY_GRID, SZ_TOP_LEFT, SZ_BOTTOM_RIGHT);
//
//	SetResize(IDC_GBOX_APPEAR,       SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_TOOLBAR,       SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_HELP,          SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_DOUBLE,        SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_TABITEMS,      SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_COMBO_THEME,      SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_GBOX_SORT,         SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_SORT_CATEGORIES,   SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_SORT_ALPHABETICAL, SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_SORT_NOSORT,       SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_GBOX_COLOR,        SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_CUSTOMCOLORS,  SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_BUTTON_SWITCHSTATE,  SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//
//	// Load window placement
//	AutoLoadPlacement(_T("CPropertyGridDlg"));
//#endif
//
//	m_cmbTheme.AddString(_T("Default"));
//	m_cmbTheme.AddString(_T("NativeWinXP"));
//	m_cmbTheme.AddString(_T("Office2003"));
//	m_cmbTheme.AddString(_T("Cool"));
//	m_cmbTheme.AddString(_T("Simple"));
//	m_cmbTheme.AddString(_T("Delphi"));
//	m_cmbTheme.AddString(_T("Whidbey"));
//	m_cmbTheme.SetCurSel(0);
#endif

}
Exemplo n.º 9
0
// CPaneDialog message handlers
BOOL CPaneDialog::OnInitDialog()
{
	CPropertyGridDlgBase::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);         // Set big icon
	SetIcon(m_hIcon, FALSE);        // Set small icon

	CRect rcWorkspace;//GetDlgItem(IDC_STATIC)
	this->GetWindowRect(rcWorkspace);
	ScreenToClient(rcWorkspace);

	if ( m_wndPropertyGrid.Create( rcWorkspace, this, IDC_PROPERTY_GRID ) )
	{
		m_wndPropertyGrid.SetVariableItemsHeight(TRUE);

		LOGFONT lf;
		GetFont()->GetLogFont( &lf );

		// create document settings category.
		CXTPPropertyGridItem* pSettings        = m_wndPropertyGrid.AddCategory(_T("Document Settings"));
		m_wndPropertyGrid.SetTheme(xtpGridThemeNativeWinXP);

		pSettings->SetTooltip(_T("Document Settings Category"));

		// add child items to category.
		CXTPPropertyGridItem* pItemSaveOnClose = pSettings->AddChildItem(new CXTPPropertyGridItemBool(_T("SaveOnClose"), TRUE));
		pSettings->AddChildItem(new CXTPPropertyGridItemFont(_T("WindowFont"), lf));
		pSettings->AddChildItem(new CXTPPropertyGridItemSize(_T("WindowSize"), CSize(100, 100)));

		pSettings->Expand();
		pItemSaveOnClose->Select();

		// create global settings category.
		CXTPPropertyGridItem* pGlobals      = m_wndPropertyGrid.AddCategory(_T("Global Settings"));

		// add child items to category.
		CXTPPropertyGridItem* pItemGreeting = pGlobals->AddChildItem(new CXTPPropertyGridItem(_T("Greeting Text"), _T("Welcome to your application!")));
		pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("ItemsInMRUList"), 4));
		CXTPPropertyGridItem* pItemRate     = pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("MaxRepeatRate"), 10));
		pGlobals->AddChildItem(new CXTPPropertyGridItemColor(_T("ToolbarColor"), RGB(255, 192,128)));

		pItemGreeting->SetReadOnly(TRUE);
		pItemRate->SetDescription(_T("The rate in milliseconds that the text will repeat."));
	}

	// Set control resizing.
	SetResize(IDC_PROPERTY_GRID, XTP_ANCHOR_TOPLEFT, XTP_ANCHOR_BOTTOMRIGHT);

	return TRUE;  // return TRUE  unless you set the focus to a control
}