00001 // @(#)root/gl:$Id: TGLManip.h 34006 2010-06-21 10:36:05Z matevz $ 00002 // Author: Richard Maunder 16/09/2005 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TGLManip 00013 #define ROOT_TGLManip 00014 00015 #ifndef ROOT_TVirtualGL 00016 #include "TVirtualGL.h" 00017 #endif 00018 #ifndef ROOT_TPoint 00019 #include "TPoint.h" 00020 #endif 00021 #ifndef ROOT_GuiTypes 00022 #include "GuiTypes.h" 00023 #endif 00024 #ifndef ROOT_TGLUtil 00025 #include "TGLUtil.h" 00026 #endif 00027 00028 class TGLPhysicalShape; 00029 class TGLVertex3; 00030 class TGLVector3; 00031 class TGLCamera; 00032 class TGLRect; 00033 class TGLBoundingBox; 00034 00035 00036 class TGLManip : public TVirtualGLManip 00037 { 00038 protected: 00039 TGLPhysicalShape *fShape; //! manipulated shape 00040 UInt_t fSelectedWidget; //! active width (axis) component 00041 Bool_t fActive; //! manipulator is active? 00042 00043 // Mouse tracking - in WINDOW coords 00044 TPoint fFirstMouse; //! first (start) mouse position (in WINDOW coords) 00045 TPoint fLastMouse; //! last (latest) mouse position (in WINDOW coords) 00046 00047 TGLManip(const TGLManip&); 00048 TGLManip& operator=(const TGLManip&); 00049 00050 void CalcDrawScale(const TGLBoundingBox& box, const TGLCamera& camera, 00051 Double_t& base, TGLVector3 axis[3]) const; 00052 00053 const UChar_t* ColorFor(UInt_t widget) const; 00054 00055 public: 00056 TGLManip(); 00057 TGLManip(TGLPhysicalShape* shape); 00058 virtual ~TGLManip(); 00059 00060 UInt_t GetSelectedWidget() const { return fSelectedWidget; } 00061 void SetSelectedWidget(UInt_t s) { fSelectedWidget = s; } 00062 00063 Bool_t GetActive() const { return fActive; } 00064 void SetActive(Bool_t a) { fActive = a; } 00065 00066 void Attach(TGLPhysicalShape* shape) { fShape = shape; } 00067 TGLPhysicalShape * GetAttached() const { return fShape; } 00068 00069 virtual void Draw(const TGLCamera& camera) const = 0; 00070 // CRAPPY TVirtualGLManip TTTT, just override it here 00071 virtual Bool_t Select(const TGLCamera&, const TGLRect&, const TGLBoundingBox&) { return kFALSE; } 00072 00073 virtual Bool_t HandleButton(const Event_t& event, const TGLCamera& camera); 00074 virtual Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera); 00075 00076 ClassDef(TGLManip, 0); // abstract base GL manipulator widget 00077 }; 00078 00079 #endif