バージョン

menu_open
Wwise SDK 2024.1.0
HostFrontendModel.h
[詳解]
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  const char* in_absoluteId
83  );
84 
85  /**
86  * \brief Returns the main layout widget of a given Frontend Handle hierarchy.
87  *
88  * \param[in] in_this Current instance of this interface.
89  * \return Pointer to the root widget.
90  */
91  ak_wwise_plugin_widget*(*GetRootWidget)(
93  );
94 
95  /**
96  * \brief Returns a specific widget of a given Frontend Handle hierarchy.
97  *
98  * \param[in] in_this Current instance of this interface.
99  * \param[in] in_absoluteId Text id uniquely identifying the widget.
100  * \return Pointer to the widget if it exists, otherwise nullptr.
101  */
104  const char* in_absoluteId
105  );
106 
107  /**
108  * \brief Gets the ID of a widget.
109  *
110  * \param[in] in_this Current instance of this interface.
111  * \param[in] in_widget Pointer to the widget.
112  * \return String ID of the widget.
113  */
114  const char*(*GetWidgetID)(
116  ak_wwise_plugin_widget* in_widget
117  );
118 
119  /**
120  * \brief Gets the type ID of a widget.
121  *
122  * \param[in] in_this Current instance of this interface.
123  * \param[in] in_widget Pointer to the widget.
124  * \return String ID of the widget's type.
125  */
126  const char*(*GetWidgetType)(
128  ak_wwise_plugin_widget* in_widget
129  );
130 
131  /**
132  * \brief Checks if the widget can contain other widgets.
133  *
134  * \param[in] in_this Current instance of this interface.
135  * \param[in] in_widget Pointer to the widget.
136  * \return True if the widget is a container.
137  */
140  ak_wwise_plugin_widget* in_widget
141  );
142 
143  /**
144  * \brief Checks if the widget is top-level.
145  *
146  * \param[in] in_this Current instance of this interface.
147  * \param[in] in_widget Pointer to the widget.
148  * \return True if the widget is top-level.
149  */
152  ak_wwise_plugin_widget* in_widget
153  );
154 
155  /**
156  * \brief Determines the visibility state of the given widget.
157  *
158  * \param[in] in_this Current instance of this interface.
159  * \param[in] in_widget Pointer to the widget.
160  * \return True if the widget is visible.
161  */
164  ak_wwise_plugin_widget* in_widget
165  );
166 
167  /**
168  * \brief Determines if a widget is enabled for mouse and keyboard input.
169  *
170  * \param[in] in_this Current instance of this interface.
171  * \param[in] in_widget Pointer to the widget.
172  * \return True if the widget is enabled.
173  */
176  ak_wwise_plugin_widget* in_widget
177  );
178 
179  /**
180  * \brief Enables or disables mouse and keyboard input for the widget.
181  *
182  * \param[in] in_this Current instance of this interface.
183  * \param[in] in_widget Pointer to the widget.
184  * \param[in] in_enable True to enable the widget, False to disable.
185  */
186  void(*EnableWidget)(
188  ak_wwise_plugin_widget* in_widget,
189  bool in_enable
190  );
191 
192  /**
193  * \brief Sets the visibility state of the widget.
194  *
195  * \param[in] in_this Current instance of this interface.
196  * \param[in] in_widget Pointer to the widget.
197  * \param[in] in_show True to show the widget, False to hide.
198  */
199  void(*ShowWidget)(
201  ak_wwise_plugin_widget* in_widget,
202  bool in_show
203  );
204 
205  /**
206  * \brief Claims the input focus for the widget.
207  *
208  * \param[in] in_this Current instance of this interface.
209  * \param[in] in_widget Pointer to the widget.
210  */
213  ak_wwise_plugin_widget* in_widget
214  );
215 
216  /**
217  * \brief Connects a signal to a handler taking some user-defined data.
218  *
219  * \param[in] in_this Current instance of this interface.
220  * \param[in] in_widget Pointer to the widget.
221  * \param[in] in_name Name of the signal.
222  * \param[in] in_handler Static function of the form 'void StaticHandler(void* in_owner, ArgsT... in_args, void* in_data)'.
223  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler
224  * when the signal gets emitted. The user must perform the necessary casts in the handler.
225  * \return True if the signal isn't already connected and was successfully connected.
226  */
227  bool(*Connect)(
229  ak_wwise_plugin_widget* in_widget,
230  const char* in_name,
231  void (*in_handler)(),
232  void* in_userData
233  );
234 
235  /**
236  * \brief Applies a user-defined handler to every child of a container.
237  *
238  * \param[in] in_this Current instance of this interface.
239  * \param[in] in_absoluteId Text id uniquely identifying the widget container.
240  * \param[in] in_handler Static function of the form 'void StaticHandler(ak_wwise_plugin_widget*, void* in_data)'.
241  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler.
242  * The user must perform the necessary casts in the handler.
243  */
246  const char * in_absoluteId,
247  void (*in_handler)(ak_wwise_plugin_widget*, void*),
248  void* in_userData
249  );
250 };
251 
252 #define AK_WWISE_PLUGIN_HOST_FRONTEND_MODEL_V1_ID() \
253  AK_WWISE_PLUGIN_BASE_INTERFACE_FROM_ID(AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_FRONTEND_MODEL, 1)
254 #define AK_WWISE_PLUGIN_HOST_FRONTEND_MODEL_V1_CTOR() \
255 { \
256  .m_baseInterface = AK_WWISE_PLUGIN_HOST_FRONTEND_MODEL_V1_ID() \
257 }
258 
259 #ifdef __cplusplus
260 namespace AK::Wwise::Plugin
261 {
262  namespace V1
263  {
265 
266  /// \copydoc ak_wwise_plugin_host_frontend_model_v1
267  class FrontendModel : public CBaseInstanceGlue<CHostFrontendModel>
268  {
269  public:
271 
272  using GenericCallback = void(*)();
273  using ForEachCallback = void(*)(ak_wwise_plugin_widget*, void*);
274 
275  /**
276  * \brief The interface type, as requested by this plug-in.
277  */
278  enum : InterfaceTypeValue
279  {
280  /**
281  * \brief The interface type, as requested by this plug-in.
282  */
284  };
285  /**
286  * \brief The interface version, as requested by this plug-in.
287  */
288  enum : InterfaceVersion
289  {
290  /**
291  * \brief The interface version, as requested by this plug-in.
292  */
294  };
295 
296  /**
297  * \brief Checks if a specific widget exists.
298  *
299  * \param[in] in_absoluteId Text id uniquely identifying the widget.
300  * \return True if the widget exists.
301  */
302  [[nodiscard]] inline bool HasWidget(const char * in_absoluteId)
303  {
304  return MKBOOL(g_cinterface->HasWidget(this, in_absoluteId));
305  }
306 
307  /**
308  * \brief Returns the parent widget of a given Frontend Handle hierarchy.
309  *
310  * \return Pointer to the parent widget.
311  */
312  [[nodiscard]] inline ak_wwise_plugin_widget* GetParentWidget(const char* in_absoluteId)
313  {
314  return g_cinterface->GetParentWidget(this, in_absoluteId);
315  }
316 
317  /**
318  * \brief Returns the main layout widget of a given Frontend Handle hierarchy.
319  *
320  * \return Pointer to the root widget.
321  */
322  [[nodiscard]] inline ak_wwise_plugin_widget* GetRootWidget()
323  {
324  return g_cinterface->GetRootWidget(this);
325  }
326 
327  /**
328  * \brief Returns a specific widget of a given Frontend Handle hierarchy.
329  *
330  * \param[in] in_absoluteId Text id uniquely identifying the widget.
331  * \return Pointer to the widget if it exists, otherwise nullptr.
332  */
333  [[nodiscard]] inline ak_wwise_plugin_widget* GetWidget(const char* in_absoluteId)
334  {
335  return g_cinterface->GetWidget(this, in_absoluteId);
336  }
337 
338  /**
339  * \brief Gets the ID of a widget.
340  *
341  * \param[in] in_widget Pointer to the widget.
342  * \return String ID of the widget.
343  */
344  [[nodiscard]] inline const char* GetWidgetID(ak_wwise_plugin_widget* in_widget)
345  {
346  return g_cinterface->GetWidgetID(this, in_widget);
347  }
348 
349  /**
350  * \brief Gets the type ID of a widget.
351  *
352  * \param[in] in_widget Pointer to the widget.
353  * \return String ID of the widget's type.
354  */
355  [[nodiscard]] inline const char* GetWidgetType(ak_wwise_plugin_widget* in_widget)
356  {
357  return g_cinterface->GetWidgetType(this, in_widget);
358  }
359 
360  /**
361  * \brief Checks if the widget can contain other widgets.
362  *
363  * \param[in] in_widget Pointer to the widget.
364  * \return True if the widget is a container.
365  */
366  [[nodiscard]] inline bool IsWidgetContainer(ak_wwise_plugin_widget* in_widget)
367  {
368  return g_cinterface->IsWidgetContainer(this, in_widget);
369  }
370 
371  /**
372  * \brief Checks if the widget is top-level.
373  *
374  * \param[in] in_widget Pointer to the widget.
375  * \return True if the widget is top-level.
376  */
377  [[nodiscard]] inline bool IsWidgetTopLevel(ak_wwise_plugin_widget* in_widget)
378  {
379  return g_cinterface->IsWidgetTopLevel(this, in_widget);
380  }
381 
382  /**
383  * \brief Determines the visibility state of the given widget.
384  *
385  * \param[in] in_widget Pointer to the widget.
386  * \return True if the widget is visible.
387  */
388  [[nodiscard]] inline bool IsWidgetVisible(ak_wwise_plugin_widget* in_widget)
389  {
390  return g_cinterface->IsWidgetVisible(this, in_widget);
391  }
392 
393  /**
394  * \brief Determines if a widget is enabled for mouse and keyboard input.
395  *
396  * \param[in] in_widget Pointer to the widget.
397  * \return True if the widget is enabled.
398  */
399  [[nodiscard]] inline bool IsWidgetEnabled(ak_wwise_plugin_widget* in_widget)
400  {
401  return g_cinterface->IsWidgetEnabled(this, in_widget);
402  }
403 
404  /**
405  * \brief Enables or disables mouse and keyboard input for the widget.
406  *
407  * \param[in] in_widget Pointer to the widget.
408  * \param[in] in_enable True to enable the widget, False to disable.
409  */
410  inline void EnableWidget(
411  ak_wwise_plugin_widget* in_widget,
412  bool in_enable
413  )
414  {
415  g_cinterface->EnableWidget(this, in_widget, in_enable);
416  }
417 
418  /**
419  * \brief Sets the visibility state of the widget.
420  *
421  * \param[in] in_widget Pointer to the widget.
422  * \param[in] in_show True to show the widget, False to hide.
423  */
424  inline void ShowWidget(
425  ak_wwise_plugin_widget* in_widget,
426  bool in_show
427  )
428  {
429  g_cinterface->ShowWidget(this, in_widget, in_show);
430  }
431 
432  /**
433  * \brief Claims the input focus for the widget.
434  *
435  * \param[in] in_widget Pointer to the widget.
436  */
437  inline void SetWidgetFocus(ak_wwise_plugin_widget* in_widget)
438  {
439  return g_cinterface->SetWidgetFocus(this, in_widget);
440  }
441 
442  /**
443  * \brief Connects a signal to a handler taking some user-defined data.
444  *
445  * \param[in] in_widget Pointer to the widget.
446  * \param[in] in_name Name of the signal.
447  * \param[in] in_handler Static function of the form 'void StaticHandler(void* in_owner, ArgsT... in_args, void* in_data)'.
448  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler
449  * when the signal gets emitted. The user must perform the necessary casts in the handler.
450  * \return True if the signal isn't already connected and was successfully connected.
451  */
452  inline bool Connect(
453  ak_wwise_plugin_widget* in_widget,
454  const char* in_name,
455  GenericCallback in_handler,
456  void* in_userData
457  )
458  {
459  return g_cinterface->Connect(this, in_widget, in_name, in_handler, in_userData);
460  }
461 
462  /**
463  * \brief Applies a user-defined handler to every child of a container.
464  *
465  * \param[in] in_absoluteId Text id uniquely identifying the widget container.
466  * \param[in] in_handler Static function of the form 'void StaticHandler(ak_wwise_plugin_widget*, void* in_data)'.
467  * \param[in] in_userData Pointer to user-defined data. This is forwarded to the handler.
468  * The user must perform the necessary casts in the handler.
469  */
470  inline void ForEachChildren(
471  const char* in_absoluteId,
472  ForEachCallback in_handler,
473  void* in_userData
474  )
475  {
476  return g_cinterface->ForEachChildren(this, in_absoluteId, in_handler, in_userData);
477  }
478  };
479 
480  /**
481  * \brief Requests a FrontendModel interface, provided as m_frontendModel variable.
482  *
483  * Deriving your plug-in class from RequestFrontendModel will automatically request the FrontendModel interface.
484  * From this point, you will be able to access the host-provided functions in the `m_frontendModel` variable.
485  *
486  * \aknote The AK::Wwise::Plugin::RequestFrontendModel classe is automatically derived when providing Frontend in C++.
487  * \endaknote
488  */
490 
491  } // of namespace V1
492 
493  /// Latest version of the C FrontendModel interface.
495  /// Latest version of the C++ FrontendModel interface.
497  /// Latest version of the requested C++ FrontendModel interface.
499 
503 } // of namespace AK::Wwise::Plugin
504 
505 #endif
void ak_wwise_plugin_widget
Definition: PluginDef.h:507
bool(* HasWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, const char *in_absoluteId)
Checks if a specific widget exists.
ak_wwise_plugin_widget * GetParentWidget(const char *in_absoluteId)
Returns the parent widget of a given Frontend Handle hierarchy.
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.
ak_wwise_plugin_widget *(* GetParentWidget)(struct ak_wwise_plugin_host_frontend_model_instance_v1 *in_this, const char *in_absoluteId)
Returns the parent widget of a given Frontend Handle hierarchy.
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 * 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:79
#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

このページはお役に立ちましたか?

サポートは必要ですか?

ご質問や問題、ご不明点はございますか?お気軽にお問い合わせください。

サポートページをご確認ください

あなたのプロジェクトについて教えてください。ご不明な点はありませんか。

プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。

Wwiseからはじめよう