次の方法で共有


IVsObjectList.GetCategoryField(UInt32, LIB_CATEGORY, UInt32) Method

Definition

Returns the value for the specified category for the given list item.

public:
 int GetCategoryField(System::UInt32 index, Microsoft::VisualStudio::Shell::Interop::LIB_CATEGORY Category, [Runtime::InteropServices::Out] System::UInt32 % pField);
int GetCategoryField(unsigned int index, Microsoft::VisualStudio::Shell::Interop::LIB_CATEGORY Category, [Runtime::InteropServices::Out] unsigned int & pField);
public int GetCategoryField (uint index, Microsoft.VisualStudio.Shell.Interop.LIB_CATEGORY Category, out uint pField);
abstract member GetCategoryField : uint32 * Microsoft.VisualStudio.Shell.Interop.LIB_CATEGORY * uint32 -> int
Public Function GetCategoryField (index As UInteger, Category As LIB_CATEGORY, ByRef pField As UInteger) As Integer

Parameters

index
UInt32

[in] Specifies the index of the list item of interest.

Category
LIB_CATEGORY

[in] Specifies the category of interest. Values are taken from the LIB_CATEGORY enumeration.

pField
UInt32

[out] Pointer to a variable holding the value returned.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::GetCategoryField(  
   [in] ULONG Index,  
   [in] LIB_CATEGORY Category,  
   [out,retval] DWORD* pField  
);  

The environment's object manager calls this method to retrieve the category data for the list items. You must return in the pField parameter an enumerator value from the LIB_* enums corresponding to the category specified in the Category parameter. The categories and their associated field enumerations are listed in the following table.

Category from LIB_CATEGORY LIBCAT_ enum
LC_MEMBERTYPE _LIBCAT_MEMBERTYPE
LC_MEMBERACCESS _LIBCAT_MEMBERACCESS
LC_CLASSTYPE _LIBCAT_CLASSTYPE
LC_CLASSACCESS _LIBCAT_CLASSACCESS
LC_ACTIVEPROJECT Unused.
LC_LISTTYPE (Special, see below) LIBCAT_LISTTYPE (typedef of _LIB_LISTTYPE)
LC_VISIBILITY _LIBCAT_VISIBILITY
LC_MODIFIER _LIBCAT_MODIFIERTYPE
LC_NODETYPE (Special, see below) _LIBCAT_NODETYPE

If the index parameter is NULINDEX, Category will be LC_LISTTYPE and the request is for the list as a whole, not a specific list item. This is asking for the child list types supported under this list. In this case you would assign pField one or more of the values from the _LIB_LISTTYPE enumeration. For instance, an LLT_CLASSES list may return LLT_CLASSES | LLT_MEMBERS to indicate that it supports classes and member lists. This does not, however, mean that every list item in this list supports both child lists.

Calling the GetCategoryField method with LC_LISTTYPE category is one way the environment determines if a node is expandable so it can indicate that a '+' symbol should be displayed in the object browser or class view tools. Since computing expandability of a node can be expensive for your library, the environment will first call GetExpandable. If that method fails, the environment will call GetCategoryField. Use GetExpandable2 if you can determine the expandable state of the list item much faster than fully enumerating all the supported lists under the given item.

Do not implement LC_NODETYPE for non-LLT_HIERARCHY lists. You can return LCNT_SYMBOL for LLT_HIERARCHY lists that are actually symbol lists, however.

Applies to