31 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
38 #include <X11/Intrinsic.h>
44 G4OpenGLXmTextField::G4OpenGLXmTextField (
const char*
n,
51 initial =
new char[50];
52 sprintf (initial,
"%6.2f", *val);
57 G4OpenGLXmTextField::G4OpenGLXmTextField (
const char*
n,
64 initial =
new char[50];
65 sprintf (initial,
"%s", val);
71 G4OpenGLXmTextField::~G4OpenGLXmTextField ()
76 void G4OpenGLXmTextField::SetName (
const char*
n)
79 XmString text_string = XmStringCreateLocalized ((
char*)
name);
80 XtVaSetValues (text_label,
81 XmNlabelString, text_string,
83 XmStringFree (text_string);
86 const char* G4OpenGLXmTextField::GetName ()
91 void G4OpenGLXmTextField::SetValue (
G4double val)
93 sprintf (initial,
"%6.2f", val);
95 XtVaSetValues (text_field,
96 XmNvalue, (String)initial,
101 void G4OpenGLXmTextField::SetValue (
const char* val)
103 sprintf (initial,
"%s", val);
106 XtVaSetValues (text_field,
107 XmNvalue, (String)initial,
112 const char* G4OpenGLXmTextField::GetValue ()
117 void G4OpenGLXmTextField::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
120 pView = container->GetView ();
122 parent = container->GetPointerToWidget ();
124 char local_w_text[50];
125 strcpy (local_w_text,
name);
128 strcpy (label_name,
name);
129 strcat (label_name,
"_label");
131 char text_field_name[50];
132 strcpy (text_field_name,
name);
133 strcat (text_field_name,
"_text_field");
135 XmString local_text = XmStringCreateLocalized (local_w_text);
136 text_label = XtVaCreateManagedWidget (label_name,
140 XmNlabelString, local_text,
145 XtNborderColor, borcol,
149 XmStringFree (local_text);
151 text_field = XtVaCreateManagedWidget (text_field_name,
152 xmTextFieldWidgetClass,
155 XmNvalue, (String)initial,
160 XtNborderColor, borcol,
166 XtAddCallback (text_field,
167 XmNvalueChangedCallback,
168 G4OpenGLXmViewer::get_double_value_callback,
171 XtAddCallback (text_field,
172 XmNvalueChangedCallback,
173 G4OpenGLXmViewer::get_text_callback,
178 Widget* G4OpenGLXmTextField::GetPointerToParent ()
183 Widget* G4OpenGLXmTextField::GetPointerToWidget ()
const XML_Char int const XML_Char * value