Interface Technology Basics: IPlugView Class Reference
Author: Steinberg

Interface Technology Basics VST 3.8 SDK for developing VST plug-in

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
IPlugView Class Referenceabstract
Graphical User Interface

Plug-in definition of a view. More...

`#include <iplugview.h>`

Inheritance diagram for IPlugView:

## Public Member Functions
virtual tresult | isPlatformTypeSupported (FIDString type)=0
| Is Platform UI Type supported.
virtual tresult | attached (void *parent, FIDString type)=0
| The parent window of the view has been created, the (platform) representation of the view should now be created as well.
virtual tresult | removed ()=0
| The parent window of the view is about to be destroyed.
virtual tresult | onWheel (float distance)=0
| Handling of mouse wheel.
virtual tresult | onKeyDown (char16 key, int16 keyCode, int16 modifiers)=0
| Handling of keyboard events : Key Down.
virtual tresult | onKeyUp (char16 key, int16 keyCode, int16 modifiers)=0
| Handling of keyboard events : Key Up.
virtual tresult | getSize (ViewRect *size)=0
| Returns the size of the platform representation of the view.
virtual tresult | onSize (ViewRect *newSize)=0
| Resizes the platform representation of the view to the given rect.
virtual tresult | onFocus (TBool state)=0
| Focus changed message.
virtual tresult | setFrame (IPlugFrame *frame)=0
| Sets IPlugFrame object to allow the plug-in to inform the host about resizing.
virtual tresult | canResize ()=0
| Is view sizable by user.
virtual tresult | checkSizeConstraint (ViewRect *rect)=0
| On live resize this is called to check if the view can be resized to the given rect, if not adjust the rect to the allowed size.
Public Member Functions inherited from FUnknown
virtual tresult | queryInterface (const TUID _iid, void **obj)=0
| Query for a pointer to the specified interface.
virtual uint32 | addRef ()=0
| Adds a reference and returns the new reference count.
virtual uint32 | release ()=0
| Releases a reference and returns the new reference count.

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

## Detailed Description

Plug-in definition of a view.

- [plug imp]
- [released: 3.0.0]

Coordinates
  The coordinates utilized within the ViewRect are native to the view system of the parent type. This implies that on macOS (kPlatformTypeNSView), the coordinates are expressed in logical units (independent of the screen scale factor), whereas on Windows (kPlatformTypeHWND) and Linux (kPlatformTypeX11EmbedWindowID), the coordinates are expressed in physical units (pixels).

Sizing of a view
  Usually, the size of a plug-in view is fixed. But both the host and the plug-in can cause a view to be resized:
  - Host: If IPlugView::canResize () returns kResultTrue the host will set up the window so that the user can resize it. While the user resizes the window, IPlugView::checkSizeConstraint () is called, allowing the plug-in to change the size to a valid a valid supported rectangle size. The host then resizes the window to this rect and has to call IPlugView::onSize ().
  - Plug-in: The plug-in can call IPlugFrame::resizeView () and cause the host to resize the window.
    Afterwards, in the same callstack, the host has to call IPlugView::onSize () if a resize is needed (size was changed). Note that if the host calls IPlugView::getSize () before calling IPlugView::onSize () (if needed), it will get the current (old) size not the wanted one!!
    Here the calling sequence:
    - plug-in->host: IPlugFrame::resizeView (newSize)
    - host->plug-in (optional): IPlugView::getSize () returns the currentSize (not the newSize!)
    - host->plug-in: if newSize is different from the current size: IPlugView::onSize (newSize)
    - host->plug-in (optional): IPlugView::getSize () returns the newSize
      Please only resize the platform representation of the view when IPlugView::onSize () is called.

Keyboard handling
  The plug-in view receives keyboard events from the host. A view implementation must not handle keyboard events by the means of platform callbacks, but let the host pass them to the view. The host depends on a proper return value when IPlugView::onKeyDown is called, otherwise the plug-in view may cause a malfunction of the host's key command handling.

See also
  IPlugFrame, Platform UI Types

## Member Function Documentation

## ◆ isPlatformTypeSupported()

virtual tresult isPlatformTypeSupported | ( | FIDString | type | ) |
| pure virtual

Is Platform UI Type supported.

Parameters

  type | : IDString of Platform UI Types

## ◆ attached()

virtual tresult attached | ( | void * | parent,
|  | FIDString | type )
| pure virtual

The parent window of the view has been created, the (platform) representation of the view should now be created as well.

Note that the parent is owned by the caller and you are not allowed to alter it in any way other than adding your own views. Note that in this call the plug-in could call a IPlugFrame::resizeView ()!

Parameters

  parent | : platform handle of the parent window or view
  type | : Platform UI Types which should be created

## ◆ removed()

virtual tresult removed | ( |  | ) |
| pure virtual

The parent window of the view is about to be destroyed.

You have to remove all your own views from the parent window or view.

## ◆ onWheel()

virtual tresult onWheel | ( | float | distance | ) |
| pure virtual

Handling of mouse wheel.

## ◆ onKeyDown()

virtual tresult onKeyDown | ( | char16 | key,
|  | int16 | keyCode,
|  | int16 | modifiers )
| pure virtual

Handling of keyboard events : Key Down.

Parameters

  key | : unicode code of key
  keyCode | : virtual keycode for non ascii keys - see VirtualKeyCodes in keycodes.h
  modifiers | : any combination of modifiers - see KeyModifier in keycodes.h

Returns
  kResultTrue if the key is handled, otherwise kResultFalse.
  Please note that kResultTrue must only be returned if the key has really been handled. Otherwise key command handling of the host might be blocked!

## ◆ onKeyUp()

virtual tresult onKeyUp | ( | char16 | key,
|  | int16 | keyCode,
|  | int16 | modifiers )
| pure virtual

Handling of keyboard events : Key Up.

Parameters

  key | : unicode code of key
  keyCode | : virtual keycode for non ascii keys - see VirtualKeyCodes in keycodes.h
  modifiers | : any combination of KeyModifier - see KeyModifier in keycodes.h

Returns
  kResultTrue if the key is handled, otherwise return kResultFalse.

## ◆ getSize()

virtual tresult getSize | ( | ViewRect * | size | ) |
| pure virtual

Returns the size of the platform representation of the view.

## ◆ onSize()

virtual tresult onSize | ( | ViewRect * | newSize | ) |
| pure virtual

Resizes the platform representation of the view to the given rect.

Note that if the plug-in requests a resize (IPlugFrame::resizeView ()) onSize has to be called afterward.

## ◆ onFocus()

virtual tresult onFocus | ( | TBool | state | ) |
| pure virtual

Focus changed message.

## ◆ setFrame()

virtual tresult setFrame | ( | IPlugFrame * | frame | ) |
| pure virtual

Sets IPlugFrame object to allow the plug-in to inform the host about resizing.

## ◆ canResize()

virtual tresult canResize | ( |  | ) |
| pure virtual

Is view sizable by user.

## ◆ checkSizeConstraint()

virtual tresult checkSizeConstraint | ( | ViewRect * | rect | ) |
| pure virtual

On live resize this is called to check if the view can be resized to the given rect, if not adjust the rect to the allowed size.

## Member Data Documentation

## ◆ iid

const FUID iid
| static

Empty

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