openshot-audio  0.1.6
juce_ApplicationBase.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_APPLICATIONBASE_H_INCLUDED
26 #define JUCE_APPLICATIONBASE_H_INCLUDED
27 
28 
29 //==============================================================================
86 {
87 protected:
88  //==============================================================================
90 
91 public:
93  virtual ~JUCEApplicationBase();
94 
95  //==============================================================================
97  static JUCEApplicationBase* getInstance() noexcept { return appInstance; }
98 
99  //==============================================================================
101  virtual const String getApplicationName() = 0;
102 
104  virtual const String getApplicationVersion() = 0;
105 
115  virtual bool moreThanOneInstanceAllowed() = 0;
116 
136  virtual void initialise (const String& commandLineParameters) = 0;
137 
138  /* Called to allow the application to clear up before exiting.
139 
140  After JUCEApplication::quit() has been called, the event-dispatch loop will
141  terminate, and this method will get called to allow the app to sort itself
142  out.
143 
144  Be careful that nothing happens in this method that might rely on messages
145  being sent, or any kind of window activity, because the message loop is no
146  longer running at this point.
147 
148  @see DeletedAtShutdown
149  */
150  virtual void shutdown() = 0;
151 
156  virtual void anotherInstanceStarted (const String& commandLine) = 0;
157 
170  virtual void systemRequestedQuit() = 0;
171 
175  virtual void suspended() = 0;
176 
180  virtual void resumed() = 0;
181 
190  virtual void unhandledException (const std::exception*,
191  const String& sourceFilename,
192  int lineNumber) = 0;
193 
194  //==============================================================================
208  static void quit();
209 
210  //==============================================================================
214  static StringArray JUCE_CALLTYPE getCommandLineParameterArray();
215 
219  static String JUCE_CALLTYPE getCommandLineParameters();
220 
221  //==============================================================================
230  void setApplicationReturnValue (int newReturnValue) noexcept;
231 
235  int getApplicationReturnValue() const noexcept { return appReturnValue; }
236 
237  //==============================================================================
240  static bool isStandaloneApp() noexcept { return createInstance != nullptr; }
241 
248  bool isInitialising() const noexcept { return stillInitialising; }
249 
250 
251  //==============================================================================
252  #ifndef DOXYGEN
253  // The following methods are for internal use only...
254  static int main();
255  static int main (int argc, const char* argv[]);
256 
257  static void appWillTerminateByForce();
258  typedef JUCEApplicationBase* (*CreateInstanceFunction)();
259  static CreateInstanceFunction createInstance;
260 
261  virtual bool initialiseApp();
262  int shutdownApp();
263  static void JUCE_CALLTYPE sendUnhandledException (const std::exception*, const char* sourceFile, int lineNumber);
264  bool sendCommandLineToPreexistingInstance();
265  #endif
266 
267 private:
268  //==============================================================================
269  static JUCEApplicationBase* appInstance;
270  int appReturnValue;
271  bool stillInitialising;
272 
274  friend struct MultipleInstanceHandler;
276  ScopedPointer<MultipleInstanceHandler> multipleInstanceHandler;
277 
279 };
280 
281 
282 #endif // JUCE_APPLICATIONBASE_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
int getApplicationReturnValue() const noexcept
Definition: juce_ApplicationBase.h:235
static bool isStandaloneApp() noexcept
Definition: juce_ApplicationBase.h:240
#define JUCE_CALLTYPE
Definition: juce_PlatformDefs.h:50
Definition: juce_String.h:43
static JUCEApplicationBase * getInstance() noexcept
Definition: juce_ApplicationBase.h:97
int main()
Definition: Main.cpp:45
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
Definition: juce_ApplicationBase.h:85
Definition: juce_ScopedPointer.h:70
static CreateInstanceFunction createInstance
Definition: juce_ApplicationBase.h:259
Definition: juce_ApplicationCommandID.h:62
Definition: juce_StringArray.h:39
Definition: juce_ContainerDeletePolicy.h:44
bool isInitialising() const noexcept
Definition: juce_ApplicationBase.h:248
#define JUCE_DECLARE_NON_COPYABLE(className)
Definition: juce_PlatformDefs.h:191
Definition: juce_ApplicationBase.cpp:83