当前位置: 首页>>代码示例>>C++>>正文


C++ wxPropertyGridEvent::GetPropertyName方法代码示例

本文整理汇总了C++中wxPropertyGridEvent::GetPropertyName方法的典型用法代码示例。如果您正苦于以下问题:C++ wxPropertyGridEvent::GetPropertyName方法的具体用法?C++ wxPropertyGridEvent::GetPropertyName怎么用?C++ wxPropertyGridEvent::GetPropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxPropertyGridEvent的用法示例。


在下文中一共展示了wxPropertyGridEvent::GetPropertyName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onPropertyChanging

void Properties::onPropertyChanging(wxPropertyGridEvent& event, Object* object)
{
	if (object)
	{
		if (event.GetPropertyName() == "Name")
		{
			object->setName(event.GetValue().GetString().c_str());
		}
		else if (event.GetPropertyName() == "Description")
		{
			object->setDescription(event.GetValue().GetString().c_str());
		}

		switch (object->getType())
		{
			case OT_BUILDING: onPropertyChanging(event, static_cast<Building*>(object)); break;
			case OT_JUNCTION: onPropertyChanging(event, static_cast<Junction*>(object)); break;
			case OT_PLANT: onPropertyChanging(event, static_cast<Plant*>(object)); break;
			case OT_ROUTE: onPropertyChanging(event, static_cast<Route*>(object)); break;
			case OT_WATER_OBJECT: onPropertyChanging(event, static_cast<WaterObject*>(object)); break;
		}

		City::getSingleton().updateViews(object);
	}
}
开发者ID:wojciech-holisz,项目名称:3d-city,代码行数:25,代码来源:Properties.cpp

示例2: OnPropertyGridChange

int ArchesModel::OnPropertyGridChange(wxPropertyGridInterface *grid, wxPropertyGridEvent& event) {
    if ("ArchesCount" == event.GetPropertyName()) {
        ModelXml->DeleteAttribute("parm1");
        ModelXml->AddAttribute("parm1", wxString::Format("%d", event.GetPropertyValue().GetLong()));
        SetFromXml(ModelXml, zeroBased);
        AdjustStringProperties(grid, parm1);
        return 3;
    } else if ("ArchesNodes" == event.GetPropertyName()) {
        ModelXml->DeleteAttribute("parm2");
        ModelXml->AddAttribute("parm2", wxString::Format("%d", event.GetPropertyValue().GetLong()));
        SetFromXml(ModelXml, zeroBased);
        return 3;
    } else if ("ArchesLights" == event.GetPropertyName()) {
        ModelXml->DeleteAttribute("parm3");
        ModelXml->AddAttribute("parm3", wxString::Format("%d", event.GetPropertyValue().GetLong()));
        SetFromXml(ModelXml, zeroBased);
        return 3;
    } else if ("ArchesArc" == event.GetPropertyName()) {
        ModelXml->DeleteAttribute("arc");
        ModelXml->AddAttribute("arc", wxString::Format("%d", event.GetPropertyValue().GetLong()));
        SetFromXml(ModelXml, zeroBased);
        return 3;
    } else if ("ArchesStart" == event.GetPropertyName()) {
        ModelXml->DeleteAttribute("Dir");
        ModelXml->AddAttribute("Dir", event.GetValue().GetLong() == 0 ? "L" : "R");
        SetFromXml(ModelXml, zeroBased);
        return 3;
    }

    return Model::OnPropertyGridChange(grid, event);
}
开发者ID:bagumondigi,项目名称:xLights,代码行数:31,代码来源:ArchesModel.cpp

示例3: OnPropertyChanged

bool ObjectsPropgridHelper::OnPropertyChanged(gd::Object * object, gd::Layout * layout, wxPropertyGridEvent& event)
{
    if ( !grid || !object ) return false;

    auto readEnumPropertyString = [&event](std::map<gd::String, gd::PropertyDescriptor> properties) {
        const std::vector<gd::String> & choices = properties[event.GetProperty()->GetLabel()].GetExtraInfo();

        unsigned int id = event.GetPropertyValue().GetLong();
        if (id < choices.size()) {
            return gd::String(choices[id]);
        }

        return gd::String("");
    };

    if ( event.GetPropertyName().substr(0,10) == "AUTO_PROP:" )
    {
        gd::String autoName = event.GetPropertyName().substr(10);
        if ( !object->HasBehaviorNamed(autoName))
        {
            event.Veto();
            return false;
        }

        gd::Behavior & behavior = object->GetBehavior(autoName);
        gd::String value = event.GetPropertyValue().GetString();

        //Special case for enums.
        if (wxEnumProperty * enumProperty = dynamic_cast<wxEnumProperty*>(event.GetProperty()))
            value = readEnumPropertyString(behavior.GetProperties(project));

        if (!behavior.UpdateProperty(event.GetProperty()->GetLabel(), value, project))
        {
            event.Veto();
            return false;
        }
    }
    else if ( event.GetPropertyName().substr(0,8) == "OBJ_PROP" )
    {
        gd::String value = event.GetPropertyValue().GetString();

        //Special case for enums.
        if (wxEnumProperty * enumProperty = dynamic_cast<wxEnumProperty*>(event.GetProperty()))
            value = readEnumPropertyString(object->GetProperties(project));

        if (!object->UpdateProperty(event.GetProperty()->GetLabel(), value, project))
        {
            event.Veto();
            return false;
        }
    }

    return false;
}
开发者ID:yecaokinux,项目名称:GD,代码行数:54,代码来源:ObjectsPropgridHelper.cpp

示例4: OnPropertyChanged

void ProjectPropertiesPnl::OnPropertyChanged(wxPropertyGridEvent& event)
{
    if (project) project->OnChangeInPropertyGrid(propertyGrid, event);

    if ( event.GetPropertyName() == _("Name of the project") && associatedTree != NULL)
        associatedTree->SetItemText(associatedTreeItem, event.GetProperty()->GetValue());

    if ( event.GetPropertyName() == _("Activate the use of C++ source files") && associatedProjectManager != NULL)
        associatedProjectManager->Refresh();

    if (project) project->SetDirty();
}
开发者ID:Slulego,项目名称:GD,代码行数:12,代码来源:ProjectPropertiesPnl.cpp

示例5: OnPropertyChanged

void LayoutEditorPropertiesPnl::OnPropertyChanged(wxPropertyGridEvent& event)
{
    if ( layoutEditorCanvas && displayInstancesProperties )
    {
        std::vector<InitialInstance*> selectedInitialInstances = layoutEditorCanvas->GetSelection();

        //In case "Custom size" property is checked, we do some extra work : Setting the custom width/height
        //of instances at their original width/height
        if ( event.GetPropertyName() == _("Custom size?") && grid->GetProperty(_("Custom size?"))->GetValue().GetBool() )
        {
            for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            {
                sf::Vector2f size = layoutEditorCanvas->GetInitialInstanceSize(*selectedInitialInstances[i]);
                selectedInitialInstances[i]->SetCustomWidth(size.x);
                selectedInitialInstances[i]->SetCustomHeight(size.y);
            }
        }

        instancesHelper.OnPropertyChanged(selectedInitialInstances, event);
    }
    if ( object )
    {
        if ( objectsHelper.OnPropertyChanged(object, &layout, event) ){
            wxCommandEvent refreshEvent(refreshEventType);
            wxPostEvent(grid, refreshEvent);
            //Refresh(); Can trigger a crash
        }
    }
}
开发者ID:HaoDrang,项目名称:GD,代码行数:29,代码来源:LayoutEditorPropertiesPnl.cpp

示例6: OnChange

//-----------------------------------------------------------------------------
void Property::OnChange (wxPropertyGridEvent &event)
{
	wxPGProperty *id = event.GetProperty();
	PX2_UNUSED(id);

	const wxString &name = event.GetPropertyName();
	std::string stdName = std::string(name);
	wxVariant variant = event.GetPropertyValue();

	if (name != wxString(mName.c_str()))
		return;

	if (variant.IsNull())
		return;

	if (!mData)
		return;

	if (mType == PT_INT)
	{
		*((int*)mData) = wxPGVariantToInt(variant);
	}
	else if (mType == PT_FLOAT)
	{
		double value = 0;
		wxPGVariantToDouble(variant, &value);
		*((float*)mData) = (float)value;
	}
	else if (mType == PT_BOOL)
	{
		bool value = (bool)(event.GetPropertyValueAsBool()!=0);
		*((bool*)mData) = value;
	}
	else if (mType == PT_BOOLCHECK)
	{
		bool value = (bool)(event.GetPropertyValueAsBool()!=0);
		*((bool*)mData) = value;
	}
	else if (PT_COLOR3FLOAT3 == mType)
	{
		wxString strColor = event.GetPropertyValueAsString();
		wxColor color = StringToColor(strColor);

		Float3 float3Color((float)color.Red()/255.0f, (float)color.Green()/255.0f,
			(float)color.Blue()/255.0f);

		*((Float3*)mData) = float3Color;
	}
	else if (PT_FLOAT3 == mType)
	{
		*((Float3*)mData) = Float3FromVariant(variant);
	}
	else if (mType == PT_STRING)
	{
		std::string value;
		wxString wxValue = event.GetPropertyValueAsString();
		value = std::string(wxValue.ToAscii());
		*((std::string*)mData) = value;
	}
}
开发者ID:ascetic85,项目名称:Phoenix3d,代码行数:61,代码来源:PX2Property.cpp

示例7: OnPropertyChanged

void ProjectWindow::OnPropertyChanged( wxPropertyGridEvent& evt )
{ 
   if (!mSelectedAssetDef || !mSelectedAsset)
      return;

   wxString name = evt.GetPropertyName();
   wxVariant val = evt.GetPropertyValue();
   wxString strVal = val.GetString();

   if (name.StartsWith("TextureAsset"))
   {
      long intVal = val.GetInteger();
      //strVal = mTextureAssetChoices.GetLabel(intVal);
   }

   // Set Value.
   mSelectedAsset->setDataField(Torque::StringTableLink->insert(name), NULL, strVal);

   // Save the asset
   mSelectedAsset->saveAsset();

   // Refresh textures if it's a MaterialAsset.
   if (mSelectedMaterialAsset)
      mSelectedMaterialAsset->loadTextures();

   // Refresh Scene.
   Torque::Scene.refresh();

   // Reload object properties.
   mAssetsInspector->Inspect(mSelectedAssetDef);
}
开发者ID:andr3wmac,项目名称:Torque6Editor,代码行数:31,代码来源:projectWindow.cpp

示例8: OnChange

//-----------------------------------------------------------------------------
void EMFloatProperty::OnChange (wxPropertyGridEvent &event)
{
	wxPGProperty *prop = event.GetProperty();
	const wxString &wxName = event.GetPropertyName();
	wxVariant var = prop->GetValue();

	if (var.IsNull())
		return;

	float fValue = (float)(var.GetDouble());

	if (mPropertyInVal == prop)
	{
		mPoint->InVal = fValue;
	}
	else if (mPropertyOutVal == prop)
	{
		mPoint->OutVal = fValue;
	}
	else if (mPropertyArriveTangent == prop)
	{
		mPoint->ArriveTangent = fValue;
	}
	else if (mPropertyLeaveTangent == prop)
	{
		mPoint->LeaveTangent = fValue;
	}
	else if (mInterpMode == prop)
	{
		int val = var.GetInteger();
		mPoint->InterpMode = (InterpCurveMode)val;
	}
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:34,代码来源:PX2EMFloatProperty.cpp

示例9: if

void
ObjectPropertyEditor::OnPropertyChanged(wxPropertyGridEvent& e)
{
    // Skip parent properties
    if (e.GetPropertyPtr()->GetParentingType() != 0)
        return;

    // Skip if no current selected object
    Fairy::ObjectPtr object = mCurrentObject.lock();
    if (!object)
        return;

    Ogre::String propertyName = AS_STRING(e.GetPropertyName());
    Ogre::String propertyValue = AS_STRING(e.GetPropertyValueAsString());

	if(propertyName == "position" || propertyName == "scale")
	{
		Ogre::Vector3 vValue = Ogre::StringConverter::parseVector3(propertyValue);
		object->setProperty(propertyName,vValue);
	}
	else if(propertyName == "orientation")
	{
		Ogre::Quaternion qValue = Ogre::StringConverter::parseQuaternion(propertyValue);
		object->setProperty(propertyName,qValue);
	}
	else if(propertyName == "actor name")
	{
		m_Frame->ClearAllSelectorObject();
		m_Frame->GetActorSettingEditor()->SetCurrentObject(Ogre::String(propertyValue.c_str()));
		return;
	}

    mPropertiesViewer->Freeze();

    const Fairy::PropertyList& properties = object->getProperties();
    for (Fairy::PropertyList::const_iterator it = properties.begin(); it != properties.end(); ++it)
    {
        const Fairy::PropertyDef& propertyDef = *it;
        Fairy::uint propertyFlags = object->getPropertyFlags(propertyDef.name);
        wxPGId id = mPropertiesViewer->GetPropertyByName(propertyDef.name.c_str());
        assert(id.IsOk());
        if (!id.IsOk())
            continue;
        if (propertyFlags & Fairy::PF_READONLY)
        {
            if (mPropertiesViewer->IsPropertyEnabled(id))
                mPropertiesViewer->DisableProperty(id);
        }
        else
        {
            if (!mPropertiesViewer->IsPropertyEnabled(id))
                mPropertiesViewer->EnableProperty(id);
        }
    }

    mPropertiesViewer->Thaw();
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:57,代码来源:ObjectPropertyEditor.cpp

示例10: On_PG_Changed

//---------------------------------------------------------
void CParameters_Control::On_PG_Changed(wxPropertyGridEvent &event)
{
	_Set_Parameter(event.GetPropertyName());

	if( event.GetProperty() )
	{
		m_pPG->SelectProperty(event.GetProperty());
	}

	event.Skip();
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:12,代码来源:parameters_control.cpp

示例11: OnPropsChange

void DlgViewports::OnPropsChange(wxPropertyGridEvent& e) {

	nau::render::Viewport *elem = RENDERMANAGER->getViewport(m_Active).get();
	const wxString& name = e.GetPropertyName();
	unsigned int dotLocation = name.find_first_of(wxT("."),0);
	std::string topProp = std::string(name.substr(0,dotLocation).mb_str());
	std::string prop = std::string(name.substr(dotLocation+1,name.size()-dotLocation-1).mb_str());

	PropertyManager::updateProp(m_PG, topProp, Viewport::GetAttribs(), (AttributeValues *)elem);
	notifyUpdate(PROPS_CHANGED,m_Active,topProp);
}
开发者ID:Nau3D,项目名称:nau,代码行数:11,代码来源:dlgViewports.cpp

示例12: OnPropsChange

void DlgScenes::OnPropsChange( wxPropertyGridEvent& e) {

	std::shared_ptr<IScene> &scene = RENDERMANAGER->getScene(m_Active);
	const wxString& name = e.GetPropertyName();
	unsigned int dotLocation = name.find_first_of(wxT("."), 0);
	std::string topProp = std::string(name.substr(0, dotLocation).mb_str());
	std::string prop = std::string(name.substr(dotLocation + 1, name.size() - dotLocation - 1).mb_str());

	PropertyManager::updateProp(m_PG, topProp, IScene::Attribs, (AttributeValues *)scene.get());

}
开发者ID:david-leal,项目名称:nau,代码行数:11,代码来源:dlgScenes.cpp

示例13: if

//-----------------------------------------------------------------------------
void EMFloat3Property::OnChange (wxPropertyGridEvent &event)
{
	wxPGProperty *prop = event.GetProperty();
	const wxString &wxName = event.GetPropertyName();
	wxVariant var = prop->GetValue();

	PX2_UNUSED(wxName);

	if (var.IsNull())
		return;

	if (mPropertyInVal == prop)
	{
		float fValue = (float)(var.GetDouble());

		mPoint->InVal = fValue;

		if (mPropertyInVal)
			mPropertyInVal->SetValue(fValue);
	}
	else if (mPropertyOutVal == prop)
	{
		if (mIsColor)
		{
			wxColor color =  wxANY_AS(var.GetAny(), wxColor);

			Float3 float3Color((float)color.Red()/255.0f, (float)color.Green()/255.0f,
				(float)color.Blue()/255.0f);

			mPoint->OutVal = float3Color;
		}
		else
		{
			mPoint->OutVal = Float3RefFromVariant(var);
		}
	}
	else if (mPropertyArriveTangent == prop)
	{
		mPoint->ArriveTangent = Float3RefFromVariant(var);
	}
	else if (mPropertyLeaveTangent == prop)
	{
		mPoint->LeaveTangent = Float3RefFromVariant(var);
	}
	else if (mInterpMode == prop)
	{
		int val = var.GetInteger();
		mPoint->InterpMode = (InterpCurveMode)val;
	}
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:51,代码来源:PX2EMFloat3Property.cpp

示例14: assert

void
ObjectPropertyEditor::OnPropertyChanged(wxPropertyGridEvent& e)
{
    // Skip parent properties
    if (e.GetPropertyPtr()->GetParentingType() != 0)
        return;

    // Skip if no current selected object
    WX::ObjectPtr object = mCurrentObject.lock();
    if (!object)
        return;

    WX::String propertyName = AS_STRING(e.GetPropertyName());
    WX::String propertyValue = AS_STRING(e.GetPropertyValueAsString());

    WX::Variant oldValue = object->getProperty(propertyName);
    object->setPropertyAsString(propertyName, propertyValue);
    mSceneManipulator->_fireObjectPropertyChanged(object, propertyName, this);
    WX::Variant newValue = object->getProperty(propertyName);

    WX::ModifyObjectPropertyOperator* op = new WX::ModifyObjectPropertyOperator(mSceneManipulator);
    op->add(object->getName(), propertyName, oldValue, newValue);
    mSceneManipulator->getOperatorManager()->addOperator(op);

    mPropertiesViewer->Freeze();

    const WX::PropertyList& properties = object->getProperties();
    for (WX::PropertyList::const_iterator it = properties.begin(); it != properties.end(); ++it)
    {
        const WX::PropertyDef& propertyDef = *it;
        WX::uint propertyFlags = object->getPropertyFlags(propertyDef.name);
        wxPGId id = mPropertiesViewer->GetPropertyByName(propertyDef.name.c_str());
        assert(id.IsOk());
        if (!id.IsOk())
            continue;
        if (propertyFlags & WX::PF_READONLY)
        {
            if (mPropertiesViewer->IsPropertyEnabled(id))
                mPropertiesViewer->DisableProperty(id);
        }
        else
        {
            if (!mPropertiesViewer->IsPropertyEnabled(id))
                mPropertiesViewer->EnableProperty(id);
        }
    }

    mPropertiesViewer->Thaw();
}
开发者ID:brock7,项目名称:TianLong,代码行数:49,代码来源:ObjectPropertyEditor.cpp

示例15: OnChange

//-----------------------------------------------------------------------------
void Property::OnChange (wxPropertyGridEvent &event)
{
	wxPGProperty *property = event.GetProperty();
	const wxString &name = event.GetPropertyName();
	std::string stdName = std::string(name);
	wxAny anyValue = property->GetValue();

	if (name != wxString(mName.c_str()))
		return;

	if (!mData)
		return;

	if (mType == PT_INT)
	{
		*((int*)mData) = wxANY_AS(anyValue, int);
	}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:18,代码来源:PX2Property.cpp


注:本文中的wxPropertyGridEvent::GetPropertyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。