source: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc @ 553

Last change on this file since 553 was 529, checked in by garnier, 17 years ago

r658@mac-90108: laurentgarnier | 2007-06-25 12:02:16 +0200
import de visualisation

  • Property svn:mime-type set to text/cpp
File size: 5.6 KB
Line 
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,v 1.5 2006/06/29 21:19:44 gunter Exp $
28// GEANT4 tag $Name: geant4-08-01-patch-01 $
29//
30//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
31
32#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
33
34#include "G4OpenGLXmVWidgetComponent.hh"
35#include "G4OpenGLXmVWidgetContainer.hh"
36#include "G4OpenGLXmFourArrowButtons.hh"
37#include <X11/Intrinsic.h>
38#include "globals.hh"
39
40G4OpenGLXmFourArrowButtons::G4OpenGLXmFourArrowButtons (XtCallbackRec** c)
41{
42  callback = c;
43}
44
45G4OpenGLXmFourArrowButtons::~G4OpenGLXmFourArrowButtons ()
46{}
47
48void G4OpenGLXmFourArrowButtons::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
49{
50
51  pView = container->GetView ();
52  ProcesspView ();
53
54  parent = container->GetPointerToWidget ();
55
56  arrow_form = XtVaCreateManagedWidget
57    ("arrow_form",
58     xmFormWidgetClass,
59     *parent,
60     XmNfractionBase, 3,
61
62     XtNvisual, visual,
63     XtNdepth, depth,
64     XtNcolormap, cmap,
65     XtNborderColor, borcol,
66     XtNbackground, bgnd,
67
68     NULL);
69
70
71///////////////`up' arrow/////////////// 
72  arrow = XtVaCreateManagedWidget
73    ("up_arrow",
74     xmArrowButtonGadgetClass,
75     arrow_form,
76     
77     XmNtopAttachment, XmATTACH_POSITION,
78     XmNtopPosition, 0,
79     
80     XmNbottomAttachment, XmATTACH_POSITION,
81     XmNbottomPosition, 1,
82     
83     XmNleftAttachment, XmATTACH_POSITION,
84     XmNleftPosition, 1,
85
86     XmNrightAttachment, XmATTACH_POSITION,
87     XmNrightPosition, 2,
88
89     XmNarrowDirection, XmARROW_UP,
90     XmNuserData, True,
91     NULL);
92 
93  XtAddCallbacks (arrow,
94                  XmNactivateCallback,
95                  callback[0]);
96 
97  XtAddCallbacks (arrow,
98                  XmNarmCallback,
99                  callback[0]);
100 
101  XtAddCallbacks (arrow,
102                  XmNdisarmCallback,
103                  callback[0]);
104 
105///////////////`down' arrow/////////////// 
106  arrow = XtVaCreateManagedWidget
107    ("down_arrow",
108     xmArrowButtonGadgetClass,
109     arrow_form,
110     
111     XmNtopAttachment, XmATTACH_POSITION,
112     XmNtopPosition, 2,
113
114     XmNbottomAttachment, XmATTACH_POSITION,
115     XmNbottomPosition, 3,
116
117     XmNleftAttachment, XmATTACH_POSITION,
118     XmNleftPosition, 1,
119
120     XmNrightAttachment, XmATTACH_POSITION,
121     XmNrightPosition, 2,
122
123     XmNarrowDirection, XmARROW_DOWN,
124     XmNuserData, False,
125     NULL);
126 
127  XtAddCallbacks (arrow,
128                  XmNactivateCallback,
129                  callback[1]);
130 
131  XtAddCallbacks (arrow,
132                  XmNarmCallback,
133                  callback[1]);
134 
135  XtAddCallbacks (arrow,
136                  XmNdisarmCallback,
137                  callback[1]);
138 
139///////////////`left' arrow/////////////// 
140  arrow = XtVaCreateManagedWidget
141    ("left_arrow",
142     xmArrowButtonGadgetClass,
143     arrow_form,
144     
145     XmNtopAttachment, XmATTACH_POSITION,
146     XmNtopPosition, 1,
147     
148     XmNbottomAttachment, XmATTACH_POSITION,
149     XmNbottomPosition, 2,
150     
151     XmNleftAttachment, XmATTACH_POSITION,
152     XmNleftPosition, 0,
153     
154     XmNrightAttachment, XmATTACH_POSITION,
155     XmNrightPosition, 1,
156     
157     XmNarrowDirection, XmARROW_LEFT,
158     XmNuserData, False,
159     NULL);
160 
161  XtAddCallbacks (arrow,
162                  XmNactivateCallback,
163                  callback[2]);
164 
165  XtAddCallbacks (arrow,
166                  XmNarmCallback,
167                  callback[2]);
168 
169  XtAddCallbacks (arrow,
170                  XmNdisarmCallback,
171                  callback[2]);
172 
173///////////////`right' arrow/////////////// 
174  arrow = XtVaCreateManagedWidget
175    ("right_arrow",
176     xmArrowButtonGadgetClass,
177     arrow_form,
178     
179     XmNtopAttachment, XmATTACH_POSITION,
180     XmNtopPosition, 1,
181     
182     XmNbottomAttachment, XmATTACH_POSITION,
183     XmNbottomPosition, 2,
184
185     XmNleftAttachment, XmATTACH_POSITION,
186     XmNleftPosition, 2,
187
188     XmNrightAttachment, XmATTACH_POSITION,
189     XmNrightPosition, 3,
190
191     XmNarrowDirection, XmARROW_RIGHT,
192     XmNuserData, True,
193     NULL);
194 
195  XtAddCallbacks (arrow,
196                  XmNactivateCallback,
197                  callback[3]);
198 
199  XtAddCallbacks (arrow,
200                  XmNarmCallback,
201                  callback[3]);
202 
203  XtAddCallbacks (arrow,
204                  XmNdisarmCallback,
205                  callback[3]);
206
207}
208
209Widget* G4OpenGLXmFourArrowButtons::GetPointerToParent ()
210{
211  return parent;
212}
213
214Widget* G4OpenGLXmFourArrowButtons::GetPointerToWidget ()
215{
216  return &arrow_form;
217}
218
219#endif
Note: See TracBrowser for help on using the repository browser.