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


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

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


在下文中一共展示了wxPropertyGridEvent::GetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: assert

//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
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
                );
        }
    }
}
开发者ID:SgtFlame,项目名称:indiezen,代码行数:28,代码来源:PropertiesView.cpp

示例3: 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

示例4: OnPropertyGridChanging

void ChannelInspectorT::OnPropertyGridChanging(wxPropertyGridEvent& Event)
{
    if (m_ModelDoc==NULL) return;

    const ArrayT<unsigned int>& Selection=m_ModelDoc->GetSelection(CHAN);
    if (Selection.Size()!=1) return;

    // Changing a property by pressing ENTER doesn't change the selection. In consequence the property refresh below does not result in
    // any change since selected properties are not updated (because the user could be in the process of editing a value).
    // Since the user is definitely finished editing this property we can safely clear the selection.
    // ClearSelection();

    const unsigned int ChanNr  =Selection[0];
    const wxString     PropName=Event.GetPropertyName();

    m_IsRecursiveSelfNotify=true;
    bool ok=true;

    if (PropName=="Name")
    {
        ok=m_Parent->SubmitCommand(new CommandRenameT(m_ModelDoc, CHAN, ChanNr, Event.GetValue().GetString()));
    }
    else if (PropName.StartsWith("Joints."))
    {
        ok=m_Parent->SubmitCommand(new CommandUpdateChannelT(m_ModelDoc, ChanNr, Event.GetProperty()->GetIndexInParent(), Event.GetValue().GetBool()));
    }
    else
    {
        // Changing child properties (e.g. "Pos.x" to "5") also generates events for the composite parent (e.g. "Pos" to "(5, 0, 0)")!
        // That is, if the following line is uncommented, it produces false warnings as well:
        // wxMessageBox("Unknown property label \""+Name+"\".", "Warning", wxOK | wxICON_ERROR);
    }

    wxASSERT(Event.CanVeto());    // EVT_PG_CHANGING events can be vetoed (as opposed to EVT_PG_CHANGED events).
    if (!ok) Event.Veto();
    m_IsRecursiveSelfNotify=false;
}
开发者ID:mark711,项目名称:Cafu,代码行数:37,代码来源:ChannelInspector.cpp

示例5: OnPropertyChanged

void InitialInstancesPropgridHelper::OnPropertyChanged(const std::vector<gd::InitialInstance*> & selectedInitialInstances, wxPropertyGridEvent& event)
{
    if ( grid == NULL ) return;
    if ( selectedInitialInstances.empty() ) return;

    if ( event.GetPropertyName() == "INSTANCE_CUSTOM_SIZE" )
    {
        bool hasCustomSize = grid->GetProperty("INSTANCE_CUSTOM_SIZE")->GetValue().GetBool();

        grid->EnableProperty("INSTANCE_CUSTOM_SIZE.INSTANCE_SIZE_WIDTH", hasCustomSize);
        grid->EnableProperty("INSTANCE_CUSTOM_SIZE.INSTANCE_SIZE_HEIGHT", hasCustomSize);

        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetHasCustomSize(hasCustomSize);
    }
    else if ( event.GetPropertyName() == "INSTANCE_CUSTOM_SIZE.INSTANCE_SIZE_WIDTH" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetCustomWidth(event.GetValue().GetReal());
    }
    else if ( event.GetPropertyName() == "INSTANCE_CUSTOM_SIZE.INSTANCE_SIZE_HEIGHT" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetCustomHeight(event.GetValue().GetReal());
    }
    else if ( event.GetPropertyName() == "INSTANCE_X" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetX(event.GetValue().GetReal());
    }
    else if ( event.GetPropertyName() == "INSTANCE_Y" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetY(event.GetValue().GetReal());
    }
    else if ( event.GetPropertyName() == "INSTANCE_ANGLE" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetAngle(event.GetValue().GetReal());
    }
    else if ( event.GetPropertyName() == "INSTANCE_Z" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetZOrder(event.GetValue().GetInteger());
    }
    else if ( event.GetPropertyName() == "INSTANCE_LAYER" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetLayer(event.GetValue().GetString());
    }
    else if ( event.GetPropertyName() == "INSTANCE_LOCKED" )
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
            selectedInitialInstances[i]->SetLocked(event.GetValue().GetBool());
    }
    else
    {
        for (std::size_t i = 0;i<selectedInitialInstances.size();++i)
        {
            selectedInitialInstances[i]->UpdateCustomProperty(event.GetPropertyName(),
                                                              event.GetValue().GetString(),
                                                              project, layout);
        }
    }
}
开发者ID:HaoDrang,项目名称:GD,代码行数:65,代码来源:InitialInstancesPropgridHelper.cpp

示例6: OnPropertyChanging

void PropertyPane::OnPropertyChanging(wxPropertyGridEvent &event)
{
    wxPGProperty *prop = event.GetProperty();
    wxVariant value = event.GetValue();
    wxString sqlQuery, sqlUpdate, type, format, minStr, maxStr;
    long min, max, requestedValue;

    // event.GetValue() is always numeric base wxVariant.
    // Use wxPGProperty::ValueToString(wxVariant& value, int argFlags = 0) to
    // retrieve the string based property value for any kind of wxYYYProperty.
    if (prop && _propDB)
    {
        wxLogVerbose(wxT("OnPropertyChanging %s"), prop->ValueToString(value));
        sqlQuery << wxT("SELECT PropertyType, PropertyFormat FROM PropTbl WHERE DisplayedName = '")
            << prop->GetLabel()
            << wxT("'");
        wxSQLite3ResultSet set = _propDB->ExecuteQuery(sqlQuery);
        if (set.NextRow())
        {
            type = set.GetAsString(wxT("PropertyType"));
            format = set.GetAsString(wxT("PropertyFormat"));
        }
        set.Finalize();

        /* property format checker */
        if (type == wxT("Numeric"))
        {
            wxStringTokenizer tokenizer(format, wxT(";"));
            minStr = tokenizer.GetNextToken();
            maxStr = tokenizer.GetNextToken();
            if (minStr.ToLong(&min) && maxStr.ToLong(&max))
            {
                requestedValue = value.GetLong();
                if ((requestedValue < min) || (requestedValue > max))
                {
                    event.Veto();
                    wxLogError(_("Input number out of range! Max = %s, Min = %s"),
                        maxStr, minStr);
                    return;
                }
            }
        }
        else if (type == wxT("List"))
        {
            /* no check item now. */
        }
        else if (type == wxT("String"))
        {
            // TODO: check for max length
        }

        /* update database record */
        _pgUpdatedFromUI = true;
        sqlUpdate << wxT("UPDATE PropTbl SET CurrentValue = '")
            << prop->ValueToString(value)
            << wxT("' WHERE DisplayedName = '")
            << prop->GetLabel()
            << wxT("'");
        if (_propDB->ExecuteUpdate(sqlUpdate) != 1)
        {
            wxLogError(_("Failed to update property %s"), prop->GetLabel());
            event.Veto();
        }
    }
}
开发者ID:mihazet,项目名称:my-test-apps,代码行数:65,代码来源:PropertyPane.cpp


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