43#include <Inventor/nodes/SoSelection.h>
45#include <Inventor/Xt/SoXt.h>
46#include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
48#include <X11/StringDefs.h>
54#include <Xm/CascadeB.h>
55#include <Xm/RowColumn.h>
92 if(sgeometry.empty()) {
93 G4cout <<
"ERROR: Geometry string \""
95 <<
"\" is empty. Using \"600x600\"."
99 snprintf(str,
sizeof str,
"%dx%d",width,height);
108 shellName +=
"_shell";
110 XtSetArg(args[0],XtNgeometry,XtNewString(sgeometry.c_str()));
111 XtSetArg(args[1],XtNborderWidth,0);
112 XtSetArg(args[2],XtNtitle,XtNewString(wName.c_str()));
113 fShell = XtAppCreateShell(shellName.c_str(),
"Inventor",
114 topLevelShellWidgetClass,
118 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_FORM);
119 XtSetArg(args[1],XmNleftAttachment ,XmATTACH_FORM);
120 XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
121 XtSetArg(args[3],XmNbottomAttachment,XmATTACH_FORM);
122 Widget form = XmCreateForm (
fShell,(
char*)
"form",args,4);
123 XtManageChild (form);
125 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_FORM);
126 XtSetArg(args[1],XmNleftAttachment ,XmATTACH_FORM);
127 XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
128 Widget menuBar = XmCreateMenuBar (form,(
char*)
"menuBar",args,3);
129 XtManageChild(menuBar);
131 {Widget menu =
AddMenu(menuBar,
"File",
"File");
137 {Widget menu =
AddMenu(menuBar,
"Etc",
"Etc");
150 {Widget menu =
AddMenu(menuBar,
"Help",
"Help");
153 fViewer =
new SoXtExaminerViewer(form,wName.c_str(),
TRUE);
155 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_WIDGET);
156 XtSetArg(args[1],XmNtopWidget ,menuBar);
157 XtSetArg(args[2],XmNleftAttachment ,XmATTACH_FORM);
158 XtSetArg(args[3],XmNrightAttachment ,XmATTACH_FORM);
159 XtSetArg(args[4],XmNbottomAttachment,XmATTACH_FORM);
160 XtSetValues(
fViewer->getWidget(),args,5);
163 XtSetArg(args[0],XmNleftAttachment ,XmATTACH_FORM);
164 XtSetArg(args[1],XmNrightAttachment ,XmATTACH_FORM);
165 XtSetArg(args[2],XmNbottomAttachment,XmATTACH_FORM);
166 Widget cancel = XmCreatePushButton(
fHelpForm,(
char*)
"helpCancel",args,3);
167 XtAddCallback(cancel,XmNactivateCallback,
HelpCancelCbk,(XtPointer)
this);
168 XtManageChild(cancel);
169 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_FORM);
170 XtSetArg(args[1],XmNleftAttachment ,XmATTACH_FORM);
171 XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
172 XtSetArg(args[3],XmNbottomAttachment,XmATTACH_WIDGET);
173 XtSetArg(args[4],XmNbottomWidget ,cancel);
181 if(str!=0) wName = str;
182 fViewer =
new SoXtExaminerViewer(parent,wName.c_str(),
TRUE);
185 fViewer->setSize(SbVec2s(width,height));
188 const SbViewportRegion& vpRegion =
fViewer->getViewportRegion();
203 fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
250 Widget menu = XmCreatePulldownMenu(aMenuBar,(
char*)aName.c_str(),NULL,0);
254 XmStringLtoRCreate((
char*)aLabel.c_str(),(
char*)XmSTRING_DEFAULT_CHARSET);
255 XtSetArg (args[0],XmNlabelString,cps);
256 XtSetArg (args[1],XmNsubMenuId,menu);
257 Widget widget = XmCreateCascadeButton(aMenuBar,(
char*)aName.c_str(),args,2);
259 XtManageChild(widget);
265,XtCallbackProc aCallback
268 Widget widget = XmCreatePushButton(aMenu,(
char*)aLabel.c_str(),NULL,0);
269 XtManageChild(widget);
270 XtAddCallback(widget,XmNactivateCallback,aCallback,(XtPointer)
this);
274 Widget,XtPointer aData,XtPointer) {
285 Widget,XtPointer aData,XtPointer) {
291 Widget,XtPointer aData,XtPointer) {
297 Widget,XtPointer aData,XtPointer) {
303 Widget,XtPointer aData,XtPointer) {
309 Widget,XtPointer aData,XtPointer) {
315 Widget,XtPointer aData,XtPointer) {
321 Widget,XtPointer aData,XtPointer) {
327 Widget,XtPointer aData,XtPointer) {
333 Widget,XtPointer aData,XtPointer) {
339 Widget,XtPointer aData,XtPointer) {
345 Widget,XtPointer aData,XtPointer) {
351 Widget,XtPointer aData,XtPointer) {
357 Widget,XtPointer aData,XtPointer) {
363 Widget,XtPointer aData,XtPointer) {
369 Widget,XtPointer aData,XtPointer) {
372 XmTextSetString(This->
fHelpText,(
char*)This->
Help().c_str());
G4GLOB_DLL std::ostream G4cout
G4double GetGreen() const
G4String Help(const G4String &topic="controls")
void WriteInventor(const G4String &file="g4out.iv")
SoSelection * fSoSelection
void WritePostScript(const G4String &file="g4out.ps")
void Escape()
Menu items callbacks /////////////////////////////////////////////////////.
void SceneGraphStatistics()
G4VInteractorManager * fInteractorManager
void WritePixmapPostScript(const G4String &file="g4out.ps")
void SetReducedWireFrame(bool)
Geant4_SoGL2PSAction * fGL2PSAction
static void SetPreviewCbk(Widget, XtPointer, XtPointer)
static void SetReducedWireFrameCbk(Widget, XtPointer, XtPointer)
static void SceneGraphStatisticsCbk(Widget, XtPointer, XtPointer)
static void SetPreviewAndFullCbk(Widget, XtPointer, XtPointer)
static void EraseDetectorCbk(Widget, XtPointer, XtPointer)
static void PixmapPostScriptCbk(Widget, XtPointer, XtPointer)
static void SetFullWireFrameCbk(Widget, XtPointer, XtPointer)
static void PostScriptCbk(Widget, XtPointer, XtPointer)
static void SetWireFrameCbk(Widget, XtPointer, XtPointer)
virtual SoCamera * GetCamera()
static void WriteInventorCbk(Widget, XtPointer, XtPointer)
virtual void ViewerRender()
void AddButton(Widget, const G4String &, XtCallbackProc)
static void HelpCancelCbk(Widget, XtPointer, XtPointer)
static void EraseEventCbk(Widget, XtPointer, XtPointer)
G4OpenInventorXtViewer(G4OpenInventorSceneHandler &scene, const G4String &name="")
virtual void FinishView()
static void UpdateSceneCbk(Widget, XtPointer, XtPointer)
static void EscapeCbk(Widget, XtPointer, XtPointer)
static void SetSolidCbk(Widget, XtPointer, XtPointer)
static void HelpCbk(Widget, XtPointer, XtPointer)
virtual ~G4OpenInventorXtViewer()
Widget AddMenu(Widget, const G4String &, const G4String &)
SoXtExaminerViewer * fViewer
void SetCreatedInteractor(G4Interactor)
virtual void FlushAndWaitExecution()=0
G4Interactor GetParentInteractor()
char * GetCreationString()
void RemoveShell(G4Interactor)
void AddShell(G4Interactor)
const G4String & GetXGeometryString() const
unsigned int GetWindowSizeHintX() const
const G4Colour & GetBackgroundColour() const
static Verbosity GetVerbosity()