casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MouseToolState.h
Go to the documentation of this file.
00001 //# QtMouseToolState.qo.h: constants and [global] mouse-button state
00002 //# for the qtviewer 'mouse-tools' used by its display panel[s].
00003 //# Copyright (C) 2005
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id$
00028 
00029 
00030 #ifndef MOUSETOOLSTATE_H_
00031 #define MOUSETOOLSTATE_H_
00032 
00033 #include <string>
00034 
00035 // <synopsis>
00036 // QtMouseToolNames holds static constants for Qt mouse tools (with
00037 // some access methods for them).  There is an ordered list of 'mouse tool'
00038 // types, names and reference indices for them, etc.
00039 // </synopsis>
00040 namespace casa {
00041     namespace QtMouseToolNames {
00042 
00043         enum { nTools = 13 };
00044   
00045         extern const std::string ZOOM, PAN, SHIFTSLOPE, BRIGHTCONTRAST, POINT, RECTANGLE, ELLIPSE, POLYGON, POLYLINE,
00046                                         RULERLINE, POSITIONVELOCITY, MULTICROSSHAIR, ANNOTATIONS, NONE;
00047 
00048         //# nTools is an invalid tool index (or stands for "none") in these arrays.
00049         extern const std::string     tools[nTools+1], longnames[nTools+1], helptexts[nTools+1];
00050         extern std::string           iconnames[nTools+1];
00051 
00052         // Return index of named tool within the master list.
00053         // (i==nTools means 'not a tool').
00054         inline int toolIndex(std::string tool) {
00055             for(int i=0;;i++) if (tools[i]==tool || i==nTools) return i;
00056                         //# i==nTools means 'not a tool'.
00057         }
00058 
00059         inline std::string toolName(int toolindex) {
00060             if(toolindex<0 || toolindex>=nTools) return NONE;
00061             return tools[toolindex];
00062         }
00063 
00064         inline std::string longName(std::string tool) { return longnames[toolIndex(tool)];  }
00065         inline std::string iconName(std::string tool) { return iconnames[toolIndex(tool)];  }
00066         inline std::string help(std::string tool)     { return helptexts[toolIndex(tool)];  }
00067 
00068         enum PointRegionSymbols { SYM_DOT=0, SYM_DOWN_RIGHT_ARROW=1, SYM_DOWN_LEFT_ARROW=2,
00069                                   SYM_UP_RIGHT_ARROW=3, SYM_UP_LEFT_ARROW=4, SYM_PLUS=5,
00070                                   SYM_X=6, SYM_CIRCLE=7, SYM_DIAMOND=8, SYM_SQUARE=9,
00071                                   SYM_POINT_REGION_COUNT=10, SYM_UNKNOWN };
00072         std::string pointRegionSymbolIcon( PointRegionSymbols, int button=-1 );
00073         std::string pointRegionSymbolRc(PointRegionSymbols);
00074 
00075     };
00076 };
00077 
00078 #endif