Belle II Software  release-08-01-10
DisplayDrawingArea.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 //-----------------------------------------------------------------------------
10 // Description : A class to display CDC trigger objects.
11 //-----------------------------------------------------------------------------
12 
13 #ifdef TRGCDC_DISPLAY
14 
15 #ifndef TRGCDCDisplayDrawingArea_FLAG_
16 #define TRGCDCDisplayDrawingArea_FLAG_
17 
18 #include <vector>
19 #include <gtkmm.h>
20 
21 #ifdef TRGCDC_SHORT_NAMES
22 #define TCDDArea TRGCDCDisplayDrawingArea
23 #endif
24 
25 namespace Belle2 {
31  class TRGCDCDisplay;
32 
34  class TRGCDCDisplayDrawingArea : public Gtk::DrawingArea {
35 
36  public:
37 
39  TRGCDCDisplayDrawingArea(TRGCDCDisplay&, int size, double outerR);
40 
42  virtual ~TRGCDCDisplayDrawingArea();
43 
44  public:
45 
47  TRGCDCDisplay& display(void);
48 
49  double scale(double);
50  double scale(void) const;
51  virtual void resetPosition(void) = 0;
52  bool axial(void) const;
53  bool axial(bool);
54  bool stereo(void) const;
55  bool stereo(bool);
56  bool wireName(void) const;
57  bool wireName(bool);
58  bool oldCDC(void) const;
59  bool oldCDC(bool);
60 
61  virtual void clear(void) = 0;
62 
63  virtual bool on_expose_event(GdkEventExpose*) = 0;
64  virtual bool on_button_press_event(GdkEventButton*) = 0;
65 
66  private:
67  virtual void on_realize() = 0;
68 
69  private:
70 
72  TRGCDCDisplay& _w;
73 
74  double _scale;
75  bool _axial;
76  bool _stereo;
77  bool _wireName;
78  bool _oldCDC;
79  };
80 
81 //-----------------------------------------------------------------------------
82 
83  inline
84  double
85  TRGCDCDisplayDrawingArea::scale(double a)
86  {
87  return _scale = a;
88  }
89 
90  inline
91  double
92  TRGCDCDisplayDrawingArea::scale(void) const
93  {
94  return _scale;
95  }
96 
97  inline
98  bool
99  TRGCDCDisplayDrawingArea::axial(void) const
100  {
101  return _axial;
102  }
103 
104  inline
105  bool
106  TRGCDCDisplayDrawingArea::axial(bool a)
107  {
108  return _axial = a;
109  }
110 
111  inline
112  bool
113  TRGCDCDisplayDrawingArea::stereo(void) const
114  {
115  return _stereo;
116  }
117 
118  inline
119  bool
120  TRGCDCDisplayDrawingArea::stereo(bool a)
121  {
122  return _stereo = a;
123  }
124 
125  inline
126  bool
127  TRGCDCDisplayDrawingArea::wireName(void) const
128  {
129  return _wireName;
130  }
131 
132  inline
133  bool
134  TRGCDCDisplayDrawingArea::wireName(bool a)
135  {
136  return _wireName = a;
137  }
138 
139  inline
140  bool
141  TRGCDCDisplayDrawingArea::oldCDC(void) const
142  {
143  return _oldCDC;
144  }
145 
146  inline
147  bool
148  TRGCDCDisplayDrawingArea::oldCDC(bool a)
149  {
150  return _oldCDC = a;
151  }
152 
153  inline
154  TRGCDCDisplay&
155  TRGCDCDisplayDrawingArea::display(void)
156  {
157  return _w;
158  }
159 
161 } // namespace Belle2
162 
163 #endif // TRGCDCDisplayDrawingArea_FLAG_
164 #endif
Abstract base class for different kinds of events.