31 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
36 #include <X11/Intrinsic.h>
40 G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (
const char*
n,
54 initial_value =
int(v * std::pow(10.0, (
G4double)dp));
55 max_value =
int(max * std::pow(10.0, (
G4double)dp));
56 min_value =
int(min * std::pow(10.0, (
G4double)dp));
61 G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
64 const char* G4OpenGLXmSliderBar::GetName ()
69 G4bool G4OpenGLXmSliderBar::GetShow ()
74 short G4OpenGLXmSliderBar::GetDecimalPlaces ()
76 return decimal_places;
79 G4double G4OpenGLXmSliderBar::GetInitialValue ()
81 return (
G4double)initial_value / std::pow(10.0, (
G4double)GetDecimalPlaces());
84 G4double G4OpenGLXmSliderBar::GetMaxValue ()
89 G4double G4OpenGLXmSliderBar::GetMinValue ()
94 unsigned char G4OpenGLXmSliderBar::GetOrientation ()
99 unsigned char G4OpenGLXmSliderBar::GetDirection ()
104 void G4OpenGLXmSliderBar::SetName (
const char* n)
107 XmString sliderbar_string = XmStringCreateLocalized ((
char*)
name);
108 XtVaSetValues (sliderbar,
109 XmNlabelString, sliderbar_string,
111 XmStringFree (sliderbar_string);
114 void G4OpenGLXmSliderBar::SetShow (
G4bool sh)
117 XtVaSetValues (sliderbar,
123 void G4OpenGLXmSliderBar::SetDecimalPlaces (
short dp)
126 XtVaSetValues (sliderbar,
127 XmNdecimalPoints, decimal_places,
132 void G4OpenGLXmSliderBar::SetInitialValue (
G4double v)
134 initial_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
135 XtVaSetValues (sliderbar,
136 XmNvalue, initial_value,
141 void G4OpenGLXmSliderBar::SetMaxValue (
G4double v)
143 max_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
144 XtVaSetValues (sliderbar,
145 XmNmaximum, max_value,
150 void G4OpenGLXmSliderBar::SetMinValue (
G4double v)
152 min_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
153 XtVaSetValues (sliderbar,
154 XmNminimum, min_value,
159 void G4OpenGLXmSliderBar::SetOrientation (
unsigned char o)
162 XtVaSetValues (sliderbar,
163 XmNorientation, orientation,
168 void G4OpenGLXmSliderBar::SetDirection (
unsigned char d)
171 XtVaSetValues (sliderbar,
172 XmNprocessingDirection, direction,
177 void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
180 pView = container->GetView ();
183 parent = container->GetPointerToWidget ();
184 XmString name_string = XmStringCreateLocalized ((
char*)
name);
185 sliderbar = XtVaCreateManagedWidget (
name,
189 XmNtitleString, name_string,
190 XmNmaximum, max_value,
191 XmNminimum, min_value,
192 XmNvalue, initial_value,
194 XmNdecimalPoints, decimal_places,
195 XmNorientation, orientation,
196 XmNprocessingDirection, direction,
201 XtNborderColor, borcol,
206 XtAddCallbacks (sliderbar,
207 XmNvalueChangedCallback,
210 XtAddCallbacks (sliderbar,
213 XmStringFree (name_string);
216 Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
221 Widget* G4OpenGLXmSliderBar::GetPointerToWidget ()