Пример #1
0
int PHPOutlineTree::GetImageId(PHPEntityBase::Ptr_t entry)
{
    BitmapLoader* bmpLoader = clGetManager()->GetStdIcons();
    if(entry->Is(kEntityTypeFunction)) {
        PHPEntityFunction* func = entry->Cast<PHPEntityFunction>();

        if(func->HasFlag(kFunc_Private))
            return bmpLoader->GetImageIndex(BitmapLoader::kFunctionPrivate);
        else if(func->HasFlag(kFunc_Protected))
            return bmpLoader->GetImageIndex(BitmapLoader::kFunctionProtected);
        else
            // public
            return bmpLoader->GetImageIndex(BitmapLoader::kFunctionPublic);

    } else if(entry->Is(kEntityTypeVariable)) {
        PHPEntityVariable* var = entry->Cast<PHPEntityVariable>();
        if(!var->IsMember() && !var->IsConst()) {
            // A global variale
            return bmpLoader->GetImageIndex(BitmapLoader::kMemberPublic);

        } else if(var->IsMember()) {
            if(var->HasFlag(kVar_Const)) return bmpLoader->GetImageIndex(BitmapLoader::kConstant); // constant
            // Member
            if(var->HasFlag(kVar_Private))
                return bmpLoader->GetImageIndex(BitmapLoader::kMemberPrivate);
            else if(var->HasFlag(kVar_Protected))
                return bmpLoader->GetImageIndex(BitmapLoader::kMemberProtected);
            else
                return bmpLoader->GetImageIndex(BitmapLoader::kMemberPublic);

        } else if(var->IsConst()) {
            // Constant
            return bmpLoader->GetImageIndex(BitmapLoader::kConstant);
        } else {
            return bmpLoader->GetImageIndex(BitmapLoader::kMemberPublic);
        }

    } else if(entry->Is(kEntityTypeNamespace)) {
        // Namespace
        return bmpLoader->GetImageIndex(BitmapLoader::kNamespace);
    } else if(entry->Is(kEntityTypeClass)) {
        return bmpLoader->GetImageIndex(BitmapLoader::kClass);
    }
    return wxNOT_FOUND; // Unknown
}
Пример #2
0
int PHPFileLayoutTree::GetImageId(PHPEntityBase::Ptr_t entry)
{
    if(entry->Is(kEntityTypeFunction)) {
        PHPEntityFunction* func = entry->Cast<PHPEntityFunction>();

        if(func->HasFlag(kFunc_Private))
            return 1;
        else if(func->HasFlag(kFunc_Protected))
            return 2;
        else
            // public
            return 3;

    } else if(entry->Is(kEntityTypeVariable)) {
        PHPEntityVariable* var = entry->Cast<PHPEntityVariable>();
        if(!var->IsMember() && !var->IsConst()) {
            // A global variale
            return 6;

        } else if(var->IsMember()) {
            if(var->HasFlag(kVar_Const)) return 9; // constant
            // Member
            if(var->HasFlag(kVar_Private))
                return 4;
            else if(var->HasFlag(kVar_Protected))
                return 5;
            else
                return 6;

        } else if(var->IsConst()) {
            // Constant
            return 9;
        } else {
            return 6;
        }

    } else if(entry->Is(kEntityTypeNamespace)) {
        // Namespace
        return 7;
    } else if(entry->Is(kEntityTypeClass)) {
        return 8;
    }
    return -1; // Unknown
}