G4OpenGLXmFourArrowButtons.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
00030 
00031 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
00032 
00033 #include "G4OpenGLXmVWidgetComponent.hh"
00034 #include "G4OpenGLXmVWidgetContainer.hh"
00035 #include "G4OpenGLXmFourArrowButtons.hh"
00036 #include <X11/Intrinsic.h>
00037 #include <Xm/Form.h>
00038 #include <Xm/ArrowBG.h>
00039 
00040 #include "globals.hh"
00041 
00042 G4OpenGLXmFourArrowButtons::G4OpenGLXmFourArrowButtons (XtCallbackRec** c)
00043 {
00044   callback = c;
00045 }
00046 
00047 G4OpenGLXmFourArrowButtons::~G4OpenGLXmFourArrowButtons ()
00048 {}
00049 
00050 void G4OpenGLXmFourArrowButtons::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
00051 {
00052 
00053   pView = container->GetView ();
00054   ProcesspView ();
00055 
00056   parent = container->GetPointerToWidget ();
00057 
00058   arrow_form = XtVaCreateManagedWidget 
00059     ("arrow_form",
00060      xmFormWidgetClass,
00061      *parent,
00062      XmNfractionBase, 3,
00063 
00064      XtNvisual, visual, 
00065      XtNdepth, depth, 
00066      XtNcolormap, cmap, 
00067      XtNborderColor, borcol,
00068      XtNbackground, bgnd,
00069 
00070      NULL);
00071 
00072 
00074   arrow = XtVaCreateManagedWidget 
00075     ("up_arrow",
00076      xmArrowButtonGadgetClass, 
00077      arrow_form,
00078      
00079      XmNtopAttachment, XmATTACH_POSITION,
00080      XmNtopPosition, 0,
00081      
00082      XmNbottomAttachment, XmATTACH_POSITION,
00083      XmNbottomPosition, 1,
00084      
00085      XmNleftAttachment, XmATTACH_POSITION,
00086      XmNleftPosition, 1,
00087 
00088      XmNrightAttachment, XmATTACH_POSITION,
00089      XmNrightPosition, 2,
00090 
00091      XmNarrowDirection, XmARROW_UP,
00092      XmNuserData, True,
00093      NULL);
00094   
00095   XtAddCallbacks (arrow, 
00096                   XmNactivateCallback, 
00097                   callback[0]);
00098   
00099   XtAddCallbacks (arrow, 
00100                   XmNarmCallback, 
00101                   callback[0]);
00102   
00103   XtAddCallbacks (arrow, 
00104                   XmNdisarmCallback, 
00105                   callback[0]);
00106   
00108   arrow = XtVaCreateManagedWidget 
00109     ("down_arrow",
00110      xmArrowButtonGadgetClass, 
00111      arrow_form,
00112      
00113      XmNtopAttachment, XmATTACH_POSITION,
00114      XmNtopPosition, 2,
00115 
00116      XmNbottomAttachment, XmATTACH_POSITION,
00117      XmNbottomPosition, 3,
00118 
00119      XmNleftAttachment, XmATTACH_POSITION,
00120      XmNleftPosition, 1,
00121 
00122      XmNrightAttachment, XmATTACH_POSITION,
00123      XmNrightPosition, 2,
00124 
00125      XmNarrowDirection, XmARROW_DOWN,
00126      XmNuserData, False,
00127      NULL);
00128   
00129   XtAddCallbacks (arrow, 
00130                   XmNactivateCallback, 
00131                   callback[1]);
00132   
00133   XtAddCallbacks (arrow, 
00134                   XmNarmCallback, 
00135                   callback[1]);
00136   
00137   XtAddCallbacks (arrow, 
00138                   XmNdisarmCallback, 
00139                   callback[1]);
00140   
00142   arrow = XtVaCreateManagedWidget 
00143     ("left_arrow",
00144      xmArrowButtonGadgetClass, 
00145      arrow_form,
00146      
00147      XmNtopAttachment, XmATTACH_POSITION,
00148      XmNtopPosition, 1,
00149      
00150      XmNbottomAttachment, XmATTACH_POSITION,
00151      XmNbottomPosition, 2,
00152      
00153      XmNleftAttachment, XmATTACH_POSITION,
00154      XmNleftPosition, 0,
00155      
00156      XmNrightAttachment, XmATTACH_POSITION,
00157      XmNrightPosition, 1,
00158      
00159      XmNarrowDirection, XmARROW_LEFT,
00160      XmNuserData, False,
00161      NULL);
00162   
00163   XtAddCallbacks (arrow, 
00164                   XmNactivateCallback, 
00165                   callback[2]);
00166   
00167   XtAddCallbacks (arrow, 
00168                   XmNarmCallback, 
00169                   callback[2]);
00170   
00171   XtAddCallbacks (arrow, 
00172                   XmNdisarmCallback, 
00173                   callback[2]);
00174   
00176   arrow = XtVaCreateManagedWidget 
00177     ("right_arrow",
00178      xmArrowButtonGadgetClass, 
00179      arrow_form,
00180      
00181      XmNtopAttachment, XmATTACH_POSITION,
00182      XmNtopPosition, 1,
00183      
00184      XmNbottomAttachment, XmATTACH_POSITION,
00185      XmNbottomPosition, 2,
00186 
00187      XmNleftAttachment, XmATTACH_POSITION,
00188      XmNleftPosition, 2,
00189 
00190      XmNrightAttachment, XmATTACH_POSITION,
00191      XmNrightPosition, 3,
00192 
00193      XmNarrowDirection, XmARROW_RIGHT,
00194      XmNuserData, True,
00195      NULL);
00196   
00197   XtAddCallbacks (arrow, 
00198                   XmNactivateCallback, 
00199                   callback[3]);
00200   
00201   XtAddCallbacks (arrow, 
00202                   XmNarmCallback, 
00203                   callback[3]);
00204   
00205   XtAddCallbacks (arrow, 
00206                   XmNdisarmCallback, 
00207                   callback[3]);
00208 
00209 }
00210 
00211 Widget* G4OpenGLXmFourArrowButtons::GetPointerToParent ()
00212 {
00213   return parent;
00214 }
00215 
00216 Widget* G4OpenGLXmFourArrowButtons::GetPointerToWidget () 
00217 {
00218   return &arrow_form;
00219 }
00220 
00221 #endif

Generated on Mon May 27 17:49:11 2013 for Geant4 by  doxygen 1.4.7