library: libCore #include "TApplication.h"

# TApplication

class description - source file - inheritance tree (.pdf)

## class TApplication : public TObject, public TQObject

| Inheritance Chart:
`TObject`
`TQObject`
| <- | `TApplication` |
<- |
`TGApplication` |
`TRint` |

        protected:

                       TApplication()
          virtual void Help(const char* line)
          virtual void InitializeColors()
          virtual void LoadGraphicsLibs()
          virtual void MakeBatch()
                  void SetSignalHandler(TSignalHandler* sh)

        public:

                                   TApplication(const char* appClassName, Int_t* argc, char** argv, void* options = 0, Int_t numOptions = 0)
                                   TApplication(const TApplication&)
                           virtual ~TApplication()
               virtual const char* ApplicationName() const
                             Int_t Argc() const
                            char** Argv() const
                             char* Argv(Int_t index) const
                    static TClass* Class()
                              void ClearInputFiles()
                       static void CreateApplication()
          virtual TApplicationImp* GetApplicationImp()
                       const char* GetIdleCommand() const
                      virtual void GetOptions(Int_t* argc, char** argv)
                   TSignalHandler* GetSignalHandler() const
                      virtual void HandleIdleTimer()
                    virtual Bool_t HandleTermInput()
                      virtual void Hide()
                      virtual void Iconify()
                      virtual void Init()
                        TObjArray* InputFiles() const
                   virtual TClass* IsA() const
                    virtual Bool_t IsCmdThread()
                            Bool_t IsRunning() const
                      virtual void KeyPressed(Int_t key)
                      virtual void Lower()
                            Bool_t NoLogoOpt() const
                            Bool_t NoLogOpt() const
                      virtual void Open()
                     TApplication& operator=(const TApplication&)
                    virtual Long_t ProcessFile(const char* line, Int_t* error = 0)
                    virtual Long_t ProcessLine(const char* line, Bool_t sync = kFALSE, Int_t* error = 0)
                            Bool_t QuitOpt() const
                      virtual void Raise()
                      virtual void RemoveIdleTimer()
                            Bool_t ReturnFromRun() const
                      virtual void ReturnPressed(char* text)
                      virtual void Run(Bool_t retrn = kFALSE)
                      virtual void SetEchoMode(Bool_t mode)
                      virtual void SetIdleTimer(UInt_t idleTimeInSec, const char* command)
                              void SetReturnFromRun(Bool_t ret)
                      virtual void Show()
                      virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      virtual void StartIdleing()
                      virtual void StopIdleing()
                      virtual void Streamer(TBuffer& b)
                              void StreamerNVirtual(TBuffer& b)
                      virtual void Terminate(Int_t status = 0)

### Data Members

        private:

                     Int_t fArgc           Number of com   mand line arguments
                    char** fArgv           Command line arguments
          TApplicationImp* fAppImp         !Window system specific application implementation
                    Bool_t fIsRunning      True when in event loop (Run() has been called)
                    Bool_t fReturnFromRun  When true return from Run()
                    Bool_t fNoLog          Do not process logon and logoff macros
                    Bool_t fNoLogo         Do not show splash screen and welcome message
                    Bool_t fQuit           Exit after having processed input files
                TObjArray* fFiles          Array of input files (TObjString's)
                   TString fIdleCommand    Command to execute while application is idle
                   TTimer* fIdleTimer      Idle timer
           TSignalHandler* fSigHandler     Interrupt handler

## Class Description

     TApplication

     This class creates the ROOT Application Environment that interfaces
     to the windowing system eventloop and eventhandlers.
     This class must be instantiated exactly once in any given
     application. Normally the specific application class inherits from
     TApplication (see TRint).

TApplication()

     Default ctor. Can be used by classes deriving from TApplication.

TApplication(const char *appClassName, Int_t *argc, char **argv, void *options, Int_t numOptions)

     Create an application environment. The application environment
     provides an interface to the graphics system and eventloop
     (be it X, Windoze, MacOS or BeOS). After creating the application
     object start the eventloop by calling its Run() method. The command
     line options recogized by TApplication are described in the GetOptions()
     method. The recognized options are removed from the argument array.
     The original list of argument options can be retrieved via the Argc()
     and Argv() methods. The appClassName "proofserv" is reserved for the
     PROOF system. The "options" and "numOptions" arguments are not used,
     except if you want to by-pass the argv processing by GetOptions()
     in which case you should specify numOptions<0. All options will
     still be available via the Argv() method for later use.

~TApplication()

     TApplication dtor.

void ClearInputFiles()

     Clear list containing macro files passed as program arguments.
     This method is called from TRint::Run() to ensure that the macro
     files are only executed the first time Run() is called.

void GetOptions(Int_t *argc, char **argv)

     Get and handle command line options. Arguments handled are removed
     from the argument array. The following arguments are handled:
        -b : run in batch mode without graphics
        -n : do not execute logon and logoff macros as specified in .rootrc
        -q : exit after processing command line macro files
        -l : do not show splash screen
     The last three options are only relevant in conjunction with TRint.
     The following help and info arguments are supported:
        -?      : print usage
        -h      : print usage
        --help  : print usage
        -config : print ./configure options

void HandleIdleTimer()

     Handle idle timeout. When this timer expires the registered idle command
     will be executed by this routine and a signal will be emitted.

void Help(const char *line)

     Print help on interpreter.

void InitializeColors()

     Initialize colors used by the TCanvas based graphics (via TColor objects).
     This method should be called before the ApplicationImp is created (which
     initializes the GUI colors).

void LoadGraphicsLibs()

     Load shared libs neccesary for graphics. These libraries are only
     loaded when gROOT->IsBatch() is kFALSE.

void MakeBatch()

     Switch to batch mode.

Long_t ProcessLine(const char *line, Bool_t sync, Int_t *err)

     Process a single command line, either a C++ statement or an interpreter
     command starting with a ".".
     Return the return value of the command casted to a long.

Long_t ProcessFile(const char *name, int *error)

     Process a file containing a C++ macro.

void Run(Bool_t retrn)

     Main application eventloop. Calls system dependent eventloop via gSystem.

void SetIdleTimer(UInt_t idleTimeInSec, const char *command)

     Set the command to be executed after the system has been idle for
     idleTimeInSec seconds. Normally called via TROOT::Idle(...).

void RemoveIdleTimer()

     Remove idle timer. Normally called via TROOT::Idle(0).

void StartIdleing()

     Called when system starts idleing.

void StopIdleing()

     Called when system stops idleing.

void Terminate(Int_t status)

     Terminate the application by call TSystem::Exit() unless application has
     been told to return from Run(), by a call to SetReturnFromRun().

void KeyPressed(Int_t key)

     Emit signal when console keyboard key was pressed.

void ReturnPressed(char *text )

     Emit signal when return key was pressed.

void SetEchoMode(Bool_t)

     Set console echo mode:

      mode = kTRUE  - echo input symbols
      mode = kFALSE - noecho input symbols

void CreateApplication()

     Static function used to create a default application environment.

### Inline Functions

                        void SetSignalHandler(TSignalHandler* sh)
             TSignalHandler* GetSignalHandler() const
                      Bool_t HandleTermInput()
                        void Init()
                 const char* GetIdleCommand() const
                 const char* ApplicationName() const
                        void Show()
                        void Hide()
            TApplicationImp* GetApplicationImp()
                        void Iconify()
                      Bool_t IsCmdThread()
                        void Open()
                        void Raise()
                        void Lower()
                       Int_t Argc() const
                      char** Argv() const
                       char* Argv(Int_t index) const
                      Bool_t NoLogOpt() const
                      Bool_t NoLogoOpt() const
                      Bool_t QuitOpt() const
                  TObjArray* InputFiles() const
                      Bool_t IsRunning() const
                      Bool_t ReturnFromRun() const
                        void SetReturnFromRun(Bool_t ret)
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
                TApplication TApplication(const TApplication&)
               TApplication& operator=(const TApplication&)

Author: Fons Rademakers 22/12/95
Last update: root/base:$Name: $:$Id: TApplication.cxx,v 1.66 2005/02/10 07:32:27 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *