source: trunk/source/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc @ 1327

Last change on this file since 1327 was 915, checked in by garnier, 15 years ago

print improvments begin, see History file

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