25 #ifndef JUCE_MODALCOMPONENTMANAGER_H_INCLUDED
26 #define JUCE_MODALCOMPONENTMANAGER_H_INCLUDED
72 virtual void modalStateFinished (
int returnValue) = 0;
82 int getNumModalComponents()
const;
87 Component* getModalComponent (
int index)
const;
90 bool isModal (
Component* component)
const;
93 bool isFrontModalComponent (
Component* component)
const;
108 void attachCallback (
Component* component, Callback* callback);
111 void bringModalComponentsToFront (
bool topOneShouldGrabFocus =
true);
116 bool cancelAllModalComponents();
118 #if JUCE_MODAL_LOOPS_PERMITTED
122 int runEventLoopForCurrentComponent();
140 class ReturnValueRetriever;
146 void startModal (
Component*,
bool autoDelete);
147 void endModal (
Component*,
int returnValue);
183 template <
typename ParamType>
185 ParamType parameterValue)
187 return new FunctionCaller1 <ParamType> (functionToCall, parameterValue);
212 template <
typename ParamType1,
typename ParamType2>
214 ParamType1 parameterValue1,
215 ParamType2 parameterValue2)
217 return new FunctionCaller2 <ParamType1, ParamType2> (functionToCall, parameterValue1, parameterValue2);
243 template <
class ComponentType>
245 ComponentType* component)
247 return new ComponentCaller1 <ComponentType> (functionToCall, component);
273 template <
class ComponentType,
typename ParamType>
275 ComponentType* component,
278 return new ComponentCaller2 <ComponentType, ParamType> (functionToCall, component, param);
283 template <
typename ParamType>
287 typedef void (*FunctionType) (int, ParamType);
289 FunctionCaller1 (FunctionType& f, ParamType& p1)
290 : function (f), param (p1) {}
292 void modalStateFinished (
int returnValue) {
function (returnValue, param); }
295 const FunctionType
function;
301 template <
typename ParamType1,
typename ParamType2>
305 typedef void (*FunctionType) (int, ParamType1, ParamType2);
307 FunctionCaller2 (FunctionType& f, ParamType1& p1, ParamType2& p2)
308 : function (f), param1 (p1), param2 (p2) {}
310 void modalStateFinished (
int returnValue) {
function (returnValue, param1, param2); }
313 const FunctionType
function;
320 template <
typename ComponentType>
324 typedef void (*FunctionType) (int, ComponentType*);
326 ComponentCaller1 (FunctionType& f, ComponentType* c)
327 : function (f), comp (c) {}
329 void modalStateFinished (
int returnValue)
331 function (returnValue,
static_cast <ComponentType*
> (comp.get()));
335 const FunctionType
function;
341 template <
typename ComponentType,
typename ParamType1>
345 typedef void (*FunctionType) (int, ComponentType*, ParamType1);
347 ComponentCaller2 (FunctionType& f, ComponentType* c, ParamType1 p1)
348 : function (f), comp (c), param1 (p1) {}
350 void modalStateFinished (
int returnValue)
352 function (returnValue,
static_cast <ComponentType*
> (comp.get()), param1);
356 const FunctionType
function;
369 #endif // JUCE_MODALCOMPONENTMANAGER_H_INCLUDED