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

wxPGValueType * wxPropertyGrid::RegisterValueType ( wxPGValueType valueclass,
bool  noDefCheck = false,
const wxString &  className = wxEmptyString 
) [static]

Registers a new value type. Takes ownership of the object.

Return values:
Pointerto the value type that should be used. If on with the same name already existed, then the first one will be used, and its pointer is returned instead.

Definition at line 10668 of file propgrid.cpp.

References wxPGValueType::GetType().

{
    wxASSERT( valueclass );

    WX_PG_GLOBALS_LOCKER()

    if ( !noDefCheck && wxPGGlobalVars->m_dictValueType.empty() )
        RegisterDefaultValues();

    wxString temp_str;
    wxPG_CONST_WXCHAR_PTR name_ = valueclass->GetType();
    const wxChar* name = wxPG_TO_WXCHAR_PTR(name_);

    wxPGValueType* p_at_slot = (wxPGValueType*) wxPGGlobalVars->m_dictValueType[name];

    if ( !p_at_slot )
    {
        wxPGGlobalVars->m_dictValueType[name] = (void*) valueclass;

    #if wxPG_VALUETYPE_IS_STRING
        wxPGGlobalVars->m_dictValueTypeByClass[className] = (void*) valueclass;
    #else
        wxUnusedVar(className);
    #endif

        return valueclass;
    }

    // Delete given object instance, but only if it wasn't the same as in the hashmap.
    if ( p_at_slot != valueclass )
    {
        delete valueclass;
    }

    return p_at_slot;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index