30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
35 #include <X11/Intrinsic.h>
39 G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (
const char*
n,
55 initial_value =
int(v * std::pow(10.0, (
G4double)dp));
56 max_value =
int(max * std::pow(10.0, (
G4double)dp));
57 min_value =
int(min * std::pow(10.0, (
G4double)dp));
62 G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
65 const char* G4OpenGLXmSliderBar::GetName ()
70 G4bool G4OpenGLXmSliderBar::GetShow ()
75 short G4OpenGLXmSliderBar::GetDecimalPlaces ()
77 return decimal_places;
80 G4double G4OpenGLXmSliderBar::GetInitialValue ()
82 return (
G4double)initial_value / std::pow(10.0, (
G4double)GetDecimalPlaces());
85 G4double G4OpenGLXmSliderBar::GetMaxValue ()
90 G4double G4OpenGLXmSliderBar::GetMinValue ()
95 unsigned char G4OpenGLXmSliderBar::GetOrientation ()
100 unsigned char G4OpenGLXmSliderBar::GetDirection ()
105 void G4OpenGLXmSliderBar::SetName (
const char* n)
108 XmString sliderbar_string = XmStringCreateLocalized ((
char*)
name);
109 XtVaSetValues (sliderbar,
110 XmNlabelString, sliderbar_string,
112 XmStringFree (sliderbar_string);
115 void G4OpenGLXmSliderBar::SetShow (
G4bool sh)
118 XtVaSetValues (sliderbar,
124 void G4OpenGLXmSliderBar::SetDecimalPlaces (
short dp)
127 XtVaSetValues (sliderbar,
128 XmNdecimalPoints, decimal_places,
133 void G4OpenGLXmSliderBar::SetInitialValue (
G4double v)
135 initial_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
136 XtVaSetValues (sliderbar,
137 XmNvalue, initial_value,
142 void G4OpenGLXmSliderBar::SetMaxValue (
G4double v)
144 max_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
145 XtVaSetValues (sliderbar,
146 XmNmaximum, max_value,
151 void G4OpenGLXmSliderBar::SetMinValue (
G4double v)
153 min_value =
int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
154 XtVaSetValues (sliderbar,
155 XmNminimum, min_value,
160 void G4OpenGLXmSliderBar::SetOrientation (
unsigned char o)
163 XtVaSetValues (sliderbar,
164 XmNorientation, orientation,
169 void G4OpenGLXmSliderBar::SetDirection (
unsigned char d)
172 XtVaSetValues (sliderbar,
173 XmNprocessingDirection, direction,
178 void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
181 pView = container->GetView ();
184 parent = container->GetPointerToWidget ();
185 XmString name_string = XmStringCreateLocalized ((
char*)
name);
186 sliderbar = XtVaCreateManagedWidget (
name,
190 XmNtitleString, name_string,
191 XmNmaximum, max_value,
192 XmNminimum, min_value,
193 XmNvalue, initial_value,
195 XmNdecimalPoints, decimal_places,
196 XmNorientation, orientation,
197 XmNprocessingDirection, direction,
202 XtNborderColor, borcol,
207 XtAddCallbacks (sliderbar,
208 XmNvalueChangedCallback,
211 XtAddCallbacks (sliderbar,
214 XmStringFree (name_string);
217 Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
222 Widget* G4OpenGLXmSliderBar::GetPointerToWidget ()