30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
37 #include <X11/Intrinsic.h>
43 G4OpenGLXmTextField::G4OpenGLXmTextField (
const char*
n,
50 initial =
new char[50];
51 sprintf (initial,
"%6.2f", *val);
56 G4OpenGLXmTextField::G4OpenGLXmTextField (
const char*
n,
63 initial =
new char[50];
64 sprintf (initial,
"%s", val);
70 G4OpenGLXmTextField::~G4OpenGLXmTextField ()
75 void G4OpenGLXmTextField::SetName (
const char*
n)
78 XmString text_string = XmStringCreateLocalized ((
char*)
name);
79 XtVaSetValues (text_label,
80 XmNlabelString, text_string,
82 XmStringFree (text_string);
85 const char* G4OpenGLXmTextField::GetName ()
90 void G4OpenGLXmTextField::SetValue (
G4double val)
92 sprintf (initial,
"%6.2f", val);
94 XtVaSetValues (text_field,
95 XmNvalue, (String)initial,
100 void G4OpenGLXmTextField::SetValue (
const char* val)
102 sprintf (initial,
"%s", val);
105 XtVaSetValues (text_field,
106 XmNvalue, (String)initial,
111 const char* G4OpenGLXmTextField::GetValue ()
116 void 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,
177 Widget* G4OpenGLXmTextField::GetPointerToParent ()
182 Widget* G4OpenGLXmTextField::GetPointerToWidget ()