JUCE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
JUCEApplicationBase Class Referenceabstract

Abstract base class for application classes. More...

Inherited by JUCEApplication.

Public Member Functions

virtual ~JUCEApplicationBase ()
 Destructor.
 
virtual const String getApplicationName ()=0
 Returns the application's name.
 
virtual const String getApplicationVersion ()=0
 Returns the application's version number.
 
virtual bool moreThanOneInstanceAllowed ()=0
 Checks whether multiple instances of the app are allowed.
 
virtual void initialise (const String &commandLineParameters)=0
 Called when the application starts.
 
virtual void shutdown ()=0
 
virtual void anotherInstanceStarted (const String &commandLine)=0
 Indicates that the user has tried to start up another instance of the app.
 
virtual void systemRequestedQuit ()=0
 Called when the operating system is trying to close the application.
 
virtual void suspended ()=0
 This method is called when the application is being put into background mode by the operating system.
 
virtual void resumed ()=0
 This method is called when the application is being woken from background mode by the operating system.
 
virtual void unhandledException (const std::exception *, const String &sourceFilename, int lineNumber)=0
 If any unhandled exceptions make it through to the message dispatch loop, this callback will be triggered, in case you want to log them or do some other type of error-handling.
 

Static Public Member Functions

static JUCEApplicationBasegetInstance () noexcept
 Returns the global instance of the application object that's running.
 
static bool isStandaloneApp () noexcept
 Returns true if this executable is running as an app (as opposed to being a plugin or other kind of shared library.
 

Protected Member Functions

 JUCEApplicationBase ()
 

Detailed Description

Abstract base class for application classes.

This class shouldn't be used directly - you'll normally use JUCEApplication as the base for your app, and that inherits from this, adding some more functionality to it.

See Also
JUCEApplication

Constructor & Destructor Documentation

JUCEApplicationBase::JUCEApplicationBase ( )
protected
virtual JUCEApplicationBase::~JUCEApplicationBase ( )
virtual

Destructor.

Member Function Documentation

static JUCEApplicationBase* JUCEApplicationBase::getInstance ( )
staticnoexcept

Returns the global instance of the application object that's running.

Referenced by JUCEApplication::getInstance().

virtual const String JUCEApplicationBase::getApplicationName ( )
pure virtual

Returns the application's name.

An application must implement this to name itself.

Implemented in JUCEApplication.

virtual const String JUCEApplicationBase::getApplicationVersion ( )
pure virtual

Returns the application's version number.

Implemented in JUCEApplication.

virtual bool JUCEApplicationBase::moreThanOneInstanceAllowed ( )
pure virtual

Checks whether multiple instances of the app are allowed.

If you application class returns true for this, more than one instance is permitted to run (except on the Mac where this isn't possible).

If it's false, the second instance won't start, but it you will still get a callback to anotherInstanceStarted() to tell you about this - which gives you a chance to react to what the user was trying to do.

Implemented in JUCEApplication.

virtual void JUCEApplicationBase::initialise ( const String commandLineParameters)
pure virtual

Called when the application starts.

This will be called once to let the application do whatever initialisation it needs, create its windows, etc.

After the method returns, the normal event-dispatch loop will be run, until the quit() method is called, at which point the shutdown() method will be called to let the application clear up anything it needs to delete.

If during the initialise() method, the application decides not to start-up after all, it can just call the quit() method and the event loop won't be run.

Parameters
commandLineParametersthe line passed in does not include the name of the executable, just the parameter list. To get the parameters as an array, you can call JUCEApplication::getCommandLineParameters()
See Also
shutdown, quit
virtual void JUCEApplicationBase::shutdown ( )
pure virtual
virtual void JUCEApplicationBase::anotherInstanceStarted ( const String commandLine)
pure virtual

Indicates that the user has tried to start up another instance of the app.

This will get called even if moreThanOneInstanceAllowed() is false.

Implemented in JUCEApplication.

virtual void JUCEApplicationBase::systemRequestedQuit ( )
pure virtual

Called when the operating system is trying to close the application.

The default implementation of this method is to call quit(), but it may be overloaded to ignore the request or do some other special behaviour instead. For example, you might want to offer the user the chance to save their changes before quitting, and give them the chance to cancel.

If you want to send a quit signal to your app, this is the correct method to call, because it means that requests that come from the system get handled in the same way as those from your own application code. So e.g. you'd call this method from a "quit" item on a menu bar.

Implemented in JUCEApplication.

virtual void JUCEApplicationBase::suspended ( )
pure virtual

This method is called when the application is being put into background mode by the operating system.

Implemented in JUCEApplication.

virtual void JUCEApplicationBase::resumed ( )
pure virtual

This method is called when the application is being woken from background mode by the operating system.

Implemented in JUCEApplication.

virtual void JUCEApplicationBase::unhandledException ( const std::exception *  ,
const String sourceFilename,
int  lineNumber 
)
pure virtual

If any unhandled exceptions make it through to the message dispatch loop, this callback will be triggered, in case you want to log them or do some other type of error-handling.

If the type of exception is derived from the std::exception class, the pointer passed-in will be valid. If the exception is of unknown type, this pointer will be null.

Implemented in JUCEApplication.

static bool JUCEApplicationBase::isStandaloneApp ( )
staticnoexcept

Returns true if this executable is running as an app (as opposed to being a plugin or other kind of shared library.


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