Jamba C++ API 8.0.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<GUIStateSubclass TGUIState>
32{
33public:
35 virtual ~StateAware() = default;
36
43 virtual void initState(GUIState *iGUIState)
44 {
45 // due to the concept, we know that this will not return nullptr (unless the wrong state is provided)
46 fState = dynamic_cast<TGUIState *>(iGUIState);
47 DCHECK_F(fState != nullptr); // sanity check
48 fParams = &fState->fParams;
49 }
50
51public:
54 TGUIState *fState{};
55
58 TGUIState::PluginParameters const *fParams{};
59};
60
61}
Definition GUIState.h:45
This class is used to get access to the GUI state and parameters of the plugin with their actual type...
Definition StateAware.h:32
virtual ~StateAware()=default
Destructor.
TGUIState::PluginParameters const * fParams
Gives direct access to parameters (ex: fParams->fBypassParam).
Definition StateAware.h:58
TGUIState * fState
Gives access to the GUI state (ex: fState->fLabelA).
Definition StateAware.h:54
virtual void initState(GUIState *iGUIState)
This method is called by Jamba automatically to initialize the state.
Definition StateAware.h:43
Definition CustomController.h:26