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