#ifndef ROOT_TApplication
#define ROOT_TApplication
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TQObject
#include "TQObject.h"
#endif
#ifndef ROOT_TApplicationImp
#include "TApplicationImp.h"
#endif
class TObjArray;
class TTimer;
class TSignalHandler;
class TApplication : public TObject, public TQObject {
public:
enum EStatusBits {
kProcessRemotely = BIT(15),
kDefaultApplication = BIT(16)
};
enum EFileBits {
kExpression = BIT(14)
};
enum EExitOnException {
kDontExit,
kExit,
kAbort
};
private:
Int_t fArgc;
char **fArgv;
TApplicationImp *fAppImp;
Bool_t fIsRunning;
Bool_t fReturnFromRun;
Bool_t fNoLog;
Bool_t fNoLogo;
Bool_t fQuit;
Bool_t fUseMemstat;
TObjArray *fFiles;
TString fWorkDir;
TString fIdleCommand;
TTimer *fIdleTimer;
TSignalHandler *fSigHandler;
EExitOnException fExitOnException;
static Bool_t fgGraphNeeded;
static Bool_t fgGraphInit;
TApplication(const TApplication&);
TApplication& operator=(const TApplication&);
protected:
TApplication *fAppRemote;
static TList *fgApplications;
TApplication();
virtual Long_t ProcessRemote(const char *line, Int_t *error = 0);
virtual void Help(const char *line);
virtual void LoadGraphicsLibs();
virtual void MakeBatch();
void SetSignalHandler(TSignalHandler *sh) { fSigHandler = sh; }
static Int_t ParseRemoteLine(const char *ln,
TString &hostdir, TString &user,
Int_t &dbg, TString &script);
static TApplication *Open(const char *url, Int_t debug, const char *script);
static void Close(TApplication *app);
public:
TApplication(const char *appClassName, Int_t *argc, char **argv,
void *options = 0, Int_t numOptions = 0);
virtual ~TApplication();
void InitializeGraphics();
virtual void GetOptions(Int_t *argc, char **argv);
TSignalHandler *GetSignalHandler() const { return fSigHandler; }
virtual void SetEchoMode(Bool_t mode);
virtual void HandleException(Int_t sig);
virtual void HandleIdleTimer();
virtual Bool_t HandleTermInput() { return kFALSE; }
virtual void Init() { fAppImp->Init(); }
virtual Long_t ProcessLine(const char *line, Bool_t sync = kFALSE, Int_t *error = 0);
virtual Long_t ProcessFile(const char *file, Int_t *error = 0, Bool_t keep = kFALSE);
virtual void Run(Bool_t retrn = kFALSE);
virtual void SetIdleTimer(UInt_t idleTimeInSec, const char *command);
virtual void RemoveIdleTimer();
const char *GetIdleCommand() const { return fIdleCommand; }
virtual void StartIdleing();
virtual void StopIdleing();
EExitOnException ExitOnException(EExitOnException opt = kExit);
virtual const char *ApplicationName() const { return fAppImp->ApplicationName(); }
virtual void Show() { fAppImp->Show(); }
virtual void Hide() { fAppImp->Hide(); }
virtual void Iconify() { fAppImp->Iconify(); }
virtual void Open() { fAppImp->Open(); }
virtual void Raise() { fAppImp->Raise(); }
virtual void Lower() { fAppImp->Lower(); }
virtual Bool_t IsCmdThread() { return fAppImp ? fAppImp->IsCmdThread() : kTRUE; }
virtual TApplicationImp *GetApplicationImp() { return fAppImp;}
virtual void ls(Option_t *option="") const;
Int_t Argc() const { return fArgc; }
char **Argv() const { return fArgv; }
char *Argv(Int_t index) const;
Bool_t NoLogOpt() const { return fNoLog; }
Bool_t NoLogoOpt() const { return fNoLogo; }
Bool_t QuitOpt() const { return fQuit; }
TObjArray *InputFiles() const { return fFiles; }
const char *WorkingDirectory() const { return fWorkDir; }
void ClearInputFiles();
TApplication *GetAppRemote() const { return fAppRemote; }
Bool_t IsRunning() const { return fIsRunning; }
Bool_t ReturnFromRun() const { return fReturnFromRun; }
void SetReturnFromRun(Bool_t ret) { fReturnFromRun = ret; }
virtual void LineProcessed(const char *line);
virtual void Terminate(Int_t status = 0);
virtual void KeyPressed(Int_t key);
virtual void ReturnPressed(char *text );
virtual Int_t TabCompletionHook(char *buf, int *pLoc, std::ostream& out);
static Long_t ExecuteFile(const char *file, Int_t *error = 0, Bool_t keep = kFALSE);
static TList *GetApplications();
static void CreateApplication();
static void NeedGraphicsLibs();
ClassDef(TApplication,0)
};
R__EXTERN TApplication *gApplication;
#endif