PlotRangeWidget.qo.h

Go to the documentation of this file.
00001 //# PlotRangeWidget.qo.h: Widget for plot axes ranges.
00002 //# Copyright (C) 2009
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 #ifndef PLOTRANGEWIDGET_QO_H
00028 #define PLOTRANGEWIDGET_QO_H
00029 
00030 #include <plotms/Gui/PlotRangeWidget.ui.h>
00031 
00032 #include <casaqt/QtUtilities/QtEditingWidget.qo.h>
00033 #include <graphics/GenericPlotter/PlotOptions.h>
00034 
00035 #include <utility>
00036 
00037 namespace casa {
00038 
00039 // Widget for selecting a plot axis range.  Lets the user choose between an
00040 // automatic range or a custom range they can set.  Ranges can either be normal
00041 // doubles, or two dates which are converted to/from doubles as needed using
00042 // PMS::dateDouble().
00043 class PlotRangeWidget : public QtEditingWidget, Ui::RangeWidget {
00044     Q_OBJECT
00045     
00046 public:
00047     // Constructor which takes an optional parent widget.
00048     PlotRangeWidget(bool customOnTwoLines = false, QWidget* parent = NULL);
00049     
00050     // Destructor.
00051     ~PlotRangeWidget();
00052     
00053     
00054     // Gets/Sets whether or not the displayed range widgets are for dates or
00055     // not.
00056     // <group>
00057     bool isDate() const;
00058     void setIsDate(bool isDate = true);
00059     // </group>
00060     
00061     // Gets whether the currently set date is custom or not.
00062     bool isCustom() const;
00063     
00064     // Gets/Sets the currently set range.
00065     prange_t getRange() const;
00066     void getRange(double& from, double& to) {
00067         prange_t r = getRange();
00068         from = r.first;
00069         to = r.second;
00070     }
00071     void setRange(bool isDate, bool isCustom, double from, double to);
00072     void setRange(bool isDate, bool isCustom, prange_t range) {
00073         setRange(isDate, isCustom, range.first, range.second); }
00074     // </group>
00075     
00076     // Overrides PlotMSWidget::addRadioButtonsToGroup().
00077     void addRadioButtonsToGroup(QButtonGroup* group) const;
00078     
00079 private:
00080     // Whether last set range was custom or not.
00081     bool isCustom_;
00082     
00083     // Last set range.
00084     double from_, to_;
00085     
00086 private slots:
00087     // Slot for when the set range changes.
00088     void rangeChanged();
00089     void timeFromChanged();
00090     void timeToChanged();
00091 };
00092 
00093 }
00094 
00095 #endif /* PLOTRANGEWIDGET_QO_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1