casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtMouseTools.qo.h
Go to the documentation of this file.
1 //# QtMouseTools.qo.h: Qt versions of display library mouse tools.
2 //# Copyright (C) 2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 
29 #ifndef QTMOUSETOOLS_H
30 #define QTMOUSETOOLS_H
31 
32 #include <casa/aips.h>
41 #include <casa/Containers/Record.h>
42 
43 #include <graphics/X11/X_enter.h>
44 # include <QObject>
45 #include <graphics/X11/X_exit.h>
46 
47 namespace casa {
48 
49 
50 
51 // <synopsis>
52 // Nothing yet: it may prove useful for Qt-signal-emitting mouse tools
53 // (which are MWCTools or possibly PCTools) to have a common base.
54 // </synopsis>
55  class QtMouseTool: public QObject {
56 
57  Q_OBJECT //# Allows slot/signal definition. Must only occur in
58  //# implement/.../*.h files; also, makefile must include
59  //# name of this file in 'mocs' section.
60 
61  public:
62 
63  QtMouseTool() : QObject() { }
65 
66  };
67 
68 
69 
70 
71 // <synopsis>
72 // QtRTRegion is the Rectangle Region mouse tool that sends a signal
73 // when a new rectangle is ready.
74 // </synopsis>
75  class QtRTRegion: public QtMouseTool, public MultiRectToolImpl {
76 
77  Q_OBJECT //# Allows slot/signal definition. Must only occur in
78  //# implement/.../*.h files; also, makefile must include
79  //# name of this file in 'mocs' section.
80 
81  public:
82 
84 
86 
87  // Retrieve the current rectangular mouse region record and WCH, if any.
88  // (If nothing is ready, returns false -- be sure to check before using
89  // return parameters. See implementation for mouseRegion casacore::Record format).
90  bool getMouseRegion(casacore::Record& mouseRegion, WorldCanvasHolder*& wch);
91 
92  signals:
93 
94  // See regionReady() implementation for format of the record. (For some
95  // uses, a connecting slot may be able to do without the WCH* parameter).
98 
99  protected:
100 
101  // Signals mouseRegionReady with an appropriate casacore::Record, when
102  // called by base class in response to user selection with the mouse.
103  // See implementation for format of the record.
104  virtual void regionReady();
105 
106  virtual void clicked(int x, int y);
107  virtual void doubleClicked(int x, int y);
108  //virtual void rectangleReady();
109  //virtual void handleEvent(DisplayEvent& ev);
110  //virtual void keyPressed(const WCPositionEvent &ev);
111 
112  PanelDisplay* pd_; // (Kludge... zIndex inaccessible from WC...)
113 
114  };
115 
116 
117 // <synopsis>
118 // QtPTRegion is the Rectangle Region mouse tool that sends a signal
119 // when a new rectangle is ready.
120 // </synopsis>
122 
123  Q_OBJECT //# Allows slot/signal definition. Must only occur in
124  //# implement/.../*.h files; also, makefile must include
125  //# name of this file in 'mocs' section.
126 
127  public:
128 
130 
132 
133  // Retrieve the current rectangular mouse region record and WCH, if any.
134  // (If nothing is ready, returns false -- be sure to check before using
135  // return parameters. See implementation for mouseRegion casacore::Record format).
136  bool getMouseRegion(casacore::Record& mouseRegion, WorldCanvasHolder*& wch);
137 
138  signals:
139 
140  // See regionReady() implementation for format of the record. (For some
141  // uses, a connecting slot may be able to do without the WCH* parameter).
144 
145  protected:
146 
147  // Signals mouseRegionReady with an appropriate casacore::Record, when
148  // called by base class in response to user selection with the mouse.
149  // See implementation for format of the record.
150  virtual void regionReady();
151 
152  virtual void clicked(int x, int y);
153  virtual void doubleClicked(int x, int y);
154  //virtual void rectangleReady();
155  //virtual void handleEvent(DisplayEvent& ev);
156  //virtual void keyPressed(const WCPositionEvent &ev);
157 
158  PanelDisplay* pd_; // (Kludge... zIndex inaccessible from WC...)
159 
160  };
161 
162 
163 // <synopsis>
164 // QtELRegion is the Ellipse Region mouse tool that sends a signal
165 // when a new circle is ready.
166 // </synopsis>
168 
169  Q_OBJECT //# Allows slot/signal definition. Must only occur in
170  //# implement/.../*.h files; also, makefile must include
171  //# name of this file in 'mocs' section.
172 
173  public:
174 
176 
178 
179  // Retrieve the current circular mouse region record and WCH, if any.
180  // (If nothing is ready, returns false -- be sure to check before using
181  // return parameters. See implementation for mouseRegion casacore::Record format).
182  bool getMouseRegion(casacore::Record& mouseRegion, WorldCanvasHolder*& wch);
183 
184  signals:
185 
186  // See regionReady() implementation for format of the record. (For some
187  // uses, a connecting slot may be able to do without the WCH* parameter).
190 
191  protected:
192 
193  // Signals mouseRegionReady with an appropriate casacore::Record, when
194  // called by base class in response to user selection with the mouse.
195  // See implementation for format of the record.
196  virtual void regionReady();
197 
198  virtual void clicked(int x, int y);
199  virtual void doubleClicked(int x, int y);
200 
201  PanelDisplay* pd_; // (Kludge... zIndex inaccessible from WC...)
202 
203  };
204 
205 
206 // <synopsis>
207 // QtPTRegion is the Polygon Region mouse tool that sends a signal
208 // when a new polygon is ready.
209 // </synopsis>
210  class QtPTRegion: public QtMouseTool, public MultiPolyToolImpl {
211 
212  Q_OBJECT //# Allows slot/signal definition. Must only occur in
213  //# implement/.../*.h files; also, makefile must include
214  //# name of this file in 'mocs' section.
215 
216  public:
217 
219 
221 
222  // Retrieve the current polygon mouse region record and WCH, if any.
223  // (If nothing is ready, returns false -- be sure to check before using
224  // return parameters. See implementation for mouseRegion casacore::Record format).
225  bool getMouseRegion(casacore::Record& mouseRegion, WorldCanvasHolder*& wch);
226 
227  signals:
228 
229  // See regionReady() implementation for format of the record. (For some
230  // uses, a connecting slot may be able to do without the WCH* parameter).
233 
234  protected:
235 
236  // This callback is invoked by the base when the user double-clicks
237  // inside a polygon defined previously (but see also polygonReady(),
238  // below). This implementation emits the Qt signal mouseRegionReady()
239  // with an appropriate casacore::Record defining the user's polygon mouse selection.
240  // See implementation for format of the record.
241  virtual void regionReady();
242  virtual void clicked(int x, int y);
243  virtual void doubleClicked(int x, int y);
244 
245  //virtual void handleEvent(DisplayEvent& ev);
246  //virtual void keyPressed(const WCPositionEvent &ev);
247 
249  //
250  // This callback is invoked by the base when the polygon is first
251  // defined (by a double-click at last point) or when the mouse is
252  // released after a move/resize. It was unused in glish. For Qt,
253  // this will also signal that the polygon region has been fully
254  // 'selected/made ready' (which will preclude the need for the
255  // user to double-click [again] inside the polygon to select it).
256  //virtual void polygonReady() { regionReady(); }
257 
258  // is this fix to 1393?
259  virtual void polygonReady() { }
260 
261  PanelDisplay* pd_; // (Kludge... zIndex inaccessible from WC...)
262 
263  };
264 
265 // <synopsis>
266 // QtPolylineToolRegion is the Polyline Region mouse tool that sends a signal
267 // when a new polyline is ready.
268 // </synopsis>
270 
271  Q_OBJECT
272 
273  public:
274 
276  QtMouseTool(), MultiPolylineToolImpl(rf, pd), pd_(pd) { }
277 
279 
280  // Retrieve the current polyline mouse region record and WCH, if any.
281  // (If nothing is ready, returns false -- be sure to check before using
282  // return parameters. See implementation for mouseRegion casacore::Record format).
283  bool getMouseRegion(casacore::Record& mouseRegion, WorldCanvasHolder*& wch);
284 
285  signals:
286 
287  // See regionReady() implementation for format of the record. (For some
288  // uses, a connecting slot may be able to do without the WCH* parameter).
291 
292  protected:
293 
294  // This callback is invoked by the base when the user double-clicks
295  // inside a polygon defined previously (but see also polygonReady(),
296  // below). This implementation emits the Qt signal mouseRegionReady()
297  // with an appropriate casacore::Record defining the user's polygon mouse selection.
298  // See implementation for format of the record.
299  virtual void regionReady();
300  virtual void clicked(int x, int y);
301  virtual void doubleClicked(int x, int y);
302 
303 
304 
306  //
307  // This callback is invoked by the base when the polygon is first
308  // defined (by a double-click at last point) or when the mouse is
309  // released after a move/resize. It was unused in glish. For Qt,
310  // this will also signal that the polygon region has been fully
311  // 'selected/made ready' (which will preclude the need for the
312  // user to double-click [again] inside the polygon to select it).
313  //virtual void polygonReady() { regionReady(); }
314 
315  // is this fix to 1393?
316  virtual void polylineReady() { }
317 
318  PanelDisplay* pd_; // (Kludge... zIndex inaccessible from WC...)
319 
320  };
321 
322 // <synopsis>
323 // QtPVToolRegion is the Polygon Region mouse tool that sends a signal
324 // when a new polygon is ready.
325 // </synopsis>
327 
328  Q_OBJECT //# Allows slot/signal definition. Must only occur in
329  //# implement/.../*.h files; also, makefile must include
330  //# name of this file in 'mocs' section.
331 
332  public:
333 
335 
337 
338  // Retrieve the current polygon mouse region record and WCH, if any.
339  // (If nothing is ready, returns false -- be sure to check before using
340  // return parameters. See implementation for mouseRegion casacore::Record format).
341  bool getMouseRegion(casacore::Record& mouseRegion, WorldCanvasHolder*& wch);
342 
343  signals:
344 
345  // See regionReady() implementation for format of the record. (For some
346  // uses, a connecting slot may be able to do without the WCH* parameter).
349 
350  protected:
351 
352  // This callback is invoked by the base when the user double-clicks
353  // inside a polygon defined previously (but see also polygonReady(),
354  // below). This implementation emits the Qt signal mouseRegionReady()
355  // with an appropriate casacore::Record defining the user's polygon mouse selection.
356  // See implementation for format of the record.
357  virtual void regionReady();
358  virtual void clicked(int x, int y);
359  virtual void doubleClicked(int x, int y);
360 
361  //virtual void handleEvent(DisplayEvent& ev);
362  //virtual void keyPressed(const WCPositionEvent &ev);
363 
364  PanelDisplay* pd_; // (Kludge... zIndex inaccessible from WC...)
365 
366  };
367 
368 
369 } //# NAMESPACE CASA - END
370 
371 #endif
372 
virtual void doubleClicked(int x, int y)
void echoClicked(casacore::Record)
PanelDisplay * pd_
QtPointRegion(viewer::RegionSourceFactory *rf, PanelDisplay *pd)
WorldCanvas event-based rectangle region drawer.
bool getMouseRegion(casacore::Record &mouseRegion, WorldCanvasHolder *&wch)
Retrieve the current circular mouse region record and WCH, if any.
virtual void doubleClicked(int x, int y)
virtual void clicked(int x, int y)
void mouseRegionReady(casacore::Record mouseRegion, WorldCanvasHolder *)
See regionReady() implementation for format of the record.
void echoClicked(casacore::Record)
WorldCanvas event-based polygon region drawer.
virtual void regionReady()
This callback is invoked by the base when the user double-clicks inside a polygon defined previously ...
bool getMouseRegion(casacore::Record &mouseRegion, WorldCanvasHolder *&wch)
Retrieve the current polyline mouse region record and WCH, if any.
WorldCanvas event-based rectangle region drawer.
PanelDisplay * pd_
virtual void rectangleReady(); virtual void handleEvent(DisplayEvent&amp; ev); virtual void keyPressed(co...
bool getMouseRegion(casacore::Record &mouseRegion, WorldCanvasHolder *&wch)
Retrieve the current polygon mouse region record and WCH, if any.
bool getMouseRegion(casacore::Record &mouseRegion, WorldCanvasHolder *&wch)
Retrieve the current rectangular mouse region record and WCH, if any.
QtPVToolRegion(viewer::RegionSourceFactory *rf, PanelDisplay *pd)
virtual void regionReady()
This callback is invoked by the base when the user double-clicks inside a polygon defined previously ...
virtual void regionReady()
This callback is invoked by the base when the user double-clicks inside a polygon defined previously ...
PanelDisplay * pd_
void mouseRegionReady(casacore::Record mouseRegion, WorldCanvasHolder *)
See regionReady() implementation for format of the record.
virtual void doubleClicked(int x, int y)
QtPTRegion(viewer::RegionSourceFactory *rf, PanelDisplay *pd)
void echoClicked(casacore::Record)
virtual void regionReady()
Signals mouseRegionReady with an appropriate casacore::Record, when called by base class in response ...
void echoClicked(casacore::Record)
WorldCanvas event-based polyline region drawer.
virtual void clicked(int x, int y)
void mouseRegionReady(casacore::Record mouseRegion, WorldCanvasHolder *)
See regionReady() implementation for format of the record.
virtual void polygonReady()
virtual void handleEvent(DisplayEvent&amp; ev); virtual void keyPressed(const WCPositionEvent &amp;ev); ...
virtual void clicked(int x, int y)
A hierarchical collection of named fields of various types.
Definition: Record.h:180
QtPolylineToolRegion(viewer::RegionSourceFactory *rf, PanelDisplay *pd)
QtRTRegion(viewer::RegionSourceFactory *rf, PanelDisplay *pd)
bool getMouseRegion(casacore::Record &mouseRegion, WorldCanvasHolder *&wch)
Retrieve the current polygon mouse region record and WCH, if any.
QtELRegion(viewer::RegionSourceFactory *rf, PanelDisplay *pd)
virtual void clicked(int x, int y)
is this fix to *virtual void polylineReady()
casacore::Function called when a polyline is ready and not being edited.
virtual void clicked(int x, int y)
virtual void regionReady()
Signals mouseRegionReady with an appropriate casacore::Record, when called by base class in response ...
void echoClicked(casacore::Record)
virtual void doubleClicked(int x, int y)
void echoClicked(casacore::Record)
virtual void doubleClicked(int x, int y)
bool getMouseRegion(casacore::Record &mouseRegion, WorldCanvasHolder *&wch)
Retrieve the current rectangular mouse region record and WCH, if any.
A holder to interface between DisplayDatas and a WorldCanvas.
PanelDisplay * pd_
virtual void handleEvent(DisplayEvent&amp; ev); virtual void keyPressed(const WCPositionEvent &amp;ev); ...
virtual void regionReady()
Signals mouseRegionReady with an appropriate casacore::Record, when called by base class in response ...
void mouseRegionReady(casacore::Record mouseRegion, WorldCanvasHolder *)
See regionReady() implementation for format of the record.
WorldCanvas event-based point region drawer.
A class which creates and manages &quot;panelled&quot; displays.
Definition: PanelDisplay.h:79
void mouseRegionReady(casacore::Record mouseRegion, WorldCanvasHolder *)
See regionReady() implementation for format of the record.
PanelDisplay * pd_
virtual void rectangleReady(); virtual void handleEvent(DisplayEvent&amp; ev); virtual void keyPressed(co...
WorldCanvas event-based ellipse region drawer.
virtual void doubleClicked(int x, int y)
void mouseRegionReady(casacore::Record mouseRegion, WorldCanvasHolder *)
See regionReady() implementation for format of the record.
virtual void clicked(int x, int y)