31 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
36 #include <X11/Intrinsic.h>
40 G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (
const char*
n,
56 initial_value =
int(v * std::pow(10.0, (
G4double)dp));
57 max_value =
int(max * std::pow(10.0, (
G4double)dp));
58 min_value =
int(min * std::pow(10.0, (
G4double)dp));
63 G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
66 const char* G4OpenGLXmSliderBar::GetName ()
71 G4bool G4OpenGLXmSliderBar::GetShow ()
76 short G4OpenGLXmSliderBar::GetDecimalPlaces ()
78 return decimal_places;
81 G4double G4OpenGLXmSliderBar::GetInitialValue ()
83 return (
G4double)initial_value / std::pow(10.0, (
G4double)GetDecimalPlaces());
86 G4double G4OpenGLXmSliderBar::GetMaxValue ()
91 G4double G4OpenGLXmSliderBar::GetMinValue ()
96 unsigned char G4OpenGLXmSliderBar::GetOrientation ()
101 unsigned char G4OpenGLXmSliderBar::GetDirection ()
106 void G4OpenGLXmSliderBar::SetName (
const char* n)
109 XmString sliderbar_string = XmStringCreateLocalized ((
char*)
name);
110 XtVaSetValues (sliderbar,
111 XmNlabelString, sliderbar_string,
113 XmStringFree (sliderbar_string);
116 void G4OpenGLXmSliderBar::SetShow (
G4bool sh)
119 XtVaSetValues (sliderbar,
125 void G4OpenGLXmSliderBar::SetDecimalPlaces (
short dp)
128 XtVaSetValues (sliderbar,
129 XmNdecimalPoints, decimal_places,
134 void G4OpenGLXmSliderBar::SetInitialValue (
G4double v)
136 initial_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
137 XtVaSetValues (sliderbar,
138 XmNvalue, initial_value,
143 void G4OpenGLXmSliderBar::SetMaxValue (
G4double v)
145 max_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
146 XtVaSetValues (sliderbar,
147 XmNmaximum, max_value,
152 void G4OpenGLXmSliderBar::SetMinValue (
G4double v)
154 min_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
155 XtVaSetValues (sliderbar,
156 XmNminimum, min_value,
161 void G4OpenGLXmSliderBar::SetOrientation (
unsigned char o)
164 XtVaSetValues (sliderbar,
165 XmNorientation, orientation,
170 void G4OpenGLXmSliderBar::SetDirection (
unsigned char d)
173 XtVaSetValues (sliderbar,
174 XmNprocessingDirection, direction,
179 void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
182 pView = container->GetView ();
185 parent = container->GetPointerToWidget ();
186 XmString name_string = XmStringCreateLocalized ((
char*)
name);
187 sliderbar = XtVaCreateManagedWidget (
name,
191 XmNtitleString, name_string,
192 XmNmaximum, max_value,
193 XmNminimum, min_value,
194 XmNvalue, initial_value,
196 XmNdecimalPoints, decimal_places,
197 XmNorientation, orientation,
198 XmNprocessingDirection, direction,
203 XtNborderColor, borcol,
208 XtAddCallbacks (sliderbar,
209 XmNvalueChangedCallback,
212 XtAddCallbacks (sliderbar,
215 XmStringFree (name_string);
218 Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
223 Widget* G4OpenGLXmSliderBar::GetPointerToWidget ()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments