Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:29

0001 #ifndef Fireworks_Core_CmsAnnotation_h
0002 #define Fireworks_Core_CmsAnnotation_h
0003 
0004 #include "TGLOverlay.h"
0005 
0006 class TGLViewer;
0007 class TGLViewerBase;
0008 class FWConfiguration;
0009 
0010 class CmsAnnotation : public TGLOverlayElement {
0011 private:
0012   enum EDrag { kMove, kResize, kNone };
0013 
0014 public:
0015   CmsAnnotation(TGLViewerBase* parent, Float_t posx, Float_t posy);
0016   ~CmsAnnotation() override;
0017 
0018   // ---------- member, functions -------------------------
0019 
0020   //configuration management interface
0021   virtual void addTo(FWConfiguration&) const;
0022   virtual void setFrom(const FWConfiguration&);
0023 
0024   void Render(TGLRnrCtx& rnrCtx) override;
0025 
0026   Bool_t MouseEnter(TGLOvlSelectRecord& selRec) override;
0027   Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec, Event_t* event) override;
0028   void MouseLeave() override;
0029 
0030   Float_t getSize() const { return fSize; }
0031   void setSize(Float_t x) { fSize = x; }
0032 
0033   bool getVisible() const;
0034   void setVisible(bool x);
0035 
0036   bool getAllowDestroy() const { return fAllowDestroy; }
0037   void setAllowDestroy(bool x) { fAllowDestroy = x; }
0038 
0039   CmsAnnotation(const CmsAnnotation&) = delete;                   // stop default
0040   const CmsAnnotation& operator=(const CmsAnnotation&) = delete;  // stop default
0041 
0042 private:
0043   Float_t fPosX;  // x position [0, 1]
0044   Float_t fPosY;  // y position [0, 1]
0045 
0046   Int_t fMouseX, fMouseY;  //! last mouse position
0047   EDrag fDrag;
0048 
0049   TGLViewer* fParent;
0050 
0051   Float_t fSize;  //! relative size to viewport width
0052   Float_t fSizeDrag;
0053 
0054   bool fActive;
0055   bool fAllowDestroy;
0056 };
0057 
0058 #endif