CMS 3D CMS Logo

CmsAnnotation.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_CmsAnnotation_h
2 #define Fireworks_Core_CmsAnnotation_h
3 
4 #include "TGLOverlay.h"
5 
6 class TGLViewer;
7 class TGLViewerBase;
8 class FWConfiguration;
9 
10 class CmsAnnotation : public TGLOverlayElement {
11 private:
12  enum EDrag { kMove, kResize, kNone };
13 
14 public:
15  CmsAnnotation(TGLViewerBase* parent, Float_t posx, Float_t posy);
16  ~CmsAnnotation() override;
17 
18  // ---------- member, functions -------------------------
19 
20  //configuration management interface
21  virtual void addTo(FWConfiguration&) const;
22  virtual void setFrom(const FWConfiguration&);
23 
24  void Render(TGLRnrCtx& rnrCtx) override;
25 
26  Bool_t MouseEnter(TGLOvlSelectRecord& selRec) override;
27  Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec, Event_t* event) override;
28  void MouseLeave() override;
29 
30  Float_t getSize() const { return fSize; }
31  void setSize(Float_t x) { fSize = x; }
32 
33  bool getVisible() const;
34  void setVisible(bool x);
35 
36  bool getAllowDestroy() const { return fAllowDestroy; }
37  void setAllowDestroy(bool x) { fAllowDestroy = x; }
38 
39  CmsAnnotation(const CmsAnnotation&) = delete; // stop default
40  const CmsAnnotation& operator=(const CmsAnnotation&) = delete; // stop default
41 
42 private:
43  Float_t fPosX; // x position [0, 1]
44  Float_t fPosY; // y position [0, 1]
45 
46  Int_t fMouseX, fMouseY;
48 
49  TGLViewer* fParent;
50 
51  Float_t fSize;
52  Float_t fSizeDrag;
53 
54  bool fActive;
56 };
57 
58 #endif
virtual void addTo(FWConfiguration &) const
const CmsAnnotation & operator=(const CmsAnnotation &)=delete
virtual void setFrom(const FWConfiguration &)
void setSize(Float_t x)
Definition: CmsAnnotation.h:31
bool getAllowDestroy() const
Definition: CmsAnnotation.h:36
void setAllowDestroy(bool x)
Definition: CmsAnnotation.h:37
bool getVisible() const
Bool_t MouseEnter(TGLOvlSelectRecord &selRec) override
void Render(TGLRnrCtx &rnrCtx) override
TGLViewer * fParent
Definition: CmsAnnotation.h:49
~CmsAnnotation() override
Float_t getSize() const
Definition: CmsAnnotation.h:30
CmsAnnotation(TGLViewerBase *parent, Float_t posx, Float_t posy)
EDrag fDrag
last mouse position
Definition: CmsAnnotation.h:47
Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event) override
void MouseLeave() override
void setVisible(bool x)
Definition: event.py:1
Float_t fSizeDrag
relative size to viewport width
Definition: CmsAnnotation.h:52