JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
pluginview.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2// Project : SDK Core
3//
4// Category : Common Base Classes
5// Filename : public.sdk/source/common/pluginview.h
6// Created by : Steinberg, 01/2004
7// Description : Plug-In View Implementation
8//
9//-----------------------------------------------------------------------------
10// LICENSE
11// (c) 2023, Steinberg Media Technologies GmbH, All Rights Reserved
12//-----------------------------------------------------------------------------
13// Redistribution and use in source and binary forms, with or without modification,
14// are permitted provided that the following conditions are met:
15//
16// * Redistributions of source code must retain the above copyright notice,
17// this list of conditions and the following disclaimer.
18// * Redistributions in binary form must reproduce the above copyright notice,
19// this list of conditions and the following disclaimer in the documentation
20// and/or other materials provided with the distribution.
21// * Neither the name of the Steinberg Media Technologies nor the names of its
22// contributors may be used to endorse or promote products derived from this
23// software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
26// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34// OF THE POSSIBILITY OF SUCH DAMAGE.
35//-----------------------------------------------------------------------------
36
37#pragma once
38
40#include "base/source/fobject.h"
41
42namespace Steinberg {
43
44//------------------------------------------------------------------------
49class CPluginView : public FObject, public IPlugView
50{
51public:
52//------------------------------------------------------------------------
53 CPluginView (const ViewRect* rect = nullptr);
54 ~CPluginView () SMTG_OVERRIDE;
55
57 const ViewRect& getRect () const { return rect; }
58
60 void setRect (const ViewRect& r) { rect = r; }
61
63 bool isAttached () const { return systemWindow != nullptr; }
64
66 virtual void attachedToParent () {}
67
69 virtual void removedFromParent () {}
70
71 //---from IPlugView-------
72 tresult PLUGIN_API isPlatformTypeSupported (FIDString type) SMTG_OVERRIDE;
73 tresult PLUGIN_API attached (void* parent, FIDString type) SMTG_OVERRIDE;
74 tresult PLUGIN_API removed () SMTG_OVERRIDE;
75
76 tresult PLUGIN_API onWheel (float /*distance*/) SMTG_OVERRIDE { return kResultFalse; }
77 tresult PLUGIN_API onKeyDown (char16 /*key*/, int16 /*keyMsg*/,
78 int16 /*modifiers*/) SMTG_OVERRIDE
79 {
80 return kResultFalse;
81 }
82 tresult PLUGIN_API onKeyUp (char16 /*key*/, int16 /*keyMsg*/, int16 /*modifiers*/) SMTG_OVERRIDE
83 {
84 return kResultFalse;
85 }
86 tresult PLUGIN_API getSize (ViewRect* size) SMTG_OVERRIDE;
87 tresult PLUGIN_API onSize (ViewRect* newSize) SMTG_OVERRIDE;
88
89 tresult PLUGIN_API onFocus (TBool /*state*/) SMTG_OVERRIDE { return kResultFalse; }
90 tresult PLUGIN_API setFrame (IPlugFrame* frame) SMTG_OVERRIDE
91 {
92 plugFrame = frame;
93 return kResultTrue;
94 }
95
96 tresult PLUGIN_API canResize () SMTG_OVERRIDE { return kResultFalse; }
97 tresult PLUGIN_API checkSizeConstraint (ViewRect* /*rect*/) SMTG_OVERRIDE
98 {
99 return kResultFalse;
100 }
101
102 //---Interface------
103 OBJ_METHODS (CPluginView, FObject)
108//------------------------------------------------------------------------
109protected:
110 ViewRect rect;
111 void* systemWindow {nullptr};
112 IPtr<IPlugFrame> plugFrame;
113};
114
115} // namespace
Plug-In view default implementation.
Definition pluginview.h:50
virtual void removedFromParent()
Calls when this view will be removed from its parent view.
Definition pluginview.h:69
tresult PLUGIN_API attached(void *parent, FIDString type) SMTG_OVERRIDE
The parent window of the view has been created, the (platform) representation of the view should now ...
tresult PLUGIN_API onWheel(float) SMTG_OVERRIDE
Handling of mouse wheel.
Definition pluginview.h:76
bool isAttached() const
Checks if this view is attached to its parent view.
Definition pluginview.h:63
tresult PLUGIN_API canResize() SMTG_OVERRIDE
Is view sizable by user.
Definition pluginview.h:96
tresult PLUGIN_API setFrame(IPlugFrame *frame) SMTG_OVERRIDE
Sets IPlugFrame object to allow the plug-in to inform the host about resizing.
Definition pluginview.h:90
const ViewRect & getRect() const
Returns its current frame rectangle.
Definition pluginview.h:57
tresult PLUGIN_API onKeyDown(char16, int16, int16) SMTG_OVERRIDE
Handling of keyboard events : Key Down.
Definition pluginview.h:77
tresult PLUGIN_API getSize(ViewRect *size) SMTG_OVERRIDE
Returns the size of the platform representation of the view.
virtual void attachedToParent()
Calls when this view will be attached to its parent view.
Definition pluginview.h:66
tresult PLUGIN_API onFocus(TBool) SMTG_OVERRIDE
Focus changed message.
Definition pluginview.h:89
tresult PLUGIN_API onKeyUp(char16, int16, int16) SMTG_OVERRIDE
Handling of keyboard events : Key Up.
Definition pluginview.h:82
tresult PLUGIN_API onSize(ViewRect *newSize) SMTG_OVERRIDE
Resizes the platform representation of the view to the given rect.
tresult PLUGIN_API checkSizeConstraint(ViewRect *) SMTG_OVERRIDE
On live resize this is called to check if the view can be resized to the given rect,...
Definition pluginview.h:97
tresult PLUGIN_API removed() SMTG_OVERRIDE
The parent window of the view is about to be destroyed.
void setRect(const ViewRect &r)
Sets a new frame rectangle.
Definition pluginview.h:60
tresult PLUGIN_API isPlatformTypeSupported(FIDString type) SMTG_OVERRIDE
Is Platform UI Type supported.
Implements FUnknown and IDependent.
Definition fobject.h:84
Callback interface passed to IPlugView.
Definition iplugview.h:197
Plug-in definition of a view.
Definition iplugview.h:123
Basic Object implementing FUnknown.
#define DEFINE_INTERFACES
Start defining interfaces.
Definition fobject.h:387
#define DEF_INTERFACE(InterfaceName)
Add a interfaces.
Definition fobject.h:394
#define END_DEFINE_INTERFACES(BaseClass)
End defining interfaces.
Definition fobject.h:400
#define REFCOUNT_METHODS(BaseClass)
Delegate refcount functions to BaseClass.
Definition fobject.h:360
Graphical rectangle structure.
Definition iplugview.h:35