Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenGLXmFourArrowButtons.cc
Go to the documentation of this file.
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 // $Id: G4OpenGLXmFourArrowButtons.cc 68043 2013-03-13 14:27:49Z gcosmo $
28 //
29 //Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
30 
31 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
32 
36 #include <X11/Intrinsic.h>
37 #include <Xm/Form.h>
38 #include <Xm/ArrowBG.h>
39 
40 #include "globals.hh"
41 
42 G4OpenGLXmFourArrowButtons::G4OpenGLXmFourArrowButtons (XtCallbackRec** c)
43 : arrow_form(0)
44 , arrow(0)
45 , parent(0)
46 {
47  callback = c;
48 }
49 
50 G4OpenGLXmFourArrowButtons::~G4OpenGLXmFourArrowButtons ()
51 {}
52 
53 void G4OpenGLXmFourArrowButtons::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
54 {
55 
56  pView = container->GetView ();
57  ProcesspView ();
58 
59  parent = container->GetPointerToWidget ();
60 
61  arrow_form = XtVaCreateManagedWidget
62  ("arrow_form",
63  xmFormWidgetClass,
64  *parent,
65  XmNfractionBase, 3,
66 
67  XtNvisual, visual,
68  XtNdepth, depth,
69  XtNcolormap, cmap,
70  XtNborderColor, borcol,
71  XtNbackground, bgnd,
72 
73  NULL);
74 
75 
76 ///////////////`up' arrow///////////////
77  arrow = XtVaCreateManagedWidget
78  ("up_arrow",
79  xmArrowButtonGadgetClass,
80  arrow_form,
81 
82  XmNtopAttachment, XmATTACH_POSITION,
83  XmNtopPosition, 0,
84 
85  XmNbottomAttachment, XmATTACH_POSITION,
86  XmNbottomPosition, 1,
87 
88  XmNleftAttachment, XmATTACH_POSITION,
89  XmNleftPosition, 1,
90 
91  XmNrightAttachment, XmATTACH_POSITION,
92  XmNrightPosition, 2,
93 
94  XmNarrowDirection, XmARROW_UP,
95  XmNuserData, True,
96  NULL);
97 
98  XtAddCallbacks (arrow,
99  XmNactivateCallback,
100  callback[0]);
101 
102  XtAddCallbacks (arrow,
103  XmNarmCallback,
104  callback[0]);
105 
106  XtAddCallbacks (arrow,
107  XmNdisarmCallback,
108  callback[0]);
109 
110 ///////////////`down' arrow///////////////
111  arrow = XtVaCreateManagedWidget
112  ("down_arrow",
113  xmArrowButtonGadgetClass,
114  arrow_form,
115 
116  XmNtopAttachment, XmATTACH_POSITION,
117  XmNtopPosition, 2,
118 
119  XmNbottomAttachment, XmATTACH_POSITION,
120  XmNbottomPosition, 3,
121 
122  XmNleftAttachment, XmATTACH_POSITION,
123  XmNleftPosition, 1,
124 
125  XmNrightAttachment, XmATTACH_POSITION,
126  XmNrightPosition, 2,
127 
128  XmNarrowDirection, XmARROW_DOWN,
129  XmNuserData, False,
130  NULL);
131 
132  XtAddCallbacks (arrow,
133  XmNactivateCallback,
134  callback[1]);
135 
136  XtAddCallbacks (arrow,
137  XmNarmCallback,
138  callback[1]);
139 
140  XtAddCallbacks (arrow,
141  XmNdisarmCallback,
142  callback[1]);
143 
144 ///////////////`left' arrow///////////////
145  arrow = XtVaCreateManagedWidget
146  ("left_arrow",
147  xmArrowButtonGadgetClass,
148  arrow_form,
149 
150  XmNtopAttachment, XmATTACH_POSITION,
151  XmNtopPosition, 1,
152 
153  XmNbottomAttachment, XmATTACH_POSITION,
154  XmNbottomPosition, 2,
155 
156  XmNleftAttachment, XmATTACH_POSITION,
157  XmNleftPosition, 0,
158 
159  XmNrightAttachment, XmATTACH_POSITION,
160  XmNrightPosition, 1,
161 
162  XmNarrowDirection, XmARROW_LEFT,
163  XmNuserData, False,
164  NULL);
165 
166  XtAddCallbacks (arrow,
167  XmNactivateCallback,
168  callback[2]);
169 
170  XtAddCallbacks (arrow,
171  XmNarmCallback,
172  callback[2]);
173 
174  XtAddCallbacks (arrow,
175  XmNdisarmCallback,
176  callback[2]);
177 
178 ///////////////`right' arrow///////////////
179  arrow = XtVaCreateManagedWidget
180  ("right_arrow",
181  xmArrowButtonGadgetClass,
182  arrow_form,
183 
184  XmNtopAttachment, XmATTACH_POSITION,
185  XmNtopPosition, 1,
186 
187  XmNbottomAttachment, XmATTACH_POSITION,
188  XmNbottomPosition, 2,
189 
190  XmNleftAttachment, XmATTACH_POSITION,
191  XmNleftPosition, 2,
192 
193  XmNrightAttachment, XmATTACH_POSITION,
194  XmNrightPosition, 3,
195 
196  XmNarrowDirection, XmARROW_RIGHT,
197  XmNuserData, True,
198  NULL);
199 
200  XtAddCallbacks (arrow,
201  XmNactivateCallback,
202  callback[3]);
203 
204  XtAddCallbacks (arrow,
205  XmNarmCallback,
206  callback[3]);
207 
208  XtAddCallbacks (arrow,
209  XmNdisarmCallback,
210  callback[3]);
211 
212 }
213 
214 Widget* G4OpenGLXmFourArrowButtons::GetPointerToParent ()
215 {
216  return parent;
217 }
218 
219 Widget* G4OpenGLXmFourArrowButtons::GetPointerToWidget ()
220 {
221  return &arrow_form;
222 }
223 
224 #endif