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,
28  Event_t* event) override;
29  void MouseLeave() override;
30 
31  Float_t getSize() const { return fSize; }
32  void setSize(Float_t x) { fSize = x; }
33 
34  bool getVisible() const;
35  void setVisible(bool x);
36 
37  bool getAllowDestroy() const { return fAllowDestroy; }
38  void setAllowDestroy(bool x) { fAllowDestroy = x; }
39 
40 private:
41  CmsAnnotation(const CmsAnnotation&) = delete; // stop default
42  const CmsAnnotation& operator=(const CmsAnnotation&) = delete; // stop default
43 
44  Float_t fPosX; // x position [0, 1]
45  Float_t fPosY; // y position [0, 1]
46 
47  Int_t fMouseX, fMouseY;
49 
50  TGLViewer *fParent;
51 
52  Float_t fSize;
53  Float_t fSizeDrag;
54 
55  bool fActive;
57 };
58 
59 #endif
bool getVisible() const
const CmsAnnotation & operator=(const CmsAnnotation &)=delete
virtual void setFrom(const FWConfiguration &)
void setSize(Float_t x)
Definition: CmsAnnotation.h:32
void setAllowDestroy(bool x)
Definition: CmsAnnotation.h:38
bool getAllowDestroy() const
Definition: CmsAnnotation.h:37
Bool_t MouseEnter(TGLOvlSelectRecord &selRec) override
void Render(TGLRnrCtx &rnrCtx) override
TGLViewer * fParent
Definition: CmsAnnotation.h:50
~CmsAnnotation() override
Float_t getSize() const
Definition: CmsAnnotation.h:31
virtual void addTo(FWConfiguration &) const
CmsAnnotation(TGLViewerBase *parent, Float_t posx, Float_t posy)
EDrag fDrag
last mouse position
Definition: CmsAnnotation.h:48
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:53