Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
StateAware.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 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
22
24
30template<typename TGUIState>
32{
33 static_assert(std::is_convertible_v<TGUIState *, GUIState *>);
34
35public:
42 virtual void initState(GUIState *iGUIState)
43 {
44 // because of the static assert, we know that this will not return nullptr
45 fState = dynamic_cast<TGUIState *>(iGUIState);
46 DCHECK_F(fState != nullptr); // sanity check
47 fParams = &fState->fParams;
48 }
49
50public:
53 TGUIState *fState{};
54
57 typename TGUIState::PluginParameters const *fParams{};
58};
59
60}
Definition GUIState.h:43
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::PluginParameters const * fParams
Gives direct access to parameters (ex: fParams->fBypassParam).
Definition StateAware.h:57
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