casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MouseToolState.h
Go to the documentation of this file.
1 //# QtMouseToolState.qo.h: constants and [global] mouse-button state
2 //# for the qtviewer 'mouse-tools' used by its display panel[s].
3 //# Copyright (C) 2005
4 //# Associated Universities, Inc. Washington DC, USA.
5 //#
6 //# This library is free software; you can redistribute it and/or modify it
7 //# under the terms of the GNU Library General Public License as published by
8 //# the Free Software Foundation; either version 2 of the License, or (at your
9 //# option) any later version.
10 //#
11 //# This library is distributed in the hope that it will be useful, but WITHOUT
12 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 //# License for more details.
15 //#
16 //# You should have received a copy of the GNU Library General Public License
17 //# along with this library; if not, write to the Free Software Foundation,
18 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 //#
20 //# Correspondence concerning AIPS++ should be addressed as follows:
21 //# Internet email: aips2-request@nrao.edu.
22 //# Postal address: AIPS++ Project Office
23 //# National Radio Astronomy Observatory
24 //# 520 Edgemont Road
25 //# Charlottesville, VA 22903-2475 USA
26 //#
27 //# $Id$
28 
29 
30 #ifndef MOUSETOOLSTATE_H_
31 #define MOUSETOOLSTATE_H_
32 
33 #include <string>
34 
35 // <synopsis>
36 // QtMouseToolNames holds static constants for Qt mouse tools (with
37 // some access methods for them). There is an ordered list of 'mouse tool'
38 // types, names and reference indices for them, etc.
39 // </synopsis>
40 namespace casa {
41  namespace QtMouseToolNames {
42 
43  enum { nTools = 13 };
44 
45  extern const std::string ZOOM, PAN, SHIFTSLOPE, BRIGHTCONTRAST, POINT, RECTANGLE, ELLIPSE, POLYGON, POLYLINE,
47 
48  //# nTools is an invalid tool index (or stands for "none") in these arrays.
49  extern const std::string tools[nTools+1], longnames[nTools+1], helptexts[nTools+1];
50  extern std::string iconnames[nTools+1];
51 
52  // Return index of named tool within the master list.
53  // (i==nTools means 'not a tool').
54  inline int toolIndex(std::string tool) {
55  for(int i=0;; i++) if (tools[i]==tool || i==nTools) return i;
56  //# i==nTools means 'not a tool'.
57  }
58 
59  inline std::string toolName(int toolindex) {
60  if(toolindex<0 || toolindex>=nTools) return NONE;
61  return tools[toolindex];
62  }
63 
64  inline std::string longName(std::string tool) {
65  return longnames[toolIndex(tool)];
66  }
67  inline std::string iconName(std::string tool) {
68  return iconnames[toolIndex(tool)];
69  }
70  inline std::string help(std::string tool) {
71  return helptexts[toolIndex(tool)];
72  }
73 
78  };
79  std::string pointRegionSymbolIcon( PointRegionSymbols, int button=-1 );
81 
82  };
83 };
84 
85 #endif
const std::string RECTANGLE
std::string help(std::string tool)
const std::string SHIFTSLOPE
const std::string helptexts[nTools+1]
std::string iconName(std::string tool)
const std::string BRIGHTCONTRAST
const std::string ELLIPSE
const std::string RULERLINE
const std::string longnames[nTools+1]
std::string toolName(int toolindex)
const std::string POLYLINE
std::string longName(std::string tool)
const std::string POLYGON
std::string pointRegionSymbolIcon(PointRegionSymbols, int button=-1)
const std::string POINT
const std::string MULTICROSSHAIR
int toolIndex(std::string tool)
Return index of named tool within the master list.
const std::string PAN
const std::string ANNOTATIONS
const std::string ZOOM
std::string iconnames[nTools+1]
const std::string tools[nTools+1]
Definition: PlotTool.h:43
const std::string POSITIONVELOCITY
const std::string NONE
std::string pointRegionSymbolRc(PointRegionSymbols)