//*CMZ :  2.00/00 05/03/98  20.13.07  by  Fons Rademakers
//*-- Author :    Fons Rademakers   15/01/98

//*KEEP,CopyRight,T=C.
/*************************************************************************
 * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
 * Authors: Rene Brun, Fons Rademakers.                                  *
 * For list of contributors see $ROOTSYS/AA_CREDITS.                     *
 *                                                                       *
 * Permission to use, copy, modify and distribute this software and its  *
 * documentation for non-commercial purposes is hereby granted without   *
 * fee, provided that the above copyright notice appears in all copies   *
 * and that both the copyright notice and this permission notice appear  *
 * in the supporting documentation. The authors make no claims about the *
 * suitability of this software for any purpose. It is provided "as is"  *
 * without express or implied warranty.                                  *
 *************************************************************************/
//*KEND.

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRootApplication                                                     //
//                                                                      //
// This class create the ROOT native GUI version of the ROOT            //
// application environment. This in contrast the Win32 version.         //
// Once the native widgets work on Win32 this class can be folded into  //
// the TApplication class (since all graphic will go via TGXW).         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

//*KEEP,TRootApplication,T=C++.
#include "TRootApplication.h"
//*KEEP,TSystem.
#include "TSystem.h"
//*KEEP,TString.
#include "TString.h"
//*KEEP,TGClient.
#include "TGClient.h"
//*KEND.


ClassImp(TRootApplication)

//______________________________________________________________________________
 TRootApplication::TRootApplication(const char *appClassName,
                                   Int_t *argc, char **argv, void *, Int_t)
{
   fAppClassName  = StrDup(appClassName);
   fDisplay       = 0;

   GetOptions(argc, argv);

   if (!fDisplay)
      // Set DISPLAY based on utmp (only if DISPLAY is not yet set).
      gSystem->SetDisplay();

   fClient = new TGClient(fDisplay);
}

//______________________________________________________________________________
 TRootApplication::~TRootApplication()
{
   // Delete ROOT application environment.

   delete fAppClassName;
   delete fDisplay;
   delete fClient;
}

//______________________________________________________________________________
 void TRootApplication::GetOptions(Int_t *argc, char **argv)
{
   // Handle command line arguments. Arguments handled are removed from the
   // argument array. Currently only option "-display xserver" is considered.

   if (!argc) return;

   int i, j;
   for (i = 0; i < *argc; i++) {
      if (!strcmp(argv[i], "-display")) {
         if (argv[i+1] && strlen(argv[i+1]) && argv[i+1][0] != '-') {
            fDisplay = StrDup(argv[i+1]);
            argv[i]   = 0;
            argv[i+1] = 0;
            i++;
         }
      }
   }

   j = 0;
   for (i = 0; i < *argc; i++) {
      if (argv[i]) {
         argv[j] = argv[i];
         j++;
      }
   }

   *argc = j;
}



ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.