ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenGLXmFourArrowButtons.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4OpenGLXmFourArrowButtons.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
29 
30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
31 
35 #include <X11/Intrinsic.h>
36 #include <Xm/Form.h>
37 #include <Xm/ArrowBG.h>
38 
39 #include "globals.hh"
40 
41 G4OpenGLXmFourArrowButtons::G4OpenGLXmFourArrowButtons (XtCallbackRec** c)
42 : arrow_form(0)
43 , arrow(0)
44 , parent(0)
45 {
46  callback = c;
47 }
48 
49 G4OpenGLXmFourArrowButtons::~G4OpenGLXmFourArrowButtons ()
50 {}
51 
52 void G4OpenGLXmFourArrowButtons::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
53 {
54 
55  pView = container->GetView ();
56  ProcesspView ();
57 
58  parent = container->GetPointerToWidget ();
59 
60  arrow_form = XtVaCreateManagedWidget
61  ("arrow_form",
62  xmFormWidgetClass,
63  *parent,
64  XmNfractionBase, 3,
65 
66  XtNvisual, visual,
67  XtNdepth, depth,
68  XtNcolormap, cmap,
69  XtNborderColor, borcol,
70  XtNbackground, bgnd,
71 
72  NULL);
73 
74 
76  arrow = XtVaCreateManagedWidget
77  ("up_arrow",
78  xmArrowButtonGadgetClass,
79  arrow_form,
80 
81  XmNtopAttachment, XmATTACH_POSITION,
82  XmNtopPosition, 0,
83 
84  XmNbottomAttachment, XmATTACH_POSITION,
85  XmNbottomPosition, 1,
86 
87  XmNleftAttachment, XmATTACH_POSITION,
88  XmNleftPosition, 1,
89 
90  XmNrightAttachment, XmATTACH_POSITION,
91  XmNrightPosition, 2,
92 
93  XmNarrowDirection, XmARROW_UP,
94  XmNuserData, True,
95  NULL);
96 
97  XtAddCallbacks (arrow,
98  XmNactivateCallback,
99  callback[0]);
100 
101  XtAddCallbacks (arrow,
102  XmNarmCallback,
103  callback[0]);
104 
105  XtAddCallbacks (arrow,
106  XmNdisarmCallback,
107  callback[0]);
108 
110  arrow = XtVaCreateManagedWidget
111  ("down_arrow",
112  xmArrowButtonGadgetClass,
113  arrow_form,
114 
115  XmNtopAttachment, XmATTACH_POSITION,
116  XmNtopPosition, 2,
117 
118  XmNbottomAttachment, XmATTACH_POSITION,
119  XmNbottomPosition, 3,
120 
121  XmNleftAttachment, XmATTACH_POSITION,
122  XmNleftPosition, 1,
123 
124  XmNrightAttachment, XmATTACH_POSITION,
125  XmNrightPosition, 2,
126 
127  XmNarrowDirection, XmARROW_DOWN,
128  XmNuserData, False,
129  NULL);
130 
131  XtAddCallbacks (arrow,
132  XmNactivateCallback,
133  callback[1]);
134 
135  XtAddCallbacks (arrow,
136  XmNarmCallback,
137  callback[1]);
138 
139  XtAddCallbacks (arrow,
140  XmNdisarmCallback,
141  callback[1]);
142 
144  arrow = XtVaCreateManagedWidget
145  ("left_arrow",
146  xmArrowButtonGadgetClass,
147  arrow_form,
148 
149  XmNtopAttachment, XmATTACH_POSITION,
150  XmNtopPosition, 1,
151 
152  XmNbottomAttachment, XmATTACH_POSITION,
153  XmNbottomPosition, 2,
154 
155  XmNleftAttachment, XmATTACH_POSITION,
156  XmNleftPosition, 0,
157 
158  XmNrightAttachment, XmATTACH_POSITION,
159  XmNrightPosition, 1,
160 
161  XmNarrowDirection, XmARROW_LEFT,
162  XmNuserData, False,
163  NULL);
164 
165  XtAddCallbacks (arrow,
166  XmNactivateCallback,
167  callback[2]);
168 
169  XtAddCallbacks (arrow,
170  XmNarmCallback,
171  callback[2]);
172 
173  XtAddCallbacks (arrow,
174  XmNdisarmCallback,
175  callback[2]);
176 
178  arrow = XtVaCreateManagedWidget
179  ("right_arrow",
180  xmArrowButtonGadgetClass,
181  arrow_form,
182 
183  XmNtopAttachment, XmATTACH_POSITION,
184  XmNtopPosition, 1,
185 
186  XmNbottomAttachment, XmATTACH_POSITION,
187  XmNbottomPosition, 2,
188 
189  XmNleftAttachment, XmATTACH_POSITION,
190  XmNleftPosition, 2,
191 
192  XmNrightAttachment, XmATTACH_POSITION,
193  XmNrightPosition, 3,
194 
195  XmNarrowDirection, XmARROW_RIGHT,
196  XmNuserData, True,
197  NULL);
198 
199  XtAddCallbacks (arrow,
200  XmNactivateCallback,
201  callback[3]);
202 
203  XtAddCallbacks (arrow,
204  XmNarmCallback,
205  callback[3]);
206 
207  XtAddCallbacks (arrow,
208  XmNdisarmCallback,
209  callback[3]);
210 
211 }
212 
213 Widget* G4OpenGLXmFourArrowButtons::GetPointerToParent ()
214 {
215  return parent;
216 }
217 
218 Widget* G4OpenGLXmFourArrowButtons::GetPointerToWidget ()
219 {
220  return &arrow_form;
221 }
222 
223 #endif