Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGLManip.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Richard Maunder  16/09/2005
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLManip
0013 #define ROOT_TGLManip
0014 
0015 #include "TVirtualGL.h"
0016 #include "TPoint.h"
0017 #include "GuiTypes.h"
0018 #include "TGLUtil.h"
0019 
0020 class TGLPhysicalShape;
0021 class TGLVertex3;
0022 class TGLVector3;
0023 class TGLCamera;
0024 class TGLRect;
0025 class TGLBoundingBox;
0026 
0027 
0028 class TGLManip : public TVirtualGLManip
0029 {
0030 protected:
0031    TGLPhysicalShape  *fShape;             //! manipulated shape
0032    UInt_t             fSelectedWidget;    //! active width (axis) component
0033    Bool_t             fActive;            //! manipulator is active?
0034 
0035    // Mouse tracking - in WINDOW coords
0036    TPoint             fFirstMouse;        //! first (start) mouse position (in WINDOW coords)
0037    TPoint             fLastMouse;         //! last (latest) mouse position (in WINDOW coords)
0038 
0039    TGLManip(const TGLManip&);
0040    TGLManip& operator=(const TGLManip&);
0041 
0042    void CalcDrawScale(const TGLBoundingBox& box, const TGLCamera& camera,
0043                       Double_t& base, TGLVector3 axis[3]) const;
0044 
0045    const UChar_t* ColorFor(UInt_t widget) const;
0046 
0047 public:
0048    TGLManip();
0049    TGLManip(TGLPhysicalShape* shape);
0050    ~TGLManip() override;
0051 
0052    UInt_t GetSelectedWidget()   const { return fSelectedWidget; }
0053    void   SetSelectedWidget(UInt_t s) { fSelectedWidget = s; }
0054 
0055    Bool_t GetActive()   const { return fActive; }
0056    void   SetActive(Bool_t a) { fActive = a; }
0057 
0058    void               Attach(TGLPhysicalShape* shape) { fShape = shape; }
0059    TGLPhysicalShape * GetAttached() const { return fShape; }
0060 
0061    virtual void   Draw(const TGLCamera& camera) const = 0;
0062    // CRAPPY TVirtualGLManip TTTT, just override it here
0063    Bool_t Select(const TGLCamera&, const TGLRect&, const TGLBoundingBox&) override { return kFALSE; }
0064 
0065    virtual Bool_t HandleButton(const Event_t& event, const TGLCamera& camera);
0066    virtual Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera);
0067 
0068    ClassDefOverride(TGLManip, 0); // abstract base GL manipulator widget
0069 };
0070 
0071 #endif