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 FWConfiguration;
8 
9 class CmsAnnotation : public TGLOverlayElement {
10 private:
11  enum EDrag { kMove, kResize, kNone};
12 
13 public:
14  CmsAnnotation(TGLViewerBase *parent, Float_t posx, Float_t posy);
15  ~CmsAnnotation() override;
16 
17  // ---------- member, functions -------------------------
18 
19  //configuration management interface
20  virtual void addTo(FWConfiguration&) const;
21  virtual void setFrom(const FWConfiguration&);
22 
23  void Render(TGLRnrCtx& rnrCtx) override;
24 
25  Bool_t MouseEnter(TGLOvlSelectRecord& selRec) override;
26  Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
27  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 private:
40  CmsAnnotation(const CmsAnnotation&) = delete; // stop default
41  const CmsAnnotation& operator=(const CmsAnnotation&) = delete; // stop default
42 
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
bool getVisible() const
const CmsAnnotation & operator=(const CmsAnnotation &)=delete
virtual void setFrom(const FWConfiguration &)
void setSize(Float_t x)
Definition: CmsAnnotation.h:31
void setAllowDestroy(bool x)
Definition: CmsAnnotation.h:37
bool getAllowDestroy() const
Definition: CmsAnnotation.h:36
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
virtual void addTo(FWConfiguration &) const
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