casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DisplayEH.h
Go to the documentation of this file.
00001 //# DisplayEH.h: WorldCanvas refresh event handler
00002 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000,2002
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_DISPLAYEH_H
00029 #define TRIALDISPLAY_DISPLAYEH_H
00030 
00031 #include <casa/aips.h>
00032 //# (Note: below is one of just 3 DL classes not in trialdisplay/...)
00033 #include <display/DisplayEvents/DisplayEvent.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // class for handling any type of DisplayEvent.
00039 // </summary>
00040 //
00041 // <prerequisite>
00042 // <li> <linkto class="DisplayEvent">DisplayEvent</linkto>
00043 // <li> Understanding of Display library event-handling methodology
00044 // </prerequisite>
00045 //
00046 // <etymology>
00047 // DisplayEH : generic display event handler--A handler for any type of 
00048 // display library event.
00049 // </etymology>
00050 //
00051 // <synopsis>
00052 // DisplayEH has an overridable callback that allows it to handle any type
00053 // of base class DisplayEvent.  It is intended to allow different types
00054 // of handlers (for different types of event) to reside on the same callback
00055 // list.
00056 // </synopsis>
00057 //
00058 // <motivation>
00059 // Different types of events (and event-handling routines) are needed in the
00060 // display library, and more are likely to be needed in future.  However,
00061 // creating still more specialized handler lists in places like WC for
00062 // each new type of event seems impractical.  WorldCanvas and PixelCanvas
00063 // already maintain 3 such lists each.  This generic event handler
00064 // interface will allow more general use of existing event dispatching lists.
00065 //
00066 // The immediate use for DisplayEH will be to enable more general
00067 // exchange of control messages between objects already attached 
00068 // (directly or indirectly) to WorldCanvas as handlers, in particular
00069 // between DisplayDatas and MultiWCTools.  WorldCanvas and WorldCanvasHolder
00070 // will add this simple interface in order to distribute the new events;
00071 // DisplayData will inherit it in order to handle them.  WCRefreshEH will
00072 // also be altered to inherit from this class, and WorldCanvas's
00073 // existing refresh event handler list will be altered to accept any
00074 // DisplayEH (not just WCRefreshEH objects).
00075 //
00076 // To listen for an event on this new WC 'channel', an object derived
00077 // from this interface would be attached to the WC's RefreshEHList
00078 // (as the MultiWCTools are) or WCH's DD list (in the DD case).  The
00079 // object would then implement handleEvent() to respond (only) to the
00080 // events of interest.  A sender would create a new DisplayEvent type (or
00081 // use an existing one for its intended purpose), and send the
00082 // event by calling WC::handleEvent(event).
00083 //
00084 // Except for the accommodations mentioned above, the current 
00085 // interface and functionality of WCRefreshEHs and all other
00086 // existing event handlers is left as is.  Note especially that
00087 // the older events (Position, Motion, Refresh) are still sent 
00088 // using the old 'operator()' interface, which remains in place, at
00089 // least for now.
00090 //
00091 // In the future, it may be useful to derive all existing handlers
00092 // from DisplayEH, to consolidate to just one generic EH list each
00093 // in PC, WC and WCH (and anywhere else event dispatching is needed),
00094 // and to distinguish handler and event types only during event
00095 // dispatching or processing.  Then any object which inherits this
00096 // interface could be placed on any such dispatching list in order
00097 // to respond to events of interest.
00098 // </motivation>
00099 
00100 class DisplayEH {
00101 
00102  public:
00103 
00104   // Classes that contain this interface (i.e., derive from it) can
00105   // override this method to implement actions for whatever types of
00106   // DisplayEvent they're interested in.
00107   // It was thought best at this point to move away from the old
00108   // 'operator()' style of handling interface, for clarity.
00109 
00110   virtual void handleEvent(DisplayEvent&) {  } 
00111   
00112   virtual ~DisplayEH() {  }
00113 
00114 };
00115 
00116 
00117 } //# NAMESPACE CASA - END
00118 
00119 #endif
00120 
00121 
00122