31#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
38#include <X11/Intrinsic.h>
44G4OpenGLXmTextField::G4OpenGLXmTextField (
const char* n,
48 initial =
new char[50];
49 sprintf (initial,
"%6.2f", *val);
54G4OpenGLXmTextField::G4OpenGLXmTextField (
const char* n,
58 initial =
new char[50];
59 sprintf (initial,
"%s", val);
65G4OpenGLXmTextField::~G4OpenGLXmTextField ()
70void G4OpenGLXmTextField::SetName (
const char* n)
73 XmString text_string = XmStringCreateLocalized ((
char*)name);
74 XtVaSetValues (text_label,
75 XmNlabelString, text_string,
77 XmStringFree (text_string);
80const char* G4OpenGLXmTextField::GetName ()
85void G4OpenGLXmTextField::SetValue (
G4double val)
87 sprintf (initial,
"%6.2f", val);
89 XtVaSetValues (text_field,
90 XmNvalue, (String)initial,
95void G4OpenGLXmTextField::SetValue (
const char* val)
97 sprintf (initial,
"%s", val);
100 XtVaSetValues (text_field,
101 XmNvalue, (String)initial,
106const char* G4OpenGLXmTextField::GetValue ()
111void G4OpenGLXmTextField::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
114 pView = container->GetView ();
116 parent = container->GetPointerToWidget ();
118 char local_w_text[50];
119 strcpy (local_w_text, name);
122 strcpy (label_name, name);
123 strcat (label_name,
"_label");
125 char text_field_name[50];
126 strcpy (text_field_name, name);
127 strcat (text_field_name,
"_text_field");
129 XmString local_text = XmStringCreateLocalized (local_w_text);
130 text_label = XtVaCreateManagedWidget (label_name,
134 XmNlabelString, local_text,
139 XtNborderColor, borcol,
143 XmStringFree (local_text);
145 text_field = XtVaCreateManagedWidget (text_field_name,
146 xmTextFieldWidgetClass,
149 XmNvalue, (String)initial,
154 XtNborderColor, borcol,
160 XtAddCallback (text_field,
161 XmNvalueChangedCallback,
162 G4OpenGLXmViewer::get_double_value_callback,
165 XtAddCallback (text_field,
166 XmNvalueChangedCallback,
167 G4OpenGLXmViewer::get_text_callback,
172Widget* G4OpenGLXmTextField::GetPointerToParent ()
177Widget* G4OpenGLXmTextField::GetPointerToWidget ()