Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

G4Xt Class Reference

#include <G4Xt.hh>

Inheritance diagram for G4Xt:

Inheritance graph
[legend]
Collaboration diagram for G4Xt:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void PutStringInResourceDatabase (char *)
G4bool Inited ()
void * GetEvent ()
void FlushAndWaitExecution ()
virtual ~G4Xt ()

Static Public Member Functions

G4XtgetInstance ()
G4XtgetInstance (int, char **, char *)

Private Member Functions

 G4Xt (int, char **, char *)

Static Private Attributes

G4Xtinstance = NULL

Constructor & Destructor Documentation

G4Xt::~G4Xt  )  [virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 134 of file G4Xt.cc.

References instance.

00138 {
00139   if(this==instance) {
00140     instance = NULL;
00141   }
00142 }

G4Xt::G4Xt int  a_argn,
char **  a_args,
char *  a_class
[private]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 81 of file G4Xt.cc.

References G4VInteractorManager::AddDispatcher(), appContext, argn, args, G4DispatchFunction, G4VInteractorManager::SetArguments(), G4VInteractorManager::SetMainInteractor(), topWidget, and XtInited.

Referenced by getInstance().

00088 {
00089   if(XtInited==FALSE) {  //Xt should be Inited once !
00090     if(a_argn!=0) {  //Save args.
00091       args = (char**)malloc(a_argn * sizeof(char*));
00092       if(args!=NULL) {
00093         argn = a_argn;
00094         for(int argi=0;argi<a_argn;argi++) {
00095           args[argi] = (char*)NewString (a_args[argi]);
00096         }
00097       }
00098     }
00099 #if XtSpecificationRelease == 4
00100     Cardinal     narg;
00101     narg         = (Cardinal)a_argn;
00102 #else
00103     int          narg;
00104     narg         = a_argn;
00105 #endif
00106     Arg          xargs[1];
00107     XtSetArg     (xargs[0],XtNgeometry,"100x100"); 
00108     topWidget    = XtAppInitialize (&appContext,a_class,
00109                                     NULL,(Cardinal)0,
00110                                     &narg,a_args,NULL,
00111                                     xargs,1);
00112     if(topWidget==NULL) {
00113       G4cout        << "G4Xt : Unable to init Xt." << G4endl;
00114     }
00115     // Restore a_args. XtAppInitialize corrupts the given ones !!!
00116     if( (a_argn!=0) && (args!=NULL)) {
00117       for(int argi=0;argi<a_argn;argi++) {
00118         if(args[argi]!=NULL)
00119           strcpy(a_args[argi],args[argi]);
00120         else
00121           a_args[argi] = NULL;
00122       }
00123     }
00124     // If topWidget not realized, pbs with Inventor shells.
00125     XtSetMappedWhenManaged (topWidget,False);
00126     XtRealizeWidget (topWidget);
00127     XtInited = TRUE;
00128   }
00129   SetArguments      (argn,args);
00130   SetMainInteractor (topWidget);
00131   AddDispatcher     ((G4DispatchFunction)XtDispatchEvent);
00132 }

Here is the call graph for this function:


Member Function Documentation

void G4Xt::FlushAndWaitExecution  )  [virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VInteractorManager.

Definition at line 183 of file G4Xt.cc.

References topWidget.

00187 {
00188   if(topWidget==NULL) return;
00189   XSync(XtDisplay(topWidget),False);
00190 }

void * G4Xt::GetEvent  )  [virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VInteractorManager.

Definition at line 152 of file G4Xt.cc.

References appContext, and topWidget.

Referenced by G4UIXm::GetHelpChoice(), G4UIXaw::GetHelpChoice(), G4UIXm::SecondaryLoop(), G4UIXaw::SecondaryLoop(), G4UIXm::SessionStart(), and G4UIXaw::SessionStart().

00156 {
00157   static XEvent  event;
00158   if(appContext==NULL) return NULL;
00159   if(topWidget==NULL) return NULL;
00160   XtAppNextEvent (appContext, &event);
00161   return         &event;
00162 }

G4Xt * G4Xt::getInstance int  a_argn,
char **  a_args,
char *  a_class
[static]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 67 of file G4Xt.cc.

References G4Xt(), and instance.

00074 {
00075   if (instance==NULL) {
00076     instance = new G4Xt(a_argn,a_args,a_class);
00077   }
00078   return instance;
00079 }

Here is the call graph for this function:

G4Xt * G4Xt::getInstance  )  [static]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 59 of file G4Xt.cc.

Referenced by G4UIXaw::G4UIXaw(), G4UIXm::G4UIXm(), G4UIXm::GetHelpChoice(), G4UIXaw::GetHelpChoice(), G4UIXm::SecondaryLoop(), G4UIXaw::SecondaryLoop(), G4UIXm::SessionStart(), and G4UIXaw::SessionStart().

00063 {
00064   return G4Xt::getInstance (0,NULL,(char*)"Geant4");
00065 }

G4bool G4Xt::Inited  )  [virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VInteractorManager.

Definition at line 144 of file G4Xt.cc.

References XtInited.

00148 {
00149   return XtInited;
00150 }

void G4Xt::PutStringInResourceDatabase char *  a_string  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4VInteractorManager.

Definition at line 164 of file G4Xt.cc.

References topWidget.

00169 {
00170   if(topWidget==NULL)  return;
00171   if(a_string==NULL)   return;
00172   Display*             dpy   = XtDisplay(topWidget);
00173   XrmDatabase          dbres = XrmGetStringDatabase (a_string);
00174   if(dbres==NULL)      return;
00175   XrmDatabase          database = XrmGetDatabase (dpy);
00176   if(database!=NULL)  {
00177     XrmMergeDatabases  (dbres,&database);
00178   } else {
00179     XrmSetDatabase     (dpy,dbres);
00180   }
00181 }


Member Data Documentation

G4Xt * G4Xt::instance = NULL [static, private]
 

Definition at line 51 of file G4Xt.cc.

Referenced by getInstance(), and ~G4Xt().


The documentation for this class was generated from the following files:
Generated on Fri Jun 22 11:08:08 2007 by doxygen 1.3.4