Geant4-11
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4OpenGLXmTextField Class Reference

#include <G4OpenGLXmTextField.hh>

Inheritance diagram for G4OpenGLXmTextField:
G4OpenGLXmVWidgetComponent G4OpenGLXmVWidgetObject

Public Member Functions

void AddYourselfTo (G4OpenGLXmVWidgetContainer *)
 
 G4OpenGLXmTextField (const char *, const char *)
 
 G4OpenGLXmTextField (const char *, G4double *)
 
const char * GetName ()
 
Widget * GetPointerToParent ()
 
Widget * GetPointerToWidget ()
 
const char * GetValue ()
 
G4OpenGLXmViewerGetView ()
 
void ProcesspView ()
 
void SetName (const char *)
 
void SetValue (const char *)
 
void SetValue (G4double)
 
virtual ~G4OpenGLXmTextField ()
 

Protected Attributes

Pixel bgnd
 
Pixel borcol
 
Colormap cmap
 
unsigned int depth
 
G4OpenGLXmViewerpView
 
Widget top
 
Visual * visual
 

Private Member Functions

 G4OpenGLXmTextField (const G4OpenGLXmTextField &)
 
G4OpenGLXmTextFieldoperator= (const G4OpenGLXmTextField &)
 

Private Attributes

char * initial
 
const char * name
 
Widget * parent
 
G4bool text
 
Widget text_field
 
Widget text_label
 
void * value
 

Detailed Description

Definition at line 37 of file G4OpenGLXmTextField.hh.

Constructor & Destructor Documentation

◆ G4OpenGLXmTextField() [1/3]

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 sprintf (initial, "%6.2f", *val);
50 value = (void*)val;
51 text=false;
52}

References initial, CLHEP::detail::n, name, text, and value.

◆ G4OpenGLXmTextField() [2/3]

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 sprintf (initial, "%s", val);
63 value = (void*)val;
64 text=true;
65 // strcpy (initial, val);
66}

References initial, CLHEP::detail::n, name, text, and value.

◆ ~G4OpenGLXmTextField()

G4OpenGLXmTextField::~G4OpenGLXmTextField ( )
virtual

Definition at line 68 of file G4OpenGLXmTextField.cc.

69{
70 delete[] initial;
71}

References initial.

◆ G4OpenGLXmTextField() [3/3]

G4OpenGLXmTextField::G4OpenGLXmTextField ( const G4OpenGLXmTextField )
private

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)

References G4OpenGLXmVWidgetObject::bgnd, G4OpenGLXmVWidgetObject::borcol, G4OpenGLXmVWidgetObject::cmap, G4OpenGLXmVWidgetObject::depth, G4OpenGLXmViewer::get_double_value_callback(), G4OpenGLXmViewer::get_text_callback(), G4OpenGLXmVWidgetContainer::GetPointerToWidget(), G4OpenGLXmVWidgetObject::GetView(), initial, name, parent, G4OpenGLXmVWidgetObject::ProcesspView(), G4OpenGLXmVWidgetObject::pView, text, text_field, text_label, value, and G4OpenGLXmVWidgetObject::visual.

◆ GetName()

const char * G4OpenGLXmTextField::GetName ( )

Definition at line 83 of file G4OpenGLXmTextField.cc.

84{
85 return name;
86}

References name.

◆ GetPointerToParent()

Widget * G4OpenGLXmTextField::GetPointerToParent ( )
virtual

Implements G4OpenGLXmVWidgetComponent.

Definition at line 175 of file G4OpenGLXmTextField.cc.

176{
177 return parent;
178}

References parent.

◆ GetPointerToWidget()

Widget * G4OpenGLXmTextField::GetPointerToWidget ( )
virtual

Implements G4OpenGLXmVWidgetComponent.

Definition at line 180 of file G4OpenGLXmTextField.cc.

181{
182 return &text_field;
183}

References text_field.

◆ GetValue()

const char * G4OpenGLXmTextField::GetValue ( )

Definition at line 109 of file G4OpenGLXmTextField.cc.

110{
111 return initial;
112}

References initial.

◆ GetView()

G4OpenGLXmViewer * G4OpenGLXmVWidgetObject::GetView ( )
inherited

◆ operator=()

G4OpenGLXmTextField & G4OpenGLXmTextField::operator= ( const G4OpenGLXmTextField )
private

◆ ProcesspView()

void G4OpenGLXmVWidgetObject::ProcesspView ( )
inherited

◆ 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}

References CLHEP::detail::n, name, and text_label.

◆ SetValue() [1/2]

void G4OpenGLXmTextField::SetValue ( const char *  val)

Definition at line 98 of file G4OpenGLXmTextField.cc.

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

References initial, and text_field.

◆ SetValue() [2/2]

void G4OpenGLXmTextField::SetValue ( G4double  val)

Definition at line 88 of file G4OpenGLXmTextField.cc.

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

References initial, and text_field.

Referenced by G4OpenGLXmViewer::UpdateControlPanel().

Field Documentation

◆ bgnd

Pixel G4OpenGLXmVWidgetObject::bgnd
protectedinherited

◆ borcol

Pixel G4OpenGLXmVWidgetObject::borcol
protectedinherited

◆ cmap

Colormap G4OpenGLXmVWidgetObject::cmap
protectedinherited

◆ depth

unsigned int G4OpenGLXmVWidgetObject::depth
protectedinherited

◆ initial

char* G4OpenGLXmTextField::initial
private

◆ name

const char* G4OpenGLXmTextField::name
private

◆ parent

Widget* G4OpenGLXmTextField::parent
private

Definition at line 66 of file G4OpenGLXmTextField.hh.

Referenced by AddYourselfTo(), and GetPointerToParent().

◆ pView

G4OpenGLXmViewer* G4OpenGLXmVWidgetObject::pView
protectedinherited

◆ text

G4bool G4OpenGLXmTextField::text
private

Definition at line 62 of file G4OpenGLXmTextField.hh.

Referenced by AddYourselfTo(), and G4OpenGLXmTextField().

◆ text_field

Widget G4OpenGLXmTextField::text_field
private

Definition at line 65 of file G4OpenGLXmTextField.hh.

Referenced by AddYourselfTo(), GetPointerToWidget(), and SetValue().

◆ text_label

Widget G4OpenGLXmTextField::text_label
private

Definition at line 64 of file G4OpenGLXmTextField.hh.

Referenced by AddYourselfTo(), and SetName().

◆ top

Widget G4OpenGLXmVWidgetObject::top
protectedinherited

◆ value

void* G4OpenGLXmTextField::value
private

Definition at line 61 of file G4OpenGLXmTextField.hh.

Referenced by AddYourselfTo(), and G4OpenGLXmTextField().

◆ visual

Visual* G4OpenGLXmVWidgetObject::visual
protectedinherited

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