Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

wxPGId wxPropertyContainerMethods::ReplaceProperty ( wxPGId  id,
wxPGProperty property 
) [inherited]

Replaces property with id with newly created property. For example, this code replaces existing property named "Flags" with one that will have different set of items:

            pg->ReplaceProperty(wxT("Flags"),
                wxFlagsProperty(wxT("Flags"),wxPG_LABEL,newItems))

For more info, see wxPropertyGrid::Insert.

Definition at line 4524 of file propgrid.cpp.

References wxPropertyContainerMethods::Delete(), wxPropertyGridState::DoInsert(), wxPGProperty::GetIndexInParent(), wxPGProperty::GetParent(), wxPGProperty::GetParentingType(), and wxPGProperty::GetParentState().

{
    wxPG_PROP_ID_CALL_PROLOG_RETVAL(wxNullProperty)

    wxPGProperty* replaced = wxPGIdToPtr(id);
    wxCHECK_MSG( replaced && property,
                 wxNullProperty,
                 wxT("NULL property") );
    wxCHECK_MSG( replaced->GetParentingType() == 0 || replaced->GetParentingType() == -1,
                 wxNullProperty,
                 wxT("cannot replace this type of property") );
    wxCHECK_MSG( !m_pState->IsInNonCatMode(),
                 wxNullProperty,
                 wxT("cannot replace properties in alphabetic mode") );

    // Get address to the slot
    wxPGPropertyWithChildren* parent = replaced->GetParent();
    int ind = replaced->GetIndexInParent();

    wxPropertyGridState* state = replaced->GetParentState();
    Delete(replaced); // Must use generic Delete
    state->DoInsert(parent,ind,property);

    return wxPGIdGen(property);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index