Example #1
0
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);
}
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);
}
Example #3
0
void TweaksSettingsDlg::OnColourChanged(wxPropertyGridEvent& event)
{
    event.Skip();
    wxPGProperty* prop = event.GetProperty();
    CHECK_PTR_RET(prop);

    if ( prop == m_pgPropGlobalTabBG ) {
        // Global tab bg colour was modified
        wxColourPropertyValue cpv;
        cpv << prop->GetValue();
        m_settings.SetGlobalBgColour( cpv.m_colour );

    } else if ( prop == m_pgPropGlobalTabFG ) {
        // Global tab colour was modified
        wxColourPropertyValue cpv;
        cpv << prop->GetValue();
        m_settings.SetGlobalFgColour( cpv.m_colour );

    } else if ( prop->GetParent() ) {
        // project specific colour was changed
        wxColourPropertyValue cpv;
        cpv << prop->GetValue();

        if ( prop->GetLabel().Contains("text colour") ) {
            m_settings.GetProjectTweaks(prop->GetParent()->GetLabel()).SetTabFgColour( cpv.m_colour );

        } else if ( prop->GetLabel().Contains("background colour") ) {
            m_settings.GetProjectTweaks(prop->GetParent()->GetLabel()).SetTabBgColour( cpv.m_colour );

        }
    }
}
Example #4
0
void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) {
    if (!editId) {
        return;
    }
    SDRDeviceInfo *dev = getSelectedDevice(editId);
    if (editId && event.GetProperty() == devSettings["name"]) {
        DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
        
        wxString devName = event.GetPropertyValue().GetString();
        
        devConfig->setDeviceName(devName.ToStdString());
        if (editId) {
            devTree->SetItemText(editId, devConfig->getDeviceName());
        }
        if (devName == "") {
            event.GetProperty()->SetValueFromString(devConfig->getDeviceName());
        }
    }
    if (dev && event.GetProperty() == devSettings["offset"]) {
        DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
        
        long offset = event.GetPropertyValue().GetInteger();
        
        devConfig->setOffset(offset);
    }
}
//-----------------------------------------------------------------------------
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;
	}
}
Example #6
0
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);
	}
}
Example #7
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
PropertiesView::onPropertyGridChanging(wxPropertyGridEvent& _event)
{
    wxPGProperty* const pWXProperty = _event.GetProperty();

    // TODO Don't assume this is a string.
    std::string newValue = wx2std(_event.GetValue().GetString());

    if (pWXProperty->GetClientData() != NULL)
    {
        I_Property* pProperty = static_cast<I_Property*>(pWXProperty->GetClientData());

        assert(pProperty != NULL);

        if (!pProperty->getPublisher().getController().canChangeProperty(*pProperty, newValue))
        {
            // Veto the event.
            _event.Veto();

            // Set the validation failure behavior.
            _event.SetValidationFailureBehavior(wxPG_VFB_STAY_IN_PROPERTY
                //| wxPG_VFB_BEEP
                //| wxPG_VFB_SHOW_MESSAGE
                );
        }
    }
}
Example #8
0
void Properties::onPropertyChanging(wxPropertyGridEvent& event, Database* database)
{
	if (event.GetPropertyName() == "Name")
	{
		database->setName(event.GetValue().GetString().c_str());
	}
}
void EntityPropertyGridPage::propertyChange(wxPropertyGridEvent& event)
{
	wxPGId id = event.GetProperty();
	if(id == mDisplaySkeleton)
	{
		mEntity->setDisplaySkeleton(event.GetPropertyValueAsBool());
	}
}
///////////////////////////////////////////////////////////////////////////////
///
///	Wird aufgerufen, wenn der Benutzer eine Property geändert hat.
///
///	@param ev	PropertyGrid-Event
///
///////////////////////////////////////////////////////////////////////////////
void PropertyGridControllerMotionCapture::OnPropertyChanged(wxPropertyGridEvent& ev)
{
	if(ev.GetProperty()->GetName().compare("Name") == 0)
	{
		wxString newName = ev.GetProperty()->GetValueAsString();
		motionCapture->SetName(newName.c_str());
	}
}
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();
}
Example #12
0
void wxPropertyGridManager::OnPropertyGridSelect( wxPropertyGridEvent& event )
{
    // Check id.
    wxASSERT_MSG( GetId() == m_pPropGrid->GetId(),
        wxT("wxPropertyGridManager id must be set with wxPropertyGridManager::SetId (not wxWindow::SetId).") );

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

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

	event.Skip();
}
void MaterialPropertyGridPage::propertyChange(wxPropertyGridEvent& event)
{
	wxPGId id = event.GetProperty();
	if(id == mReceiveShadowsId)
	{
		mMaterial->setReceiveShadows(event.GetPropertyValueAsBool());
	}
	else if(id == mTransparencyShadowsId)
	{
		mMaterial->setTransparencyCastsShadows(event.GetPropertyValueAsBool());
	}
}
Example #15
0
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();
}
Example #16
0
void Properties::onPropertyChanging(wxPropertyGridEvent& event, Map* map)
{
	if (event.GetPropertyName() == "Name")
	{
		map->setName(event.GetValue().GetString().c_str());
	}
	else if (event.GetPropertyName() == "Texture")
	{
		map->setTexture(wxFileNameFromPath(event.GetValue().GetString()).c_str());
	}

	City::getSingleton().updateViews(map);
}
Example #17
0
void Properties::onPropertyChanging(wxPropertyGridEvent& event, RouteView* view)
{
	if (event.GetPropertyName() == "Segments")
	{
		unsigned short value = (unsigned short)event.GetValue().GetLong();

		if (value < view->getRoute()->getPointCount())
		{
			value = view->getRoute()->getPointCount();
		}

		view->setSegments(value);
	}
}
//-----------------------------------------------------------------------------
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;
	}
}
Example #19
0
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();
}
Example #20
0
bool EditorChoiceWindowT::HandlePGChange(wxPropertyGridEvent& Event, GuiEditor::ChildFrameT* ChildFrame)
{
    if (EditorWindowT::HandlePGChange(Event, ChildFrame)) return true;

    const wxPGProperty* Prop    =Event.GetProperty();
    const wxString      PropName=Prop->GetName();

    if (PropName=="Choices")
    {
        ArrayT<std::string> NewStrings;
        wxStringTokenizer   Tokenizer(Prop->GetValueAsString(), "\r\n");

        while (Tokenizer.HasMoreTokens())
            NewStrings.PushBack(std::string(Tokenizer.GetNextToken()));

        ChildFrame->SubmitCommand(new CommandSetWinPropT< ArrayT<std::string> >(m_GuiDoc, this, PropName, m_Choice->m_Choices, NewStrings));
        return true;
    }

    if (PropName=="DefaultChoice")
    {
        wxASSERT(m_Choice->GetMemberVar("selectedChoice").Member!=NULL);

        ChildFrame->SubmitCommand(new CommandModifyWindowT(m_GuiDoc, m_Choice, PropName, m_Choice->GetMemberVar("selectedChoice"), Prop->GetValue().GetLong()));
        return true;
    }

    return false;
}
void rePropertyInspector::OnPropertyValueChanged(wxPropertyGridEvent& event){
	
	wxPGProperty* property = event.GetProperty();
	wxStringClientData* propertyInfo = static_cast<wxStringClientData*>(property->GetClientObject());
	wxStringTokenizer tokenizer(propertyInfo->GetData(), ":");
	wxString propertyType = tokenizer.GetNextToken();
	wxString propertyName = tokenizer.GetNextToken();

	wxAny anyVal;

	if (propertyType == "vector3"){
		wxVariant x = GetProperty(propertyName + ".x")->GetValue();
		wxVariant y = GetProperty(propertyName + ".y")->GetValue();
		wxVariant z = GetProperty(propertyName + ".z")->GetValue();

		rVector3 vec3(x.GetDouble(), y.GetDouble(), z.GetDouble());

		anyVal = vec3;
	}
	else if (propertyType == "color"){
		wxAny colorVal = property->GetValue();
		wxColor cpv = colorVal.As<wxColor>();
		rColor c(cpv.Red(), cpv.Green(), cpv.Blue(), cpv.Alpha());

		anyVal = c;
	}
	else if (propertyType == "int" || propertyType == "float" || propertyType == "string" || propertyType == "bool"){
		anyVal = property->GetValueAsString();
	}

	m_component->SubmitCommand(new reSetPropertyCommand(m_actorName, propertyName, anyVal, m_component));
}
Example #22
0
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
        }
    }
}
void VisualizationPanel::onPropertySelected( wxPropertyGridEvent& event )
{
  wxPGProperty* pg_property = event.GetProperty();

  selected_display_ = NULL;

  if ( !pg_property )
  {
    return;
  }

  void* client_data = pg_property->GetClientData();
  if ( client_data )
  {
    PropertyBase* property = reinterpret_cast<PropertyBase*>(client_data);

    void* user_data = property->getUserData();
    if ( user_data )
    {
      Display* display = reinterpret_cast<Display*>(user_data);

      if ( manager_->isValidDisplay( display ) )
      {
        selected_display_ = display;
      }
    }
  }
}
//------------------------------------------------------------------------
// 
//------------------------------------------------------------------------
void CPropertyWindow::OnPropertyGridSelect( wxPropertyGridEvent& event )
{
	SetFocus();

	wxPGProperty* pProp = event.GetProperty();
	RET(!pProp);
	wxString name = pProp->GetName();

	SPropItem *pItemData = (SPropItem*)pProp->GetClientData();
	if (pItemData && pItemData->typeData.vt == VT_EMPTY &&
		pProp->GetChildCount() <= 0)
	{
		IDiaSymbol *pSym = dia::FindType(pItemData->symbolTypeName);
		if (!pSym)
			return;

		DWORD ptr = (DWORD)pItemData->typeData.ptr;
		if (SymTagPointerType == pItemData->typeData.symtag)
			ptr = visualizer::Point2PointValue((DWORD)pItemData->typeData.ptr);

		SSymbolInfo symbol( pSym, memmonitor::SMemInfo("*", (void*)ptr, 0) );
		visualizer::MakePropertyChild_DefaultForm( visualizer::SVisDispDesc(this,pProp), symbol, true, 2 );

			
		//if (!FindSymbolUpward( pProp, &symbol ))
		//	return;
		//if (visualizer::MakePropertyChild_DefaultForm( this, pProp, symbol))
		//{
			//pProp->Expand();
			//AdjustLayout();
		//}
	}
}
//-----------------------------------------------------------------------------
void UIPicBoxPropGrid::OnPropertyGridChange (wxPropertyGridEvent &event)
{
	ObjectPropertyGrid::OnPropertyGridChange(event);

	wxPGProperty *prop = event.GetProperty();
	if (prop->GetName() == PX2_LM.GetValue("Color"))
	{
		mUIPicBox->SetColor(mColor);
	}
	else if (prop->GetName() == PX2_LM.GetValue("Alpha01"))
	{
		mUIPicBox->SetAlpha(mAlpha);
	}
	else if (prop->GetName() == PX2_LM.GetValue("AnchorX")
		|| prop->GetName() == PX2_LM.GetValue("AnchorZ"))
	{
		mUIPicBox->SetAnchorPoint(mAnchorPoint);
	}
	else if (prop->GetName() == PX2_LM.GetValue("Width"))
	{
		mUIPicBox->SetWidth(mWidth);
	}
	else if (prop->GetName() == PX2_LM.GetValue("Height"))
	{
		mUIPicBox->SetHeight(mHeight);
	}
	else if (prop->GetName() == PX2_LM.GetValue("DoubleSide"))
	{
		mUIPicBox->SetDoubleSide(mIsDoubleSide);
	}
}
void TechniquePropertyGridPage::propertyChanged(wxPropertyGridEvent& event)
{
	wxPGId id = event.GetProperty();
	if(id == mNameId)
	{
		mController->setName(event.GetPropertyValueAsString().c_str());
	}
	else if(id == mSchemeNameId)
	{
		mController->setSchemeName(event.GetPropertyValueAsString().c_str());
	}
	else if(id = mLodIndexId)
	{
		mController->setLodIndex(event.GetPropertyValueAsInt());
	}
}
Example #27
0
//-----------------------------------------------------------------------------
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);
	}
Example #28
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
PropertiesView::onPropertyGridChanged(wxPropertyGridEvent& _event)
{
    wxPGProperty* const pWXProperty = _event.GetProperty();

    // TODO Don't assume this is a string.
    std::string newValue = wx2std(_event.GetProperty()->GetValueAsString());

    if (pWXProperty->GetClientData() != NULL)
    {
        I_Property* pProperty = static_cast<I_Property*>(pWXProperty->GetClientData());

        assert(pProperty != NULL);

        pProperty->getPublisher().getController().setPropertyValue(*pProperty, newValue);
    }
}
Example #29
0
//-----------------------------------------------------------------------------
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;
	}
}
void CPropertiesCanvas::OnPropertyGridSelect( wxPropertyGridEvent& event ) {
	wxPGProperty* p = event.GetPropertyPtr();

	Property* property = GetProperty(p);
	if(property == NULL)return;

	if(property->m_selectcallback)
		(*(property->m_selectcallback))(((PropertyChoice*)property)->m_object);
}