Udostępnij za pośrednictwem


Drop-down Bar

The drop-down bar is provided at the top of the code window and contains two drop-down lists.

In Visual C++, for example, the drop-down bar contains lists for Visual C++ Items and Visual C++ Items Member Functions, as shown in the following picture.

Drop-down bar

Drop-down Bars

When implementing a drop-down bar, there are four interfaces of primary importance:

  • IVsDropdownBarClient

    Implement this interface to insert the content of the drop-down bar. Each drop-down combination can contain plain text or fancy text (bold, underline, or italic), can have window text font coloring or grayed out font coloring, and can optionally provide a small bitmap next to the drop-down item. Similar to the IVsCompletionSet interface, bitmap images are provided in image lists. Each drop-down combination can have a different image list; however, each image list must contain images of the same height. Additionally, using the GetComboTipText method, you can provide a tooltip for each combination.

  • IVsDropdownBarManager

    Call this interface to either create or destroy the drop-down bar for a code window. This interface can also be used to determine whether a drop-down bar is already attached to a code window by calling the GetDropdownBar method. Call QueryInterface for IVsDropdownBarManager from IVsCodeWindow.

  • IVsDropdownBar

    Call this interface to communicate directly with the drop-down bar. You can use this interface to force a refresh of the drop-down bar contents or to change the selection in one of the list boxes.

  • IVsTextManagerEvents

    If you have registered the ShowDropdownBarOption in your language service registry key, then your code window manager must monitor this event to synchronize with user preferences regarding whether the drop-down bar should be displayed. If you do not register this option in your language service key, then the option to show or hide the drop-down bar is disabled on the Options menu.

Attaching a Drop-Down Bar to a Code Window

To attach a drop-down bar to the code window when it is created, a language service should attach to the drop-down bar when the AddAdornments method is called. If a call to the GetDropdownBar method indicates that a drop-down bar does not already exist, then call AddDropdownBar. To access the IVsDropdownBarManager interface, call QueryInterface from the IVsCodeWindow pointer returned to you when your IVsCodeWindowManager implementation was attached.

See Also

Concepts

Customizing Code Windows by Using the Legacy API

Support for the Navigation Bar (Managed Package Framework)