33#ifdef G4UI_BUILD_XAW_SESSION
35#include <X11/Intrinsic.h>
36#include <X11/StringDefs.h>
39#include <Xaw/Dialog.h>
40#include <Xaw/Command.h>
49static G4bool ConvertStringToInt(
const char*,
int&);
51static G4bool exitSession =
true;
52static G4bool exitPause =
true;
53static G4bool exitHelp =
true;
64 static G4bool warned =
false;
68 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
69 "\n!!!!! Xaw is deprecated and will be removed in the next major release."
70 "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
77 G4Xt* interactorManager = G4Xt::getInstance (argc,argv,(
char*)
"Xaw");
78 Widget top = (Widget)interactorManager->GetMainInteractor();
80 shell = XtAppCreateShell (
"G4UIXaw",
"G4UIXaw",topLevelShellWidgetClass,XtDisplay(top),NULL,0);
83 XtSetArg (args[0],XtNlabel,
"G4 command");
84 XtSetArg (args[1],XtNvalue,
"");
85 dialog = XtCreateManagedWidget (
"dialog",dialogWidgetClass,shell,args,2);
87 XawDialogAddButton (dialog,
"Ok",Callback,(XtPointer)
this);
89 XtRealizeWidget (shell);
97 XtDestroyWidget (shell);
107 G4Xt* interactorManager = G4Xt::getInstance ();
110 interactorManager->DisableSecondaryLoop ();
112 while((event = interactorManager->GetEvent())!=NULL) {
113 interactorManager->DispatchEvent(event);
114 if(exitSession==
true)
break;
116 interactorManager->EnableSecondaryLoop ();
120void G4UIXaw::Prompt (
127 XtSetArg (args[0],XtNlabel,aPrompt.
data());
128 XtSetValues (dialog,args,1);
131void G4UIXaw::SessionTerminate (
138void G4UIXaw::PauseSessionStart (
144 if(a_state==
"G4_pause> ") {
145 SecondaryLoop (
"Pause, type continue to exit this state");
148 if(a_state==
"EndOfEvent") {
150 SecondaryLoop (
"End of event, type continue to exit this state");
154void G4UIXaw::SecondaryLoop (
160 G4Xt* interactorManager = G4Xt::getInstance ();
164 while((event = interactorManager->GetEvent())!=NULL) {
165 interactorManager->DispatchEvent(event);
166 if(exitPause==
true)
break;
171Widget G4UIXaw::GetDialog (
179G4bool G4UIXaw::GetHelpChoice(
187 G4Xt* interactorManager = G4Xt::getInstance ();
191 while((event = interactorManager->GetEvent())!=NULL) {
192 interactorManager->DispatchEvent(event);
193 if(exitHelp==
true)
break;
197 if(fHelp==
false)
return false;
203void G4UIXaw::ExitHelp(
212void G4UIXaw::Callback (
220 G4UIXaw* This = (G4UIXaw*)a_tag;
221 Widget dialog = This->GetDialog();
222 char* value = XawDialogGetValueString(dialog);
223 if(value==NULL)
return;
226 if(This->fHelp==
true) {
228 This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
230 This->ApplyShellCommand (command,exitSession,exitPause);
234 XtSetArg (args[0],XtNvalue,
"");
235 XtSetValues (dialog,args,1);
249 if(aString==NULL)
return false;
251 long value = strtol(aString,&s,10);
252 if(s==aString)
return false;
G4DLLIMPORT std::ostream G4cout
const char * data() const
static G4UImanager * GetUIpointer()
void SetSession(G4UIsession *const value)