Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
CustomController.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2019 pongasoft
3 *
4 * Licensed under the Apache License, Version 2.0 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19#pragma once
20
21#include <vstgui4/vstgui/uidescription/delegationcontroller.h>
23#include "StateAware.h"
24
26
33class CustomController : public VSTGUI::DelegationController, public ParamAware
34{
35public:
36 // Constructor
37 explicit CustomController(IController *iBaseController) : DelegationController(iBaseController) {}
38};
39
40
50template<typename TGUIState>
52{
53 // ensures that TGUIState is a subclass of GUIState
54 static_assert(std::is_convertible<TGUIState *, GUIState*>::value, "TGUIState must be a subclass of GUIState");
55
56public:
57 // Constructor
58 explicit StateAwareCustomController(IController *iBaseController) : CustomController(iBaseController) {}
59
80 template<typename TView>
81 inline ParamAwareView<TView> *makeParamAware(TView *iView) {
82 return StateAware<TGUIState>::fState->makeParamAware(iView);
83 }
84
85protected:
88 void initState(GUIState *iGUIState) override
89 {
92 }
93};
94
98template<typename TGUIState>
99class [[deprecated("Since 4.0.0 - Use StateAwareCustomController instead")]] PluginCustomController : public StateAwareCustomController<TGUIState>
100{
101public:
102 explicit PluginCustomController(IController *iBaseController) :
103 StateAwareCustomController<TGUIState>(iBaseController)
104 {}
105};
106}
Definition GUIState.h:43
This class is inherited by classes who want to be aware of parameters and be notified when they chang...
Definition ParamAware.h:65
virtual void initState(GUIState *iGUIState)
Called during initialization.
Definition ParamAware.cpp:37
This subclass allows for registering callbacks to any kind of view without having to inherit from it.
Definition ParamAware.h:563
CustomController(IController *iBaseController)
Definition CustomController.h:37
PluginCustomController(IController *iBaseController)
Definition CustomController.h:102
ParamAwareView< TView > * makeParamAware(TView *iView)
Allow for registering an arbitrary callback on an arbitrary view without having to inherit from the v...
Definition CustomController.h:81
void initState(GUIState *iGUIState) override
Overriden to call both ParamAware::initState() and StateAware::initState().
Definition CustomController.h:88
StateAwareCustomController(IController *iBaseController)
Definition CustomController.h:58
This class is used to get access to the GUI state and parameters of the plugin with their actual type...
Definition StateAware.h:32
TGUIState * fState
Gives access to the GUI state (ex: fState->fLabelA).
Definition StateAware.h:53
virtual void initState(GUIState *iGUIState)
This method is called by Jamba automatically to initialize the state.
Definition StateAware.h:42
Definition CustomController.h:25