casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtOldMouseTools.qo.h
Go to the documentation of this file.
00001 //# QtOldMouseTools.qo.h: Qt versions of display library mouse tools.
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 
00029 #ifndef QTOLDMOUSETOOLS_H
00030 #define QTOLDMOUSETOOLS_H
00031 
00032 #include <casa/aips.h>
00033 #include <display/DisplayEvents/MWCRTRegion.h>
00034 #include <display/DisplayEvents/MWCETRegion.h>
00035 #include <display/DisplayEvents/MWCPTRegion.h>
00036 #include <display/Display/PanelDisplay.h>
00037 #include <casa/Containers/Record.h>
00038 
00039 #include <graphics/X11/X_enter.h>
00040 #  include <QObject>
00041 #include <graphics/X11/X_exit.h>
00042 
00043 namespace casa {
00044 
00045 
00046 
00047 // <synopsis>
00048 // Nothing yet: it may prove useful for Qt-signal-emitting mouse tools
00049 // (which are MWCTools or possibly PCTools) to have a common base.
00050 // </synopsis>
00051 class QtOldMouseTool: public QObject {
00052 
00053   Q_OBJECT      //# Allows slot/signal definition.  Must only occur in
00054                 //# implement/.../*.h files; also, makefile must include
00055                 //# name of this file in 'mocs' section.
00056   
00057  public: 
00058  
00059   QtOldMouseTool() : QObject() {  }
00060   ~QtOldMouseTool() {  }
00061 
00062 }; 
00063 
00064 
00065 
00066 
00067 // <synopsis>
00068 // QtOldRTRegion is the Rectangle Region mouse tool that sends a signal
00069 // when a new rectangle is ready.
00070 // </synopsis>
00071 class QtOldRTRegion: public QtOldMouseTool, public MWCRTRegion {
00072   
00073   Q_OBJECT      //# Allows slot/signal definition.  Must only occur in
00074                 //# implement/.../*.h files; also, makefile must include
00075                 //# name of this file in 'mocs' section.
00076 
00077  public: 
00078  
00079   QtOldRTRegion(PanelDisplay* pd) : QtOldMouseTool(), MWCRTRegion(), pd_(pd) {  }
00080   
00081   ~QtOldRTRegion() {  }
00082   
00083   // Retrieve the current rectangular mouse region record and WCH, if any.
00084   // (If nothing is ready, returns False -- be sure to check before using
00085   // return parameters.  See implementation for mouseRegion Record format).
00086   Bool getMouseRegion(Record& mouseRegion, WorldCanvasHolder*& wch);
00087 
00088  signals:
00089  
00090   // See regionReady() implementation for format of the record.  (For some
00091   // uses, a connecting slot may be able to do without the WCH* parameter).
00092   void mouseRegionReady(Record mouseRegion, WorldCanvasHolder*);
00093   void echoClicked(Record);
00094 
00095  protected:
00096   
00097   // Signals mouseRegionReady with an appropriate Record, when
00098   // called by base class in response to user selection with the mouse.
00099   // See implementation for format of the record.
00100   virtual void regionReady();
00101 
00102   virtual void clicked(Int x, Int y); 
00103   virtual void doubleClicked(Int x, Int y); 
00104   //virtual void rectangleReady(); 
00105   //virtual void handleEvent(DisplayEvent& ev);
00106   //virtual void keyPressed(const WCPositionEvent &ev);
00107   
00108   PanelDisplay* pd_;    // (Kludge... zIndex inaccessible from WC...)
00109 
00110 };
00111 
00112 
00113 // <synopsis>
00114 // QtOldELRegion is the Ellipse Region mouse tool that sends a signal
00115 // when a new circle is ready.
00116 // </synopsis>
00117 class QtOldELRegion: public QtOldMouseTool, public MWCETRegion {
00118 
00119   Q_OBJECT      //# Allows slot/signal definition.  Must only occur in
00120                 //# implement/.../*.h files; also, makefile must include
00121                 //# name of this file in 'mocs' section.
00122 
00123  public:
00124 
00125   QtOldELRegion(PanelDisplay* pd) : QtOldMouseTool(), MWCETRegion(), pd_(pd) {  }
00126 
00127   ~QtOldELRegion() {  }
00128 
00129   // Retrieve the current circular mouse region record and WCH, if any.
00130   // (If nothing is ready, returns False -- be sure to check before using
00131   // return parameters.  See implementation for mouseRegion Record format).
00132   Bool getMouseRegion(Record& mouseRegion, WorldCanvasHolder*& wch);
00133 
00134  signals:
00135 
00136   // See regionReady() implementation for format of the record.  (For some
00137   // uses, a connecting slot may be able to do without the WCH* parameter).
00138   void mouseRegionReady(Record mouseRegion, WorldCanvasHolder*);
00139   void echoClicked(Record);
00140 
00141  protected:
00142 
00143   // Signals mouseRegionReady with an appropriate Record, when
00144   // called by base class in response to user selection with the mouse.
00145   // See implementation for format of the record.
00146   virtual void regionReady();
00147 
00148   virtual void clicked(Int x, Int y);
00149   virtual void doubleClicked(Int x, Int y);
00150 
00151   PanelDisplay* pd_;    // (Kludge... zIndex inaccessible from WC...)
00152 
00153 };
00154 
00155 
00156 // <synopsis>
00157 // QtOldPTRegion is the Polygon Region mouse tool that sends a signal
00158 // when a new polygon is ready.
00159 // </synopsis>
00160 class QtOldPTRegion: public QtOldMouseTool, public MWCPTRegion {
00161   
00162   Q_OBJECT      //# Allows slot/signal definition.  Must only occur in
00163                 //# implement/.../*.h files; also, makefile must include
00164                 //# name of this file in 'mocs' section.
00165 
00166  public: 
00167  
00168   QtOldPTRegion(PanelDisplay* pd) : QtOldMouseTool(), MWCPTRegion(), pd_(pd) {  }
00169   
00170   ~QtOldPTRegion() {  }
00171   
00172   // Retrieve the current polygon mouse region record and WCH, if any.
00173   // (If nothing is ready, returns False -- be sure to check before using
00174   // return parameters.  See implementation for mouseRegion Record format).
00175   Bool getMouseRegion(Record& mouseRegion, WorldCanvasHolder*& wch);
00176 
00177  signals:
00178  
00179   // See regionReady() implementation for format of the record.  (For some
00180   // uses, a connecting slot may be able to do without the WCH* parameter).
00181   void mouseRegionReady(Record mouseRegion, WorldCanvasHolder*);
00182   void echoClicked(Record);
00183 
00184  protected:
00185   
00186   // This callback is invoked by the base when the user double-clicks
00187   // inside a polygon defined previously (but see also polygonReady(),
00188   // below).  This implementation emits the Qt signal mouseRegionReady()
00189   // with an appropriate Record defining the user's polygon mouse selection.
00190   // See implementation for format of the record.
00191   virtual void regionReady();
00192   virtual void clicked(Int x, Int y);
00193   virtual void doubleClicked(Int x, Int y); 
00194 
00195   //virtual void handleEvent(DisplayEvent& ev);
00196   //virtual void keyPressed(const WCPositionEvent &ev);
00197   
00199   //
00200   // This callback is invoked by the base when the polygon is first
00201   // defined (by a double-click at last point) or when the mouse is
00202   // released after a move/resize.  It was unused in glish.  For Qt,
00203   // this will also signal that the polygon region has been fully
00204   // 'selected/made ready' (which will preclude the need for the
00205   // user to double-click [again] inside the polygon to select it). 
00206   //virtual void polygonReady() { regionReady();  }
00207 
00208   // is this fix to 1393?
00209   virtual void polygonReady() { }
00210 
00211   PanelDisplay* pd_;    // (Kludge... zIndex inaccessible from WC...)
00212 
00213 };
00214 
00215 
00216 
00217 
00218 } //# NAMESPACE CASA - END
00219 
00220 #endif
00221