Version
menu_open
link
Wwise SDK 2023.1.4
HostFrontendModel.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /**
28  * \brief Wwise Authoring Plug-ins - Plug-in API for the Frontend Model.
29  * \file AK/Wwise/Plugin/HostFrontendModel.h
30  */
31 
32 #pragma once
33 
34 #include "PluginInfoGenerator.h"
35 #include "PluginDef.h"
36 
37 /**
38  * \brief Interface used to interact with the frontend model.
39  *
40  * The frontend model is the service in charge of building GUI views and managing the
41  * objects's lifetime. It takes the description of a view in the form of a WAFM
42  * file, creates the widget hierarchy, and stores the objects in a specific handle.
43  * The handle is shared to the user to allow interaction with the view's widgets.
44  */
46 #ifdef __cplusplus
48 #endif
49 {
50 #ifndef __cplusplus
51  ak_wwise_plugin_base_interface m_baseInterface;
52 #endif
53 
54 #ifdef __cplusplus
55  /// Base host-provided instance type for ak_wwise_plugin_host_frontend_model_v1.
59  {}
60 #endif
61 
62  /**
63  * \brief Checks if a specific widget exists.
64  *
65  * \param[in] in_this Current instance of this interface.
66  * \param[in] in_absoluteId Text id uniquely identifying the widget.
67  * \return True if the widget exists.
68  */
69  bool(*HasWidget)(
71  const char * in_absoluteId
72  );
73 
74  /**
75  * \brief Returns the parent widget of a given Frontend Handle hierarchy.
76  *
77  * \param[in] in_this Current instance of this interface.
78  * \return Pointer to the parent widget.
79  */
80  ak_wwise_plugin_widget*(*GetParentWidget)(
82  );
83 
84  /**
85  * \brief Returns the main layout widget of a given Frontend Handle hierarchy.
86  *
87  * \param[in] in_this Current instance of this interface.
88  * \return Pointer to the root widget.
89  */
90  ak_wwise_plugin_widget*(*GetRootWidget)(
92  );
93 
94  /**
95  * \brief Returns a specific widget of a given Frontend Handle hierarchy.
96  *
97  * \param[in] in_this Current instance of this interface.
98  * \param[in] in_absoluteId Text id uniquely identifying the widget.
99  * \return Pointer to the widget if it exists, otherwise nullptr.
100  */
103  const char * in_absoluteId
104  );
105 
106  /**
107  * \brief Gets the ID of a widget.
108  *
109  * \param[in] in_this Current instance of this interface.
110  * \param[in] in_widget Pointer to the widget.
111  * \return String ID of the widget.
112  */
113  const char*(*GetWidgetID)(
115  ak_wwise_plugin_widget* in_widget
116  );
117 
118  /**
119  * \brief Gets the type ID of a widget.
120  *
121  * \param[in] in_this Current instance of this interface.
122  * \param[in] in_widget Pointer to the widget.
123  * \return String ID of the widget's type.
124  */
125  const char*(*GetWidgetType)(
127  ak_wwise_plugin_widget* in_widget
128  );
129 
130  /**
131  * \brief Checks if the widget can contain other widgets.
132  *
133  * \param[in] in_this Current instance of this interface.
134  * \param[in] in_widget Pointer to the widget.
135  * \return True if the widget is a container.
136  */
139  ak_wwise_plugin_widget* in_widget
140  );
141 
142  /**
143  * \brief Checks if the widget is top-level.
144  *
145  * \param[in] in_this Current instance of this interface.
146  * \param[in] in_widget Pointer to the widget.
147  * \return True if the widget is top-level.
148  */
151  ak_wwise_plugin_widget* in_widget
152  );
153 
154  /**
155  * \brief Determines the visibility state of the given widget.
156  *
157  * \param[in] in_this Current instance of this interface.
158  * \param[in] in_widget Pointer to the widget.
159  * \return True if the widget is visible.
160  */
163  ak_wwise_plugin_widget* in_widget
164  );
165 
166  /**
167  * \brief Determines if a widget is enabled for mouse and keyboard input.
168  *
169  * \param[in] in_this Current instance of this interface.
170  * \param[in] in_widget Pointer to the widget.
171  * \return True if the widget is enabled.
172  */
175  ak_wwise_plugin_widget* in_widget
176  );
177 
178  /**
179  * \brief Enables or disables mouse and keyboard input for the widget.
180  *
181  * \param[in] in_this Current instance of this interface.
182  * \param[in] in_widget Pointer to the widget.
183  * \param[in] in_enable True to enable the widget, False to disable.
184  */
185  void(*EnableWidget)(
187  ak_wwise_plugin_widget* in_widget,
188  bool in_enable
189  );
190 
191  /**
192  * \brief Sets the visibility state of the widget.
193  *
194  * \param[in] in_this Current instance of this interface.
195  * \param[in] in_widget Pointer to the widget.
196  * \param[in] in_show True to show the widget, False to hide.
197  */
198  void(*ShowWidget)(
200  ak_wwise_plugin_widget* in_widget,
201  bool in_show
202  );
203 
204  /**
205  * \brief Claims the input focus for the widget.
206  *
207  * \param[in] in_this Current instance of this interface.
208  * \param[in] in_widget Pointer to the widget.
209  */
212  ak_wwise_plugin_widget* in_widget
213  );
214 
215  /**
216  * \brief Connects a signal to a handler taking some user-defined data.
217  *
218  * \param[in] in_this Current instance of this interface.
219  * \param[in] in_widget Pointer to the widget.
220  * \param[in] in_name Name of the signal.
221  * \param[in] in_handler Static function of the form 'void StaticHandler(void* in_owner, ArgsT... in_args, void* in_data)'.
222  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler
223  * when the signal gets emitted. The user must perform the necessary casts in the handler.
224  * \return True if the signal isn't already connected and was successfully connected.
225  */
226  bool(*Connect)(
228  ak_wwise_plugin_widget* in_widget,
229  const char* in_name,
230  void (*in_handler)(),
231  void* in_userData
232  );
233 
234  /**
235  * \brief Applies a user-defined handler to every child of a container.
236  *
237  * \param[in] in_this Current instance of this interface.
238  * \param[in] in_absoluteId Text id uniquely identifying the widget container.
239  * \param[in] in_handler Static function of the form 'void StaticHandler(ak_wwise_plugin_widget*, void* in_data)'.
240  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler.
241  * The user must perform the necessary casts in the handler.
242  */
245  const char * in_absoluteId,
246  void (*in_handler)(ak_wwise_plugin_widget*, void*),
247  void* in_userData
248  );
249 };
250 
251 #define AK_WWISE_PLUGIN_HOST_FRONTEND_MODEL_V1_ID() \
252  AK_WWISE_PLUGIN_BASE_INTERFACE_FROM_ID(AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_FRONTEND_MODEL, 1)
253 #define AK_WWISE_PLUGIN_HOST_FRONTEND_MODEL_V1_CTOR() \
254 { \
255  .m_baseInterface = AK_WWISE_PLUGIN_HOST_FRONTEND_MODEL_V1_ID() \
256 }
257 
258 #ifdef __cplusplus
259 namespace AK::Wwise::Plugin
260 {
261  namespace V1
262  {
264 
265  /// \copydoc ak_wwise_plugin_host_frontend_model_v1
266  class FrontendModel : public CBaseInstanceGlue<CHostFrontendModel>
267  {
268  public:
270 
271  using GenericCallback = void(*)();
272  using ForEachCallback = void(*)(ak_wwise_plugin_widget*, void*);
273 
274  /**
275  * \brief The interface type, as requested by this plug-in.
276  */
277  enum : InterfaceTypeValue
278  {
279  /**
280  * \brief The interface type, as requested by this plug-in.
281  */
283  };
284  /**
285  * \brief The interface version, as requested by this plug-in.
286  */
287  enum : InterfaceVersion
288  {
289  /**
290  * \brief The interface version, as requested by this plug-in.
291  */
293  };
294 
295  /**
296  * \brief Checks if a specific widget exists.
297  *
298  * \param[in] in_absoluteId Text id uniquely identifying the widget.
299  * \return True if the widget exists.
300  */
301  [[nodiscard]] inline bool HasWidget(const char * in_absoluteId)
302  {
303  return MKBOOL(g_cinterface->HasWidget(this, in_absoluteId));
304  }
305 
306  /**
307  * \brief Returns the parent widget of a given Frontend Handle hierarchy.
308  *
309  * \return Pointer to the parent widget.
310  */
311  [[nodiscard]] inline ak_wwise_plugin_widget* GetParentWidget()
312  {
313  return g_cinterface->GetParentWidget(this);
314  }
315 
316  /**
317  * \brief Returns the main layout widget of a given Frontend Handle hierarchy.
318  *
319  * \return Pointer to the root widget.
320  */
321  [[nodiscard]] inline ak_wwise_plugin_widget* GetRootWidget()
322  {
323  return g_cinterface->GetRootWidget(this);
324  }
325 
326  /**
327  * \brief Returns a specific widget of a given Frontend Handle hierarchy.
328  *
329  * \param[in] in_absoluteId Text id uniquely identifying the widget.
330  * \return Pointer to the widget if it exists, otherwise nullptr.
331  */
332  [[nodiscard]] inline ak_wwise_plugin_widget* GetWidget(const char * in_absoluteId)
333  {
334  return g_cinterface->GetWidget(this, in_absoluteId);
335  }
336 
337  /**
338  * \brief Gets the ID of a widget.
339  *
340  * \param[in] in_widget Pointer to the widget.
341  * \return String ID of the widget.
342  */
343  [[nodiscard]] inline const char* GetWidgetID(ak_wwise_plugin_widget* in_widget)
344  {
345  return g_cinterface->GetWidgetID(this, in_widget);
346  }
347 
348  /**
349  * \brief Gets the type ID of a widget.
350  *
351  * \param[in] in_widget Pointer to the widget.
352  * \return String ID of the widget's type.
353  */
354  [[nodiscard]] inline const char* GetWidgetType(ak_wwise_plugin_widget* in_widget)
355  {
356  return g_cinterface->GetWidgetType(this, in_widget);
357  }
358 
359  /**
360  * \brief Checks if the widget can contain other widgets.
361  *
362  * \param[in] in_widget Pointer to the widget.
363  * \return True if the widget is a container.
364  */
365  [[nodiscard]] inline bool IsWidgetContainer(ak_wwise_plugin_widget* in_widget)
366  {
367  return g_cinterface->IsWidgetContainer(this, in_widget);
368  }
369 
370  /**
371  * \brief Checks if the widget is top-level.
372  *
373  * \param[in] in_widget Pointer to the widget.
374  * \return True if the widget is top-level.
375  */
376  [[nodiscard]] inline bool IsWidgetTopLevel(ak_wwise_plugin_widget* in_widget)
377  {
378  return g_cinterface->IsWidgetTopLevel(this, in_widget);
379  }
380 
381  /**
382  * \brief Determines the visibility state of the given widget.
383  *
384  * \param[in] in_widget Pointer to the widget.
385  * \return True if the widget is visible.
386  */
387  [[nodiscard]] inline bool IsWidgetVisible(ak_wwise_plugin_widget* in_widget)
388  {
389  return g_cinterface->IsWidgetVisible(this, in_widget);
390  }
391 
392  /**
393  * \brief Determines if a widget is enabled for mouse and keyboard input.
394  *
395  * \param[in] in_widget Pointer to the widget.
396  * \return True if the widget is enabled.
397  */
398  [[nodiscard]] inline bool IsWidgetEnabled(ak_wwise_plugin_widget* in_widget)
399  {
400  return g_cinterface->IsWidgetEnabled(this, in_widget);
401  }
402 
403  /**
404  * \brief Enables or disables mouse and keyboard input for the widget.
405  *
406  * \param[in] in_widget Pointer to the widget.
407  * \param[in] in_enable True to enable the widget, False to disable.
408  */
409  inline void EnableWidget(
410  ak_wwise_plugin_widget* in_widget,
411  bool in_enable
412  )
413  {
414  g_cinterface->EnableWidget(this, in_widget, in_enable);
415  }
416 
417  /**
418  * \brief Sets the visibility state of the widget.
419  *
420  * \param[in] in_widget Pointer to the widget.
421  * \param[in] in_show True to show the widget, False to hide.
422  */
423  inline void ShowWidget(
424  ak_wwise_plugin_widget* in_widget,
425  bool in_show
426  )
427  {
428  g_cinterface->ShowWidget(this, in_widget, in_show);
429  }
430 
431  /**
432  * \brief Claims the input focus for the widget.
433  *
434  * \param[in] in_widget Pointer to the widget.
435  */
436  inline void SetWidgetFocus(ak_wwise_plugin_widget* in_widget)
437  {
438  return g_cinterface->SetWidgetFocus(this, in_widget);
439  }
440 
441  /**
442  * \brief Connects a signal to a handler taking some user-defined data.
443  *
444  * \param[in] in_widget Pointer to the widget.
445  * \param[in] in_name Name of the signal.
446  * \param[in] in_handler Static function of the form 'void StaticHandler(void* in_owner, ArgsT... in_args, void* in_data)'.
447  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler
448  * when the signal gets emitted. The user must perform the necessary casts in the handler.
449  * \return True if the signal isn't already connected and was successfully connected.
450  */
451  inline bool Connect(
452  ak_wwise_plugin_widget* in_widget,
453  const char* in_name,
454  GenericCallback in_handler,
455  void* in_userData
456  )
457  {
458  return g_cinterface->Connect(this, in_widget, in_name, in_handler, in_userData);
459  }
460 
461  /**
462  * \brief Applies a user-defined handler to every child of a container.
463  *
464  * \param[in] in_absoluteId Text id uniquely identifying the widget container.
465  * \param[in] in_handler Static function of the form 'void StaticHandler(ak_wwise_plugin_widget*, void* in_data)'.
466  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler.
467  * The user must perform the necessary casts in the handler.
468  */
469  inline void ForEachChildren(
470  const char* in_absoluteId,
471  ForEachCallback in_handler,
472  void* in_userData
473  )
474  {
475  return g_cinterface->ForEachChildren(this, in_absoluteId, in_handler, in_userData);
476  }
477  };
478 
479  /**
480  * \brief Requests a FrontendModel interface, provided as m_frontendModel variable.
481  *
482  * Deriving your plug-in class from RequestFrontendModel will automatically request the FrontendModel interface.
483  * From this point, you will be able to access the host-provided functions in the `m_frontendModel` variable.
484  *
485  * \aknote The AK::Wwise::Plugin::RequestFrontendModel classe is automatically derived when providing Frontend in C++.
486  * \endaknote
487  */
489 
490  } // of namespace V1
491 
492  /// Latest version of the C FrontendModel interface.
494  /// Latest version of the C++ FrontendModel interface.
496  /// Latest version of the requested C++ FrontendModel interface.
498 
502 } // of namespace AK::Wwise::Plugin
503 
504 #endif
void ak_wwise_plugin_widget
Definition: PluginDef.h:505
bool(* HasWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, const char *in_absoluteId)
Checks if a specific widget exists.
bool IsWidgetContainer(ak_wwise_plugin_widget *in_widget)
Checks if the widget can contain other widgets.
@ k_interfaceVersion
The interface version, as requested by this plug-in.
ak_wwise_plugin_widget *(* GetRootWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this)
Returns the main layout widget of a given Frontend Handle hierarchy.
void(* EnableWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget, bool in_enable)
Enables or disables mouse and keyboard input for the widget.
static GluedInterface * g_cinterface
The unique instance of the CInterface interface. Defined at nullptr first, overridden by the Host onc...
Interface used to interact with the frontend model.
decltype(BaseInterface::m_version) InterfaceVersion
PluginInfoGenerator: Type for the m_version value in BaseInterface.
void(* SetWidgetFocus)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Claims the input focus for the widget.
bool(* IsWidgetVisible)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Determines the visibility state of the given widget.
bool(* Connect)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget, const char *in_name, void(*in_handler)(), void *in_userData)
Connects a signal to a handler taking some user-defined data.
bool IsWidgetTopLevel(ak_wwise_plugin_widget *in_widget)
Checks if the widget is top-level.
void ForEachChildren(const char *in_absoluteId, ForEachCallback in_handler, void *in_userData)
Applies a user-defined handler to every child of a container.
void ShowWidget(ak_wwise_plugin_widget *in_widget, bool in_show)
Sets the visibility state of the widget.
ak_wwise_plugin_widget *(* GetWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, const char *in_absoluteId)
Returns a specific widget of a given Frontend Handle hierarchy.
void(* ShowWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget, bool in_show)
Sets the visibility state of the widget.
bool(* IsWidgetTopLevel)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Checks if the widget is top-level.
bool Connect(ak_wwise_plugin_widget *in_widget, const char *in_name, GenericCallback in_handler, void *in_userData)
Connects a signal to a handler taking some user-defined data.
const char *(* GetWidgetType)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Gets the type ID of a widget.
const char * GetWidgetID(ak_wwise_plugin_widget *in_widget)
Gets the ID of a widget.
@ k_interfaceType
The interface type, as requested by this plug-in.
Interface used to interact with the frontend model.
V1::FrontendModel FrontendModel
Latest version of the C++ FrontendModel interface.
Wwise Authoring Plug-ins - C++ class helper to automatically determine the plug-in interfaces used in...
bool(* IsWidgetEnabled)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Determines if a widget is enabled for mouse and keyboard input.
bool HasWidget(const char *in_absoluteId)
Checks if a specific widget exists.
RequestedHostInterface< FrontendModel > RequestFrontendModel
Requests a FrontendModel interface, provided as m_frontendModel variable.
PluginInfoGenerator: Associates an existing C Interface with a variable that can be used....
ak_wwise_plugin_widget *(* GetParentWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this)
Returns the parent widget of a given Frontend Handle hierarchy.
ak_wwise_plugin_widget * GetRootWidget()
Returns the main layout widget of a given Frontend Handle hierarchy.
bool IsWidgetEnabled(ak_wwise_plugin_widget *in_widget)
Determines if a widget is enabled for mouse and keyboard input.
bool IsWidgetVisible(ak_wwise_plugin_widget *in_widget)
Determines the visibility state of the given widget.
std::underlying_type< InterfaceType >::type InterfaceTypeValue
PluginInfoGenerator: Underlying storage type for the m_interface value in BaseInterface.
const char *(* GetWidgetID)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Gets the ID of a widget.
ak_wwise_plugin_host_frontend_model_v1 CHostFrontendModel
const char * GetWidgetType(ak_wwise_plugin_widget *in_widget)
Gets the type ID of a widget.
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_VERSION(AudioPlugin)
void(*)(ak_wwise_plugin_widget *, void *) ForEachCallback
bool(* IsWidgetContainer)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, ak_wwise_plugin_widget *in_widget)
Checks if the widget can contain other widgets.
Interface description and base class for every Wwise Authoring plug-in interface.
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_FRONTEND_MODEL
ak_wwise_plugin_widget * GetWidget(const char *in_absoluteId)
Returns a specific widget of a given Frontend Handle hierarchy.
void SetWidgetFocus(ak_wwise_plugin_widget *in_widget)
Claims the input focus for the widget.
void EnableWidget(ak_wwise_plugin_widget *in_widget, bool in_enable)
Enables or disables mouse and keyboard input for the widget.
#define MKBOOL(cond)
Definition: PluginHelpers.h:74
ak_wwise_plugin_widget * GetParentWidget()
Returns the parent widget of a given Frontend Handle hierarchy.
#define AK_WWISE_PLUGIN_SPECIALIZE_HOST_INTERFACE(in_name, in_varname,...)
PluginInfoGenerator: Creates a C++ host specialization for interface class specified in in_name,...
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_CLASS(AudioPlugin)
void(* ForEachChildren)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, const char *in_absoluteId, void(*in_handler)(ak_wwise_plugin_widget *, void *), void *in_userData)
Applies a user-defined handler to every child of a container.
Wwise Authoring Plug-ins - Base plug-in definitions.

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise