30#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
37#include <X11/Intrinsic.h>
43G4OpenGLXmTextField::G4OpenGLXmTextField (
const char* n,
50 initial =
new char[50];
51 sprintf (initial,
"%6.2f", *val);
56G4OpenGLXmTextField::G4OpenGLXmTextField (
const char* n,
63 initial =
new char[50];
64 sprintf (initial,
"%s", val);
70G4OpenGLXmTextField::~G4OpenGLXmTextField ()
75void G4OpenGLXmTextField::SetName (
const char* n)
78 XmString text_string = XmStringCreateLocalized ((
char*)name);
79 XtVaSetValues (text_label,
80 XmNlabelString, text_string,
82 XmStringFree (text_string);
85const char* G4OpenGLXmTextField::GetName ()
90void G4OpenGLXmTextField::SetValue (
G4double val)
92 sprintf (initial,
"%6.2f", val);
94 XtVaSetValues (text_field,
95 XmNvalue, (String)initial,
100void G4OpenGLXmTextField::SetValue (
const char* val)
102 sprintf (initial,
"%s", val);
105 XtVaSetValues (text_field,
106 XmNvalue, (String)initial,
111const char* G4OpenGLXmTextField::GetValue ()
116void G4OpenGLXmTextField::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
119 pView = container->GetView ();
121 parent = container->GetPointerToWidget ();
123 char local_w_text[50];
124 strcpy (local_w_text, name);
127 strcpy (label_name, name);
128 strcat (label_name,
"_label");
130 char text_field_name[50];
131 strcpy (text_field_name, name);
132 strcat (text_field_name,
"_text_field");
134 XmString local_text = XmStringCreateLocalized (local_w_text);
135 text_label = XtVaCreateManagedWidget (label_name,
139 XmNlabelString, local_text,
144 XtNborderColor, borcol,
148 XmStringFree (local_text);
150 text_field = XtVaCreateManagedWidget (text_field_name,
151 xmTextFieldWidgetClass,
154 XmNvalue, (String)initial,
159 XtNborderColor, borcol,
165 XtAddCallback (text_field,
166 XmNvalueChangedCallback,
167 G4OpenGLXmViewer::get_double_value_callback,
170 XtAddCallback (text_field,
171 XmNvalueChangedCallback,
172 G4OpenGLXmViewer::get_text_callback,
177Widget* G4OpenGLXmTextField::GetPointerToParent ()
182Widget* G4OpenGLXmTextField::GetPointerToWidget ()
const char * name(G4int ptype)