casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DisplayEH.h
Go to the documentation of this file.
1 //# DisplayEH.h: WorldCanvas refresh event handler
2 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000,2002
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 #ifndef TRIALDISPLAY_DISPLAYEH_H
29 #define TRIALDISPLAY_DISPLAYEH_H
30 
31 #include <casa/aips.h>
32 //# (Note: below is one of just 3 DL classes not in trialdisplay/...)
34 
35 namespace casa { //# NAMESPACE CASA - BEGIN
36 
37 // <summary>
38 // class for handling any type of DisplayEvent.
39 // </summary>
40 //
41 // <prerequisite>
42 // <li> <linkto class="DisplayEvent">DisplayEvent</linkto>
43 // <li> Understanding of Display library event-handling methodology
44 // </prerequisite>
45 //
46 // <etymology>
47 // DisplayEH : generic display event handler--A handler for any type of
48 // display library event.
49 // </etymology>
50 //
51 // <synopsis>
52 // DisplayEH has an overridable callback that allows it to handle any type
53 // of base class DisplayEvent. It is intended to allow different types
54 // of handlers (for different types of event) to reside on the same callback
55 // list.
56 // </synopsis>
57 //
58 // <motivation>
59 // Different types of events (and event-handling routines) are needed in the
60 // display library, and more are likely to be needed in future. However,
61 // creating still more specialized handler lists in places like WC for
62 // each new type of event seems impractical. WorldCanvas and PixelCanvas
63 // already maintain 3 such lists each. This generic event handler
64 // interface will allow more general use of existing event dispatching lists.
65 //
66 // The immediate use for DisplayEH will be to enable more general
67 // exchange of control messages between objects already attached
68 // (directly or indirectly) to WorldCanvas as handlers, in particular
69 // between DisplayDatas and MultiWCTools. WorldCanvas and WorldCanvasHolder
70 // will add this simple interface in order to distribute the new events;
71 // DisplayData will inherit it in order to handle them. WCRefreshEH will
72 // also be altered to inherit from this class, and WorldCanvas's
73 // existing refresh event handler list will be altered to accept any
74 // DisplayEH (not just WCRefreshEH objects).
75 //
76 // To listen for an event on this new WC 'channel', an object derived
77 // from this interface would be attached to the WC's RefreshEHList
78 // (as the MultiWCTools are) or WCH's DD list (in the DD case). The
79 // object would then implement handleEvent() to respond (only) to the
80 // events of interest. A sender would create a new DisplayEvent type (or
81 // use an existing one for its intended purpose), and send the
82 // event by calling WC::handleEvent(event).
83 //
84 // Except for the accommodations mentioned above, the current
85 // interface and functionality of WCRefreshEHs and all other
86 // existing event handlers is left as is. Note especially that
87 // the older events (Position, Motion, Refresh) are still sent
88 // using the old 'operator()' interface, which remains in place, at
89 // least for now.
90 //
91 // In the future, it may be useful to derive all existing handlers
92 // from DisplayEH, to consolidate to just one generic EH list each
93 // in PC, WC and WCH (and anywhere else event dispatching is needed),
94 // and to distinguish handler and event types only during event
95 // dispatching or processing. Then any object which inherits this
96 // interface could be placed on any such dispatching list in order
97 // to respond to events of interest.
98 // </motivation>
99 
100  class DisplayEH {
101 
102  public:
103 
104  // Classes that contain this interface (i.e., derive from it) can
105  // override this method to implement actions for whatever types of
106  // DisplayEvent they're interested in.
107  // It was thought best at this point to move away from the old
108  // 'operator()' style of handling interface, for clarity.
109 
110  virtual void handleEvent(DisplayEvent&) { }
111 
112  virtual ~DisplayEH() { }
113 
114  };
115 
116 
117 } //# NAMESPACE CASA - END
118 
119 #endif
120 
121 
122 
virtual void handleEvent(DisplayEvent &)
Classes that contain this interface (i.e., derive from it) can override this method to implement acti...
Definition: DisplayEH.h:110
class for handling any type of DisplayEvent.
Definition: DisplayEH.h:100
Class describing the most basic event information in the display classes.
Definition: DisplayEvent.h:82
virtual ~DisplayEH()
Definition: DisplayEH.h:112