JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
juce::ModalCallbackFunction Class Reference

This class provides some handy utility methods for creating ModalComponentManager::Callback objects that will invoke a static function with some parameters when a modal component is dismissed. More...

#include "juce_ModalComponentManager.h"

Static Public Member Functions

template<typename CallbackFn >
static ModalComponentManager::Callbackcreate (CallbackFn &&fn)
 This is a utility function to create a ModalComponentManager::Callback that will call a callable object.
 
template<typename ParamType >
static ModalComponentManager::Callbackcreate (void(*functionToCall)(int, ParamType), ParamType parameterValue)
 This is a utility function to create a ModalComponentManager::Callback that will call a static function with a parameter.
 
template<typename ParamType1 , typename ParamType2 >
static ModalComponentManager::CallbackwithParam (void(*functionToCall)(int, ParamType1, ParamType2), ParamType1 parameterValue1, ParamType2 parameterValue2)
 This is a utility function to create a ModalComponentManager::Callback that will call a static function with two custom parameters.
 
template<class ComponentType >
static ModalComponentManager::CallbackforComponent (void(*functionToCall)(int, ComponentType *), ComponentType *component)
 This is a utility function to create a ModalComponentManager::Callback that will call a static function with a component.
 
template<class ComponentType , typename ParamType >
static ModalComponentManager::CallbackforComponent (void(*functionToCall)(int, ComponentType *, ParamType), ComponentType *component, ParamType param)
 Creates a ModalComponentManager::Callback that will call a static function with a component.
 

Detailed Description

This class provides some handy utility methods for creating ModalComponentManager::Callback objects that will invoke a static function with some parameters when a modal component is dismissed.

@tags{GUI}

Definition at line 162 of file juce_ModalComponentManager.h.

Member Function Documentation

◆ create() [1/2]

template<typename CallbackFn >
static ModalComponentManager::Callback * juce::ModalCallbackFunction::create ( CallbackFn &&  fn)
static

This is a utility function to create a ModalComponentManager::Callback that will call a callable object.

The function that you supply must take an integer parameter, which is the result code that was returned when the modal component was dismissed.

See also
ModalComponentManager::Callback

Definition at line 174 of file juce_ModalComponentManager.h.

◆ create() [2/2]

template<typename ParamType >
static ModalComponentManager::Callback * juce::ModalCallbackFunction::create ( void(*)(int, ParamType functionToCall,
ParamType  parameterValue 
)
static

This is a utility function to create a ModalComponentManager::Callback that will call a static function with a parameter.

The function that you supply must take two parameters - the first being an int, which is the result code that was used when the modal component was dismissed, and the second can be a custom type. Note that this custom value will be copied and stored, so it must be a primitive type or a class that provides copy-by-value semantics.

E.g.

static void myCallbackFunction (int modalResult, double customValue)
{
if (modalResult == 1)
}
...
The base class for all JUCE user-interface objects.
void enterModalState(bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
Puts the component into a modal state.
static ModalComponentManager::Callback * create(CallbackFn &&fn)
This is a utility function to create a ModalComponentManager::Callback that will call a callable obje...
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
See also
ModalComponentManager::Callback

Definition at line 210 of file juce_ModalComponentManager.h.

◆ forComponent() [1/2]

template<class ComponentType >
static ModalComponentManager::Callback * juce::ModalCallbackFunction::forComponent ( void(*)(int, ComponentType *)  functionToCall,
ComponentType component 
)
static

This is a utility function to create a ModalComponentManager::Callback that will call a static function with a component.

The function that you supply must take two parameters - the first being an int, which is the result code that was used when the modal component was dismissed, and the second can be a Component class. The component will be stored as a WeakReference, so that if it gets deleted before this callback is invoked, the pointer that is passed to the function will be null.

E.g.

{
if (modalResult == 1 && mySlider != nullptr) // (must check that mySlider isn't null in case it was deleted..)
mySlider->setValue (0.0);
}
...
static ModalComponentManager::Callback * forComponent(void(*functionToCall)(int, ComponentType *), ComponentType *component)
This is a utility function to create a ModalComponentManager::Callback that will call a static functi...
A slider control for changing a value.
Definition juce_Slider.h:54
See also
ModalComponentManager::Callback

Definition at line 276 of file juce_ModalComponentManager.h.

◆ forComponent() [2/2]

static ModalComponentManager::Callback * juce::ModalCallbackFunction::forComponent ( void(*)(int, ComponentType *, ParamType functionToCall,
ComponentType component,
ParamType  param 
)
static

Creates a ModalComponentManager::Callback that will call a static function with a component.

The function that you supply must take three parameters - the first being an int, which is the result code that was used when the modal component was dismissed, the second being a Component class, and the third being a custom type (which must be a primitive type or have copy-by-value semantics). The component will be stored as a WeakReference, so that if it gets deleted before this callback is invoked, the pointer that is passed into the function will be null.

E.g.

{
if (modalResult == 1 && mySlider != nullptr) // (must check that mySlider isn't null in case it was deleted..)
mySlider->setName (customParam);
}
...
The JUCE String class!
Definition juce_String.h:53
See also
ModalComponentManager::Callback

Definition at line 309 of file juce_ModalComponentManager.h.

◆ withParam()

static ModalComponentManager::Callback * juce::ModalCallbackFunction::withParam ( void(*)(int, ParamType1, ParamType2 functionToCall,
ParamType1  parameterValue1,
ParamType2  parameterValue2 
)
static

This is a utility function to create a ModalComponentManager::Callback that will call a static function with two custom parameters.

The function that you supply must take three parameters - the first being an int, which is the result code that was used when the modal component was dismissed, and the next two are your custom types. Note that these custom values will be copied and stored, so they must be primitive types or classes that provide copy-by-value semantics.

E.g.

See also
ModalComponentManager::Callback

Definition at line 242 of file juce_ModalComponentManager.h.


The documentation for this class was generated from the following file: