30#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
35#include <X11/Intrinsic.h>
39G4OpenGLXmSliderBar::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));
62G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
65const char* G4OpenGLXmSliderBar::GetName ()
70G4bool G4OpenGLXmSliderBar::GetShow ()
75short G4OpenGLXmSliderBar::GetDecimalPlaces ()
77 return decimal_places;
80G4double G4OpenGLXmSliderBar::GetInitialValue ()
82 return (
G4double)initial_value / std::pow(10.0, (
G4double)GetDecimalPlaces());
85G4double G4OpenGLXmSliderBar::GetMaxValue ()
90G4double G4OpenGLXmSliderBar::GetMinValue ()
95unsigned char G4OpenGLXmSliderBar::GetOrientation ()
100unsigned char G4OpenGLXmSliderBar::GetDirection ()
105void G4OpenGLXmSliderBar::SetName (
const char* n)
108 XmString sliderbar_string = XmStringCreateLocalized ((
char*)name);
109 XtVaSetValues (sliderbar,
110 XmNlabelString, sliderbar_string,
112 XmStringFree (sliderbar_string);
115void G4OpenGLXmSliderBar::SetShow (
G4bool sh)
118 XtVaSetValues (sliderbar,
124void G4OpenGLXmSliderBar::SetDecimalPlaces (
short dp)
127 XtVaSetValues (sliderbar,
128 XmNdecimalPoints, decimal_places,
133void G4OpenGLXmSliderBar::SetInitialValue (
G4double v)
135 initial_value = int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
136 XtVaSetValues (sliderbar,
137 XmNvalue, initial_value,
142void G4OpenGLXmSliderBar::SetMaxValue (
G4double v)
144 max_value = int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
145 XtVaSetValues (sliderbar,
146 XmNmaximum, max_value,
151void G4OpenGLXmSliderBar::SetMinValue (
G4double v)
153 min_value = int(v * std::pow(10.0, (
G4double)GetDecimalPlaces()));
154 XtVaSetValues (sliderbar,
155 XmNminimum, min_value,
160void G4OpenGLXmSliderBar::SetOrientation (
unsigned char o)
163 XtVaSetValues (sliderbar,
164 XmNorientation, orientation,
169void G4OpenGLXmSliderBar::SetDirection (
unsigned char d)
172 XtVaSetValues (sliderbar,
173 XmNprocessingDirection, direction,
178void 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);
217Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
222Widget* G4OpenGLXmSliderBar::GetPointerToWidget ()
const char * name(G4int ptype)