VST 3 Interfaces: IComponentHandler3 Class Reference
Author: Steinberg

VST 3 Interfaces VST 3.7 SDK for developing VST plug-in

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
IComponentHandler3 Class Referenceabstract

Extended host callback interface Vst::IComponentHandler3 for an edit controller. More...

`#include <ivstcontextmenu.h>`

Inheritance diagram for IComponentHandler3:

## Public Member Functions
virtual IContextMenu * | createContextMenu (IPlugView *plugView, const ParamID *paramID)=0
| Creates a host context menu for a plug-in:
Public Member Functions inherited from FUnknown
virtual tresult | queryInterface (const TUID _iid, void **obj)=0
virtual uint32 | addRef ()=0
virtual uint32 | release ()=0

## Static Public Attributes
static const FUID | iid
Static Public Attributes inherited from FUnknown
static const FUID | iid

## Detailed Description

Extended host callback interface Vst::IComponentHandler3 for an edit controller.

- [host imp]
- [extends IComponentHandler]
- [released: 3.5.0]
- [optional]

A plug-in can ask the host to create a context menu for a given exported parameter ID or a generic context menu.
The host may pre-fill this context menu with specific items regarding the parameter ID like "Show automation for parameter", "MIDI learn" etc...
The plug-in can use the context menu in two ways :

- add its own items to the menu via the IContextMenu interface and call IContextMenu::popup(..) to create the pop-up. See the Examples.
- extract the host menu items and add them to a context menu created by the plug-in.

Note: You can and should use this even if you do not add your own items to the menu as this is considered to be a big user value.

See also
  IContextMenu
  IContextMenuTarget

# Examples

- For example, Cubase adds its owned entries in the context menu opened with right-click on an exported parameter when the plug-in uses createContextMenu.
  \n
- Adding plug-in specific items to the context menu:

//------------------------------------------------------------------------
class PluginContextMenuTarget : public IContextMenuTarget, public FObject
{
public:
PluginContextMenuTarget () {}
tresult PLUGIN_API executeMenuItem (int32 tag) override
{
// this will be called if the user has executed one of the menu items of the plug-in.
// It will not be called for items of the host.
switch (tag)
{
case 1: break;
case 2: break;
}
return kResultTrue;
}
OBJ_METHODS(PluginContextMenuTarget, FObject)
DEFINE_INTERFACES
DEF_INTERFACE (IContextMenuTarget)
END_DEFINE_INTERFACES (FObject)
REFCOUNT_METHODS(FObject)
};
// The following is the code to create the context menu
void popupContextMenu (IComponentHandler* componentHandler, IPlugView* view, const ParamID* paramID,
UCoord x, UCoord y)
{
if (componentHandler == 0 || view == 0)
return;
FUnknownPtr<IComponentHandler3> handler (componentHandler);
if (handler == 0)
return;
if (IContextMenu* menu = handler->createContextMenu (view, paramID))
{
// here you can add your entries (optional)
PluginContextMenuTarget* target = new PluginContextMenuTarget ();
IContextMenu::Item item = {0};
UString128 ("My Item 1").copyTo (item.name, 128);
item.tag = 1;
menu->addItem (item, target);
UString128 ("My Item 2").copyTo (item.name, 128);
item.tag = 2;
menu->addItem (item, target);
target->release ();
//--end of adding new entries
// here the the context menu will be pop-up (and it waits a user interaction)
menu->popup (x, y);
menu->release ();
}
}
Steinberg::UString::copyTo
const UString & copyTo(char16 *dst, int32 dstSize) const
Steinberg::Vst::IContextMenuTarget
Context Menu Item Target interface: Vst::IContextMenuTarget.
Definition ivstcontextmenu.h:155
Steinberg::Vst::IContextMenuTarget::executeMenuItem
virtual tresult executeMenuItem(int32 tag)=0
Called when an menu item was executed.
Steinberg::Vst::IContextMenu::Item
IContextMenuItem Item
Definition ivstcontextmenu.h:199
Steinberg::Vst::ParamID
uint32 ParamID
parameter identifier: value in range [0, 0x7FFFFFFF].
Definition vsttypes.h:90
Steinberg::Vst::UMP::handler
__inline__ const uint32_t const IUniversalMidiPacketHandler & handler
Steinberg::kResultTrue
kResultTrue
Steinberg::tresult
int32 tresult
Steinberg::UString128
UStringBuffer< 128 > UString128
Steinberg::int32
int32_t int32
Steinberg::UCoord
int32 UCoord

## Member Function Documentation

## ◆ createContextMenu()

virtual IContextMenu * createContextMenu | ( | IPlugView * | plugView,
|  | const ParamID * | paramID )
| pure virtual

Creates a host context menu for a plug-in:

- If paramID is zero, the host may create a generic context menu.
- The IPlugView object must be valid.
- The return IContextMenu object needs to be released afterwards by the plug-in.

Note
  [UI-thread & (Initialized | Connected) & plugView]

## Member Data Documentation

## ◆ iid

const FUID iid
| static

Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.