Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4OpenGLXmPushButton.cc,v 1.5 2001/07/11 10:08:57 gunter Exp $ >> 25 // GEANT4 tag $Name: geant4-07-01 $ 27 // 26 // 28 //Push button class. Inherits from G4OpenGLXmV 27 //Push button class. Inherits from G4OpenGLXmVWidgetComponent 29 28 >> 29 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER >> 30 30 #include "G4OpenGLXmVWidgetComponent.hh" 31 #include "G4OpenGLXmVWidgetComponent.hh" 31 #include "G4OpenGLXmVWidgetContainer.hh" 32 #include "G4OpenGLXmVWidgetContainer.hh" 32 #include "G4OpenGLXmPushButton.hh" 33 #include "G4OpenGLXmPushButton.hh" 33 #include <X11/Intrinsic.h> 34 #include <X11/Intrinsic.h> 34 #include <Xm/PushB.h> << 35 << 36 #include "globals.hh" 35 #include "globals.hh" 37 36 38 G4OpenGLXmPushButton::G4OpenGLXmPushButton (co 37 G4OpenGLXmPushButton::G4OpenGLXmPushButton (const char* n, 39 XtCallbackRec* c) << 38 XtCallbackRec* c) 40 : button(0) << 41 , parent(0) << 42 { 39 { 43 name = n; 40 name = n; 44 callback = c; 41 callback = c; 45 } 42 } 46 43 47 G4OpenGLXmPushButton::~G4OpenGLXmPushButton () 44 G4OpenGLXmPushButton::~G4OpenGLXmPushButton () 48 {} 45 {} 49 46 50 void G4OpenGLXmPushButton::SetName (const char 47 void G4OpenGLXmPushButton::SetName (const char* n) 51 { 48 { 52 name = n; 49 name = n; 53 XmString button_string = XmStringCreateLocal 50 XmString button_string = XmStringCreateLocalized ((char*)name); 54 XtVaSetValues (button, 51 XtVaSetValues (button, 55 XmNlabelString, button_string, 52 XmNlabelString, button_string, 56 NULL); 53 NULL); 57 XmStringFree (button_string); 54 XmStringFree (button_string); 58 } 55 } 59 56 60 const char* G4OpenGLXmPushButton::GetName () 57 const char* G4OpenGLXmPushButton::GetName () 61 { 58 { 62 return name; 59 return name; 63 } 60 } 64 61 65 void G4OpenGLXmPushButton::AddYourselfTo (G4Op 62 void G4OpenGLXmPushButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container) 66 { 63 { 67 64 68 pView = container->GetView (); 65 pView = container->GetView (); 69 ProcesspView (); 66 ProcesspView (); 70 parent = container->GetPointerToWidget (); 67 parent = container->GetPointerToWidget (); 71 68 72 XmString button_str = XmStringCreateLocalize 69 XmString button_str = XmStringCreateLocalized ((char*)name); 73 button = XtVaCreateManagedWidget 70 button = XtVaCreateManagedWidget 74 (name, 71 (name, 75 xmPushButtonWidgetClass, 72 xmPushButtonWidgetClass, 76 *parent, 73 *parent, 77 XmNlabelString, button_str, 74 XmNlabelString, button_str, 78 XmNalignment, XmALIGNMENT_CENTER, 75 XmNalignment, XmALIGNMENT_CENTER, 79 XmNuserData, pView, 76 XmNuserData, pView, 80 77 81 XtNvisual, visual, 78 XtNvisual, visual, 82 XtNdepth, depth, 79 XtNdepth, depth, 83 XtNcolormap, cmap, 80 XtNcolormap, cmap, 84 XtNborderColor, borcol, 81 XtNborderColor, borcol, 85 XtNbackground, bgnd, 82 XtNbackground, bgnd, 86 83 87 NULL); 84 NULL); 88 85 89 XtAddCallbacks (button, 86 XtAddCallbacks (button, 90 XmNarmCallback, 87 XmNarmCallback, 91 callback); 88 callback); 92 89 93 XmStringFree (button_str); 90 XmStringFree (button_str); 94 } 91 } 95 92 96 Widget* G4OpenGLXmPushButton::GetPointerToPare 93 Widget* G4OpenGLXmPushButton::GetPointerToParent () 97 { 94 { 98 return parent; 95 return parent; 99 } 96 } 100 97 101 Widget* G4OpenGLXmPushButton::GetPointerToWidg 98 Widget* G4OpenGLXmPushButton::GetPointerToWidget () 102 { 99 { 103 return &button; 100 return &button; 104 } 101 } >> 102 >> 103 #endif >> 104 >> 105 105 106