Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4SoQt Class Reference

#include <G4SoQt.hh>

Inheritance diagram for G4SoQt:
G4VInteractorManager

Public Member Functions

void AddDispatcher (G4DispatchFunction)
 
void AddSecondaryLoopPostAction (G4SecondaryLoopAction)
 
void AddSecondaryLoopPreAction (G4SecondaryLoopAction)
 
void AddShell (G4Interactor)
 
void DisableSecondaryLoop ()
 
void DispatchEvent (void *)
 
void EnableSecondaryLoop ()
 
void ExitSecondaryLoop ()
 
void FlushAndWaitExecution ()
 
char ** GetArguments (int *)
 
G4Interactor GetCreatedInteractor ()
 
char * GetCreationString ()
 
void * GetEvent ()
 
int GetExitSecondaryLoopCode ()
 
G4Interactor GetMainInteractor ()
 
G4Interactor GetParentInteractor ()
 
G4bool Inited ()
 
bool IsExternalApp ()
 
void PutStringInResourceDatabase (char *)
 
void RemoveDispatcher (G4DispatchFunction)
 
void RemoveShell (G4Interactor)
 
void RequireExitSecondaryLoop (int)
 
void SecondaryLoop ()
 
void SecondaryLoopPostActions ()
 
void SecondaryLoopPreActions ()
 
void SetArguments (int, char **)
 
void SetCreatedInteractor (G4Interactor)
 
void SetCreationString (char *)
 
void SetMainInteractor (G4Interactor)
 
void SetParentInteractor (G4Interactor)
 
virtual ~G4SoQt ()
 

Static Public Member Functions

static G4SoQtgetInstance ()
 

Private Member Functions

 G4SoQt ()
 
 G4SoQt (const G4SoQt &)
 
G4SoQtoperator= (const G4SoQt &)
 

Private Attributes

G4bool alreadyInSecondaryLoop
 
int argc
 
char ** argv
 
G4Interactor createdInteractor
 
char * creationString
 
std::vector< G4DispatchFunctiondispatchers
 
int exitSecondaryLoop
 
bool externalApp
 
G4Interactor mainInteractor
 
G4Interactor parentInteractor
 
std::vector< G4SecondaryLoopActionpostActions
 
std::vector< G4SecondaryLoopActionpreActions
 
G4bool secondaryLoopEnabled
 
std::vector< G4Interactorshells
 

Static Private Attributes

static G4SoQtinstance = NULL
 

Detailed Description

Definition at line 46 of file G4SoQt.hh.

Constructor & Destructor Documentation

◆ ~G4SoQt()

G4SoQt::~G4SoQt ( )
virtual

Definition at line 103 of file G4SoQt.cc.

104{
105 if(this==instance) {
106 instance = NULL;
107 }
108}
static G4SoQt * instance
Definition: G4SoQt.hh:65

References instance.

◆ G4SoQt() [1/2]

G4SoQt::G4SoQt ( const G4SoQt )
private

◆ G4SoQt() [2/2]

G4SoQt::G4SoQt ( )
private

Definition at line 64 of file G4SoQt.cc.

67{
68 externalApp = false;
69
70 // FWJ in G4Qt this is used. qApp is Qt global pointer
71 // to the (one and only one) QApplication object:
72 // new QApplication (*p_argn, args);
73 // if(!qApp) {
74
75 // FWJ detects existence of Qt UI or other running qApp
76 if (qApp) externalApp = true;
77
78 QWidget* mainWin = SoQt::init("Geant4");
79
80 // FWJ Cf Xt:
81 QtInited = TRUE;
82
83 // FWJ DEBUG
84 // G4cout << "G4SoQt: mainWin=" << mainWin << G4endl;
85 // G4cout << "G4SoQt: toplevelwidget=" << SoQt::getTopLevelWidget() << G4endl;
86
87// FWJ CAN'T GET MENUBAR THIS WAY OR BY CAST
88 // QWidget* toplevel = SoQt::getTopLevelWidget();
89 // QMenuBar* menubar = QMainWindow::menuBar();
90 // G4cout << "G4OpenInventorQtExaminerViewer menubar=" << menubar << G4endl;
91
92
93 // FWJ will this work?
94 SetMainInteractor(mainWin);
95 // SetMainInteractor(qApp);
96 // AddDispatcher ((G4DispatchFunction)XtDispatchEvent);
97
98// FWJ no locale for now (see G4Qt.cc)
99
100}
static G4bool QtInited
Definition: G4SoQt.cc:50
#define TRUE
Definition: Globals.hh:27
bool externalApp
Definition: G4SoQt.hh:68
void SetMainInteractor(G4Interactor)

References externalApp, QtInited, G4VInteractorManager::SetMainInteractor(), and TRUE.

Referenced by getInstance().

Member Function Documentation

◆ AddDispatcher()

void G4VInteractorManager::AddDispatcher ( G4DispatchFunction  a_dispatcher)
inherited

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

Definition at line 150 of file G4VInteractorManager.cc.

155{
156 if(a_dispatcher==NULL) return;
157 if(std::find(dispatchers.begin(),dispatchers.end(),a_dispatcher)!=dispatchers.end()) return;
158 dispatchers.push_back(a_dispatcher);
159}
std::vector< G4DispatchFunction > dispatchers

References G4VInteractorManager::dispatchers.

Referenced by G4Win32::G4Win32(), and G4Xt::G4Xt().

◆ AddSecondaryLoopPostAction()

void G4VInteractorManager::AddSecondaryLoopPostAction ( G4SecondaryLoopAction  a_postAction)
inherited

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

Definition at line 214 of file G4VInteractorManager.cc.

219{
220 if(a_postAction==NULL) return;
221 if(std::find(postActions.begin(),postActions.end(),a_postAction)!=postActions.end()) return;
222 postActions.push_back(a_postAction);
223}
std::vector< G4SecondaryLoopAction > postActions

References G4VInteractorManager::postActions.

◆ AddSecondaryLoopPreAction()

void G4VInteractorManager::AddSecondaryLoopPreAction ( G4SecondaryLoopAction  a_preAction)
inherited

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

Definition at line 192 of file G4VInteractorManager.cc.

197{
198 if(a_preAction==NULL) return;
199 if(std::find(preActions.begin(),preActions.end(),a_preAction)!=preActions.end()) return;
200 preActions.push_back(a_preAction);
201}
std::vector< G4SecondaryLoopAction > preActions

References G4VInteractorManager::preActions.

◆ AddShell()

void G4VInteractorManager::AddShell ( G4Interactor  a_shell)
inherited

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

Definition at line 287 of file G4VInteractorManager.cc.

292{
293 if(a_shell==NULL) return;
294 if(std::find(shells.begin(),shells.end(),a_shell)!=shells.end()) return;
295 shells.push_back(a_shell);
296}
std::vector< G4Interactor > shells

References G4VInteractorManager::shells.

Referenced by G4OpenGLXmViewer::GetXmConnection(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ DisableSecondaryLoop()

void G4VInteractorManager::DisableSecondaryLoop ( )
inherited

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

Definition at line 142 of file G4VInteractorManager.cc.

146{
148}
#define FALSE
Definition: Globals.hh:23

References FALSE, and G4VInteractorManager::secondaryLoopEnabled.

Referenced by G4UIQt::SessionStart(), G4UIXm::SessionStart(), and G4UIWin32::SessionStart().

◆ DispatchEvent()

void G4VInteractorManager::DispatchEvent ( void *  a_event)
inherited

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

Definition at line 176 of file G4VInteractorManager.cc.

181{
182 G4int dispatchern = dispatchers.size();
184 for(G4int count=0;count<dispatchern;count++) {
185 func = dispatchers[count];
186 if(func!=NULL) {
187 if(func(a_event)==true) return;
188 }
189 }
190}
int G4int
Definition: G4Types.hh:85
G4bool(* G4DispatchFunction)(void *)

References G4VInteractorManager::dispatchers.

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

◆ EnableSecondaryLoop()

void G4VInteractorManager::EnableSecondaryLoop ( )
inherited

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

Definition at line 134 of file G4VInteractorManager.cc.

138{
140}

References G4VInteractorManager::secondaryLoopEnabled, and TRUE.

Referenced by G4UIQt::SessionStart(), G4UIXm::SessionStart(), and G4UIWin32::SessionStart().

◆ ExitSecondaryLoop()

void G4SoQt::ExitSecondaryLoop ( )

Definition at line 153 of file G4SoQt.cc.

154{
155 // FWJ DEBUG
156 // G4cout << "G4SoQt: EXIT SECONDARY LOOP externalApp=" <<
157 // externalApp << G4endl;
158
159 if (externalApp) return;
160 SoQt::exitMainLoop();
161}

References externalApp.

◆ FlushAndWaitExecution()

void G4SoQt::FlushAndWaitExecution ( )
virtual

Implements G4VInteractorManager.

Definition at line 123 of file G4SoQt.cc.

124{
125 // FWJ the following is used in G4Qt:
126 // if(!qApp) return;
127 // This starts the Qt main loop:
128 // qApp->processEvents();
129
130 // FWJ no, should be done in secondaryLoop()!
131 // SoQt::mainLoop();
132}

◆ GetArguments()

char ** G4VInteractorManager::GetArguments ( int *  a_argc)
inherited

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

Definition at line 107 of file G4VInteractorManager.cc.

112{
113 if(a_argc!=NULL) *a_argc = argc;
114 return argv;
115}

References G4VInteractorManager::argc, and G4VInteractorManager::argv.

◆ GetCreatedInteractor()

G4Interactor G4VInteractorManager::GetCreatedInteractor ( )
inherited

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

Definition at line 339 of file G4VInteractorManager.cc.

343{
344 return createdInteractor;
345}

References G4VInteractorManager::createdInteractor.

◆ GetCreationString()

char * G4VInteractorManager::GetCreationString ( )
inherited

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

Definition at line 356 of file G4VInteractorManager.cc.

360{
361 return creationString;
362}

References G4VInteractorManager::creationString.

Referenced by G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ GetEvent()

void * G4SoQt::GetEvent ( )
virtual

Implements G4VInteractorManager.

Definition at line 116 of file G4SoQt.cc.

117{
118 return 0;
119}

◆ GetExitSecondaryLoopCode()

G4int G4VInteractorManager::GetExitSecondaryLoopCode ( )
inherited

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

Definition at line 279 of file G4VInteractorManager.cc.

283{
284 return exitSecondaryLoop;
285}

References G4VInteractorManager::exitSecondaryLoop.

◆ getInstance()

G4SoQt * G4SoQt::getInstance ( )
static

Definition at line 54 of file G4SoQt.cc.

55{
56 if (instance==NULL) {
57 instance = new G4SoQt();
58 }
59 return instance;
60}
G4SoQt()
Definition: G4SoQt.cc:64

References G4SoQt(), and instance.

Referenced by G4OpenInventorQt::Initialize().

◆ GetMainInteractor()

G4Interactor G4VInteractorManager::GetMainInteractor ( )
inherited

◆ GetParentInteractor()

G4Interactor G4VInteractorManager::GetParentInteractor ( )
inherited

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

Definition at line 322 of file G4VInteractorManager.cc.

326{
327 return parentInteractor;
328}

References G4VInteractorManager::parentInteractor.

Referenced by G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ Inited()

G4bool G4SoQt::Inited ( )
virtual

Implements G4VInteractorManager.

Definition at line 110 of file G4SoQt.cc.

111{
112 return QtInited;
113}

References QtInited.

◆ IsExternalApp()

bool G4SoQt::IsExternalApp ( )

Definition at line 163 of file G4SoQt.cc.

164{
165 return externalApp;
166}

References externalApp.

◆ operator=()

G4SoQt & G4SoQt::operator= ( const G4SoQt )
private

◆ PutStringInResourceDatabase()

void G4VInteractorManager::PutStringInResourceDatabase ( char *  )
inherited

◆ RemoveDispatcher()

void G4VInteractorManager::RemoveDispatcher ( G4DispatchFunction  a_dispatcher)
inherited

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

Definition at line 161 of file G4VInteractorManager.cc.

166{
167 std::vector<G4DispatchFunction>::iterator it;
168 for (it = dispatchers.begin(); it != dispatchers.end(); it++) {
169 if (*it == a_dispatcher) {
170 dispatchers.erase(it);
171 break;
172 }
173 }
174}

References G4VInteractorManager::dispatchers.

◆ RemoveShell()

void G4VInteractorManager::RemoveShell ( G4Interactor  a_shell)
inherited

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

Definition at line 298 of file G4VInteractorManager.cc.

303{
304 std::vector<G4Interactor>::iterator it;
305 for (it = shells.begin(); it != shells.end(); it++) {
306 if (*it == a_shell) {
307 shells.erase(it);
308 break;
309 }
310 }
311}

References G4VInteractorManager::shells.

Referenced by G4OpenGLXmViewer::~G4OpenGLXmViewer(), G4OpenInventorWinViewer::~G4OpenInventorWinViewer(), G4OpenInventorXtExtendedViewer::~G4OpenInventorXtExtendedViewer(), and G4OpenInventorXtViewer::~G4OpenInventorXtViewer().

◆ RequireExitSecondaryLoop()

void G4VInteractorManager::RequireExitSecondaryLoop ( int  a_code)
inherited

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

Definition at line 265 of file G4VInteractorManager.cc.

270{
271 if(secondaryLoopEnabled==FALSE) return;
272 if(a_code==0) a_code = 1;
273 exitSecondaryLoop = a_code;
275 // for(G4int count=0;count<shelln;count++) XWidgetIconify(shells[count]);
276 // if(shelln!=0) XSync(XtDisplay(topWidget),False);
277}

References G4VInteractorManager::alreadyInSecondaryLoop, G4VInteractorManager::exitSecondaryLoop, FALSE, and G4VInteractorManager::secondaryLoopEnabled.

Referenced by G4OpenInventorViewer::Escape().

◆ SecondaryLoop()

void G4SoQt::SecondaryLoop ( )
virtual

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

Reimplemented from G4VInteractorManager.

Definition at line 136 of file G4SoQt.cc.

137{
138 if (externalApp) return;
139
140 // FWJ DEBUG
141 // G4cout <<
142 // "ENTERING OIQT VIEWER SECONDARY LOOP" << G4endl;
143 // else
144
145 G4cout <<
146 "ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT" << G4endl;
147
148 SoQt::mainLoop();
149}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References externalApp, G4cout, and G4endl.

◆ SecondaryLoopPostActions()

void G4VInteractorManager::SecondaryLoopPostActions ( )
inherited

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

Definition at line 225 of file G4VInteractorManager.cc.

229{
230 G4int postActionn = postActions.size();
231 for(G4int count=0;count<postActionn;count++) {
232 if(postActions[count]!=NULL) postActions[count]();
233 }
234}

References G4VInteractorManager::postActions.

Referenced by G4VInteractorManager::SecondaryLoop().

◆ SecondaryLoopPreActions()

void G4VInteractorManager::SecondaryLoopPreActions ( )
inherited

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

Definition at line 203 of file G4VInteractorManager.cc.

207{
208 G4int preActionn = preActions.size();
209 for(G4int count=0;count<preActionn;count++) {
210 if(preActions[count]!=NULL) preActions[count]();
211 }
212}

References G4VInteractorManager::preActions.

Referenced by G4VInteractorManager::SecondaryLoop().

◆ SetArguments()

void G4VInteractorManager::SetArguments ( int  a_argc,
char **  a_argv 
)
inherited

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

Definition at line 79 of file G4VInteractorManager.cc.

85{
86 // Free previous values.
87 if(argv!=NULL) {
88 for(G4int argi=0;argi<argc;argi++) {
89 if(argv[argi]!=NULL) free(argv[argi]);
90 }
91 free(argv);
92 }
93 argv = NULL;
94 argc = 0;
95 // Set new values.
96 if(a_argc!=0) {
97 argv = (char**)malloc(a_argc * sizeof(char*));
98 if(argv!=NULL) {
99 argc = a_argc;
100 for(G4int argi=0;argi<a_argc;argi++) {
101 argv[argi] = (char*)NewString (a_argv[argi]);
102 }
103 }
104 }
105}
#define NewString(str)

References G4VInteractorManager::argc, G4VInteractorManager::argv, free, and NewString.

Referenced by G4Qt::G4Qt(), and G4Xt::G4Xt().

◆ SetCreatedInteractor()

void G4VInteractorManager::SetCreatedInteractor ( G4Interactor  a_interactor)
inherited

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

Definition at line 330 of file G4VInteractorManager.cc.

335{
336 createdInteractor = a_interactor;
337}

References G4VInteractorManager::createdInteractor.

Referenced by G4OpenInventorQtViewer::Initialise(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ SetCreationString()

void G4VInteractorManager::SetCreationString ( char *  a_string)
inherited

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

Definition at line 347 of file G4VInteractorManager.cc.

352{
353 creationString = a_string;
354}

References G4VInteractorManager::creationString.

◆ SetMainInteractor()

void G4VInteractorManager::SetMainInteractor ( G4Interactor  a_main)
inherited

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

Definition at line 117 of file G4VInteractorManager.cc.

122{
123 mainInteractor = a_main;
124}

References G4VInteractorManager::mainInteractor.

Referenced by G4Qt::G4Qt(), G4SoQt(), G4Win32::G4Win32(), and G4Xt::G4Xt().

◆ SetParentInteractor()

void G4VInteractorManager::SetParentInteractor ( G4Interactor  a_interactor)
inherited

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

Definition at line 313 of file G4VInteractorManager.cc.

318{
319 parentInteractor = a_interactor;
320}

References G4VInteractorManager::parentInteractor.

Field Documentation

◆ alreadyInSecondaryLoop

G4bool G4VInteractorManager::alreadyInSecondaryLoop
privateinherited

◆ argc

int G4VInteractorManager::argc
privateinherited

◆ argv

char** G4VInteractorManager::argv
privateinherited

◆ createdInteractor

G4Interactor G4VInteractorManager::createdInteractor
privateinherited

◆ creationString

char* G4VInteractorManager::creationString
privateinherited

◆ dispatchers

std::vector<G4DispatchFunction> G4VInteractorManager::dispatchers
privateinherited

◆ exitSecondaryLoop

int G4VInteractorManager::exitSecondaryLoop
privateinherited

◆ externalApp

bool G4SoQt::externalApp
private

Definition at line 68 of file G4SoQt.hh.

Referenced by ExitSecondaryLoop(), G4SoQt(), IsExternalApp(), and SecondaryLoop().

◆ instance

G4SoQt * G4SoQt::instance = NULL
staticprivate

Definition at line 65 of file G4SoQt.hh.

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

◆ mainInteractor

G4Interactor G4VInteractorManager::mainInteractor
privateinherited

◆ parentInteractor

G4Interactor G4VInteractorManager::parentInteractor
privateinherited

◆ postActions

std::vector<G4SecondaryLoopAction> G4VInteractorManager::postActions
privateinherited

◆ preActions

std::vector<G4SecondaryLoopAction> G4VInteractorManager::preActions
privateinherited

◆ secondaryLoopEnabled

G4bool G4VInteractorManager::secondaryLoopEnabled
privateinherited

◆ shells

std::vector<G4Interactor> G4VInteractorManager::shells
privateinherited

The documentation for this class was generated from the following files: