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