Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLXmTextField Class Reference

#include <G4OpenGLXmTextField.hh>

+ Inheritance diagram for G4OpenGLXmTextField:

Public Member Functions

 G4OpenGLXmTextField (const char *, G4double *)
 
 G4OpenGLXmTextField (const char *, const char *)
 
virtual ~G4OpenGLXmTextField ()
 
void SetName (const char *)
 
const char * GetName ()
 
void SetValue (G4double)
 
void SetValue (const char *)
 
const char * GetValue ()
 
void AddYourselfTo (G4OpenGLXmVWidgetContainer *)
 
Widget * GetPointerToParent ()
 
Widget * GetPointerToWidget ()
 
- Public Member Functions inherited from G4OpenGLXmVWidgetComponent
 G4OpenGLXmVWidgetComponent ()
 
virtual ~G4OpenGLXmVWidgetComponent ()
 
- Public Member Functions inherited from G4OpenGLXmVWidgetObject
 G4OpenGLXmVWidgetObject ()
 
virtual ~G4OpenGLXmVWidgetObject ()
 
G4OpenGLXmViewerGetView ()
 
void ProcesspView ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4OpenGLXmVWidgetObject
 G4OpenGLXmVWidgetObject (const G4OpenGLXmVWidgetObject &)
 
G4OpenGLXmVWidgetObjectoperator= (const G4OpenGLXmVWidgetObject &)
 
- Protected Attributes inherited from G4OpenGLXmVWidgetObject
G4OpenGLXmViewerpView
 
Colormap cmap
 
Pixel borcol
 
Pixel bgnd
 
unsigned int depth
 
Visual * visual
 
Widget top
 

Detailed Description

Definition at line 37 of file G4OpenGLXmTextField.hh.

Constructor & Destructor Documentation

◆ G4OpenGLXmTextField() [1/2]

G4OpenGLXmTextField::G4OpenGLXmTextField ( const char * n,
G4double * val )

Definition at line 41 of file G4OpenGLXmTextField.cc.

43: text_label(0)
44, text_field(0)
45, parent(0)
46{
47 name = n;
48 initial = new char[50];
49 snprintf (initial, 50, "%6.2f", *val);
50 value = (void*)val;
51 text=false;
52}

◆ G4OpenGLXmTextField() [2/2]

G4OpenGLXmTextField::G4OpenGLXmTextField ( const char * n,
const char * val )

Definition at line 54 of file G4OpenGLXmTextField.cc.

56: text_label(0)
57, text_field(0)
58, parent(0)
59{
60 name = n;
61 initial = new char[50];
62 snprintf (initial, 50, "%s", val);
63 value = (void*)val;
64 text=true;
65 // strcpy (initial, val);
66}

◆ ~G4OpenGLXmTextField()

G4OpenGLXmTextField::~G4OpenGLXmTextField ( )
virtual

Definition at line 68 of file G4OpenGLXmTextField.cc.

69{
70 delete[] initial;
71}

Member Function Documentation

◆ AddYourselfTo()

void G4OpenGLXmTextField::AddYourselfTo ( G4OpenGLXmVWidgetContainer * container)
virtual

Implements G4OpenGLXmVWidgetComponent.

Definition at line 114 of file G4OpenGLXmTextField.cc.

115{
116
117 pView = container->GetView ();
118 ProcesspView ();
119 parent = container->GetPointerToWidget ();
120
121 char local_w_text[50];
122 strcpy (local_w_text, name);
123
124 char label_name[50];
125 strcpy (label_name, name);
126 strcat (label_name, "_label");
127
128 char text_field_name[50];
129 strcpy (text_field_name, name);
130 strcat (text_field_name, "_text_field");
131
132 XmString local_text = XmStringCreateLocalized (local_w_text);
133 text_label = XtVaCreateManagedWidget (label_name,
134 xmLabelWidgetClass,
135 *parent,
136
137 XmNlabelString, local_text,
138
139 XtNvisual, visual,
140 XtNdepth, depth,
141 XtNcolormap, cmap,
142 XtNborderColor, borcol,
143 XtNbackground, bgnd,
144
145 NULL);
146 XmStringFree (local_text);
147
148 text_field = XtVaCreateManagedWidget (text_field_name,
149 xmTextFieldWidgetClass,
150 *parent,
151
152 XmNvalue, (String)initial,
153
154 XtNvisual, visual,
155 XtNdepth, depth,
156 XtNcolormap, cmap,
157 XtNborderColor, borcol,
158 XtNbackground, bgnd,
159
160 NULL);
161
162 if (!text) {
163 XtAddCallback (text_field,
164 XmNvalueChangedCallback,
166 value);
167 } else {
168 XtAddCallback (text_field,
169 XmNvalueChangedCallback,
171 value);
172 }
173}
virtual Widget * GetPointerToWidget()=0
static void get_double_value_callback(Widget w, XtPointer clientData, XtPointer callData)
static void get_text_callback(Widget w, XtPointer clientData, XtPointer callData)

◆ GetName()

const char * G4OpenGLXmTextField::GetName ( )

Definition at line 83 of file G4OpenGLXmTextField.cc.

84{
85 return name;
86}

◆ GetPointerToParent()

Widget * G4OpenGLXmTextField::GetPointerToParent ( )
virtual

Implements G4OpenGLXmVWidgetComponent.

Definition at line 175 of file G4OpenGLXmTextField.cc.

176{
177 return parent;
178}

◆ GetPointerToWidget()

Widget * G4OpenGLXmTextField::GetPointerToWidget ( )
virtual

Implements G4OpenGLXmVWidgetComponent.

Definition at line 180 of file G4OpenGLXmTextField.cc.

181{
182 return &text_field;
183}

◆ GetValue()

const char * G4OpenGLXmTextField::GetValue ( )

Definition at line 109 of file G4OpenGLXmTextField.cc.

110{
111 return initial;
112}

◆ SetName()

void G4OpenGLXmTextField::SetName ( const char * n)

Definition at line 73 of file G4OpenGLXmTextField.cc.

74{
75 name = n;
76 XmString text_string = XmStringCreateLocalized ((char*)name);
77 XtVaSetValues (text_label,
78 XmNlabelString, text_string,
79 NULL);
80 XmStringFree (text_string);
81}

◆ SetValue() [1/2]

void G4OpenGLXmTextField::SetValue ( const char * val)

Definition at line 98 of file G4OpenGLXmTextField.cc.

99{
100 snprintf (initial, 50, "%s", val);
101 // strcpy (initial, val);
102
103 XtVaSetValues (text_field,
104 XmNvalue, (String)initial,
105 NULL);
106
107}

◆ SetValue() [2/2]

void G4OpenGLXmTextField::SetValue ( G4double val)

Definition at line 88 of file G4OpenGLXmTextField.cc.

89{
90 snprintf (initial, 50, "%6.2f", val);
91
92 XtVaSetValues (text_field,
93 XmNvalue, (String)initial,
94 NULL);
95
96}

The documentation for this class was generated from the following files: