31#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
36#include <X11/Intrinsic.h>
40G4OpenGLXmSliderBar::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));
61G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
64const char* G4OpenGLXmSliderBar::GetName ()
69G4bool G4OpenGLXmSliderBar::GetShow ()
74short G4OpenGLXmSliderBar::GetDecimalPlaces ()
76 return decimal_places;
79G4double G4OpenGLXmSliderBar::GetInitialValue ()
81 return (
G4double)initial_value / std::pow(10.0, (
G4double)GetDecimalPlaces());
84G4double G4OpenGLXmSliderBar::GetMaxValue ()
89G4double G4OpenGLXmSliderBar::GetMinValue ()
94unsigned char G4OpenGLXmSliderBar::GetOrientation ()
99unsigned char G4OpenGLXmSliderBar::GetDirection ()
104void G4OpenGLXmSliderBar::SetName (
const char* n)
107 XmString sliderbar_string = XmStringCreateLocalized ((
char*)name);
108 XtVaSetValues (sliderbar,
109 XmNlabelString, sliderbar_string,
111 XmStringFree (sliderbar_string);
114void G4OpenGLXmSliderBar::SetShow (
G4bool sh)
117 XtVaSetValues (sliderbar,
123void G4OpenGLXmSliderBar::SetDecimalPlaces (
short dp)
126 XtVaSetValues (sliderbar,
127 XmNdecimalPoints, decimal_places,
132void G4OpenGLXmSliderBar::SetInitialValue (
G4double v)
134 initial_value = int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
135 XtVaSetValues (sliderbar,
136 XmNvalue, initial_value,
141void G4OpenGLXmSliderBar::SetMaxValue (
G4double v)
143 max_value = int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
144 XtVaSetValues (sliderbar,
145 XmNmaximum, max_value,
150void G4OpenGLXmSliderBar::SetMinValue (
G4double v)
152 min_value = int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
153 XtVaSetValues (sliderbar,
154 XmNminimum, min_value,
159void G4OpenGLXmSliderBar::SetOrientation (
unsigned char o)
162 XtVaSetValues (sliderbar,
163 XmNorientation, orientation,
168void G4OpenGLXmSliderBar::SetDirection (
unsigned char d)
171 XtVaSetValues (sliderbar,
172 XmNprocessingDirection, direction,
177void 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);
216Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
221Widget* G4OpenGLXmSliderBar::GetPointerToWidget ()