本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例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();
}
示例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
}
}
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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();
}
示例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();
}
示例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);
}
示例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());
}
示例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;
}
}
示例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();
}
示例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);
}