casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CrosshairEvent.h
Go to the documentation of this file.
00001 //# CrosshairEvent.h: class for MWCCrosshairTool point selection event.
00002 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000,2002,2003
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 #ifndef TRIALDISPLAY_CROSSHAIREVENT_H
00029 #define TRIALDISPLAY_CROSSHAIREVENT_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/DisplayEvents/WorldCanvasEvent.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class WorldCanvas;
00037 
00038 // <summary>
00039 // WorldCanvasEvent:contains info on the WC point selected by MWCCrosshairTool
00040 // </summary>
00041 
00042 // <use visibility=export>
00043 
00044 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00045 // </reviewed>
00046 
00047 // <etymology>
00048 // "CrosshairEvent" holds information about a point selected by the user
00049 // with the MWCCrosshairTool.
00050 // </etymology>
00051 
00052 // <synopsis>
00053 // CrosshairEvent is created by
00054 // <linkto class="MWCCrosshairTool">MWCCrosshairTool</linkto>
00055 // when a point is selected by the crosshair on a
00056 // <linkto class="WorldCanvas">WorldCanvas</linkto> draw area.
00057 // The event is passed (via WorldCanvas::handleEvent()) to the generic
00058 // <linkto class="DisplayEH">DisplayEH</linkto>s
00059 // registered with the WorldCanvas.
00060 // </synopsis>
00061 
00062 // <motivation>
00063 // A mechanism was needed to notify library objects associated with a
00064 // WorldCanvas (in particular,
00065 // <linkto class="DisplayData">DisplayData</linkto>s)
00066 // when a position was selected on the WC via MWCCrosshairTool.
00067 // Formerly, this information was sent only to glish.
00068 // This event is on a different level from the mouse/keyboard
00069 // WorldCanvasEvents and serves a different purpose, so a new event type
00070 // was created.
00071 // </motivation>
00072 
00073 // <thrown>
00074 // None.
00075 // </thrown>
00076 
00077 // <todo asof="1999/10/15">
00078 // None.
00079 // </todo>
00080 
00081 class CrosshairEvent : public WorldCanvasEvent {
00082 
00083  public:
00084 
00085   // Constructor taking a pointer to the WorldCanvas where the
00086   // event occured, and the pixel coordinates of the event.
00087   // evtype should be "down", "move", or "up", according to mouse state.
00088   CrosshairEvent(WorldCanvas *wc, const Int pixX, const Int pixY,
00089                  const String& evtype) :
00090     WorldCanvasEvent(wc),
00091     itsPixX(pixX), itsPixY(pixY),
00092     itsEvType(evtype)
00093     {  }
00094   
00095   // The x and y pixel position of the crosshair when the event occurred.
00096   // <group>
00097   virtual Int pixX() const { return itsPixX; }
00098   virtual Int pixY() const { return itsPixY; }
00099   virtual String evtype() const { return itsEvType; }
00100   // </group>
00101 
00102  private:
00103   
00104   // pixel position of the event
00105   Int itsPixX, itsPixY;
00106   // "down", "move", or "up", according to mouse state.
00107   String itsEvType;
00108 
00109 };
00110 
00111 
00112 } //# NAMESPACE CASA - END
00113 
00114 #endif
00115 
00116