Line data Source code
1 : //# PlotEvent.cc: Classes for interaction events.
2 : //# Copyright (C) 2008
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 : #include <graphics/GenericPlotter/PlotEvent.h>
28 :
29 : using namespace std;
30 :
31 : using namespace casacore;
32 : namespace casa {
33 :
34 : /////////////////////////////////
35 : // PLOTSELECTEVENT DEFINITIONS //
36 : /////////////////////////////////
37 :
38 0 : PlotSelectEvent::PlotSelectEvent(PlotCanvas* canvas, const PlotRegion& region):
39 0 : m_canvas(canvas), m_region(region) { }
40 :
41 0 : PlotSelectEvent::~PlotSelectEvent() { }
42 :
43 0 : PlotCanvas* PlotSelectEvent::canvas() const { return m_canvas; }
44 :
45 0 : PlotRegion PlotSelectEvent::region() const { return m_region; }
46 :
47 :
48 : ////////////////////////////////
49 : // PLOTMOUSEEVENT DEFINITIONS //
50 : ////////////////////////////////
51 :
52 0 : PlotMouseEvent::PlotMouseEvent(PlotCanvas* canvas, Type t, Button b,
53 0 : const PlotCoordinate& c) : m_canvas(canvas), m_type(t), m_button(b),
54 0 : m_coord(c) { }
55 :
56 0 : PlotMouseEvent::~PlotMouseEvent() { }
57 :
58 0 : PlotCanvas* PlotMouseEvent::canvas() const { return m_canvas; }
59 :
60 0 : PlotMouseEvent::Type PlotMouseEvent::type() const { return m_type; }
61 :
62 0 : PlotMouseEvent::Button PlotMouseEvent::button() const { return m_button; }
63 :
64 0 : PlotCoordinate PlotMouseEvent::where() const { return m_coord; }
65 :
66 :
67 : ////////////////////////////////
68 : // PLOTWHEELEVENT DEFINITIONS //
69 : ////////////////////////////////
70 :
71 0 : PlotWheelEvent::PlotWheelEvent(PlotCanvas* canvas, int d,
72 0 : const PlotCoordinate& c) : m_canvas(canvas), m_delta(d), m_coord(c) { }
73 :
74 0 : PlotWheelEvent::~PlotWheelEvent() { }
75 :
76 0 : PlotCanvas* PlotWheelEvent::canvas() const { return m_canvas; }
77 :
78 0 : int PlotWheelEvent::delta() const { return m_delta; }
79 :
80 0 : PlotCoordinate PlotWheelEvent::where() const { return m_coord; }
81 :
82 :
83 : //////////////////////////////
84 : // PLOTKEYEVENT DEFINITIONS //
85 : //////////////////////////////
86 :
87 0 : PlotKeyEvent::PlotKeyEvent(PlotCanvas* canvas, char key,
88 0 : const vector<Modifier>& m): m_canvas(canvas), m_key(key), m_mods(m) { }
89 :
90 0 : PlotKeyEvent::~PlotKeyEvent() { }
91 :
92 0 : PlotCanvas* PlotKeyEvent::canvas() const { return m_canvas; }
93 :
94 0 : char PlotKeyEvent::key() const { return m_key; }
95 :
96 0 : vector<PlotKeyEvent::Modifier> PlotKeyEvent::modifiers() const {
97 0 : return m_mods;
98 : }
99 :
100 0 : String PlotKeyEvent::toString() const {
101 0 : stringstream ss;
102 :
103 0 : for(unsigned int i = 0; i < m_mods.size(); i++) {
104 0 : ss << modifier(m_mods[i]);
105 0 : if(i < m_mods.size() - 1) ss << '+';
106 : }
107 0 : ss << m_key;
108 :
109 0 : return ss.str();
110 : }
111 :
112 :
113 : /////////////////////////////////
114 : // PLOTRESIZEEVENT DEFINITIONS //
115 : /////////////////////////////////
116 :
117 0 : PlotResizeEvent::PlotResizeEvent(PlotCanvas* canvas, int oldW, int oldH,
118 0 : int newW, int newH) : m_plotter(NULL), m_canvas(canvas),
119 0 : m_old(oldW, oldH), m_new(newW, newH) { }
120 :
121 0 : PlotResizeEvent::PlotResizeEvent(Plotter* plotter, int oldW, int oldH,
122 0 : int newW, int newH) : m_plotter(plotter), m_canvas(NULL),
123 0 : m_old(oldW, oldH), m_new(newW, newH) { }
124 :
125 0 : PlotResizeEvent::~PlotResizeEvent() { }
126 :
127 0 : PlotCanvas* PlotResizeEvent::canvas() const { return m_canvas; }
128 :
129 0 : Plotter* PlotResizeEvent::plotter() const { return m_plotter; }
130 :
131 0 : pair<int, int> PlotResizeEvent::oldSize() const { return m_old; }
132 :
133 0 : pair<int, int> PlotResizeEvent::newSize() const { return m_new; }
134 :
135 :
136 : /////////////////////////////////
137 : // PLOTBUTTONEVENT DEFINITIONS //
138 : /////////////////////////////////
139 :
140 0 : PlotButtonEvent::PlotButtonEvent(PlotButton* button) : m_button(button) { }
141 :
142 0 : PlotButtonEvent::~PlotButtonEvent() { }
143 :
144 0 : PlotButton* PlotButtonEvent::button() const { return m_button; }
145 :
146 :
147 : ///////////////////////////////////
148 : // PLOTCHECKBOXEVENT DEFINITIONS //
149 : ///////////////////////////////////
150 :
151 0 : PlotCheckboxEvent::PlotCheckboxEvent(PlotCheckbox* cb) : m_checkbox(cb) { }
152 :
153 0 : PlotCheckboxEvent::~PlotCheckboxEvent() { }
154 :
155 0 : PlotCheckbox* PlotCheckboxEvent::checkbox() const { return m_checkbox; }
156 :
157 : }
|