casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotRangeWidget.qo.h
Go to the documentation of this file.
1 //# PlotRangeWidget.qo.h: Widget for plot axes ranges.
2 //# Copyright (C) 2009
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 #ifndef PLOTRANGEWIDGET_QO_H
28 #define PLOTRANGEWIDGET_QO_H
29 
30 #include <plotms/Gui/PlotRangeWidget.ui.h>
31 
34 
35 #include <utility>
36 
37 namespace casa {
38 
39 // Widget for selecting a plot axis range. Lets the user choose between an
40 // automatic range or a custom range they can set. Ranges can either be normal
41 // doubles, or two dates which are converted to/from doubles as needed using
42 // PMS::dateDouble().
43 class PlotRangeWidget : public QtEditingWidget, Ui::RangeWidget {
44  Q_OBJECT
45 
46 public:
47  // Constructor which takes an optional parent widget.
48  PlotRangeWidget(bool customOnTwoLines = false, QWidget* parent = NULL);
49 
50  // Destructor.
52 
53 
54  // Gets/Sets whether or not the displayed range widgets are for dates or
55  // not.
56  // <group>
57  bool isDate() const;
58  void setIsDate(bool isDate = true);
59  // </group>
60 
61  // Gets whether the currently set date is custom or not.
62  bool isCustom() const;
63 
64  // Gets/Sets the currently set range.
65  prange_t getRange() const;
66  void getRange(double& from, double& to) {
67  prange_t r = getRange();
68  from = r.first;
69  to = r.second;
70  }
71  void setRange(bool isDate, bool isCustom, double from, double to);
72  void setRange(bool isDate, bool isCustom, prange_t range) {
73  setRange(isDate, isCustom, range.first, range.second); }
74  // </group>
75 
76  // Overrides PlotMSWidget::addRadioButtonsToGroup().
77  void addRadioButtonsToGroup(QButtonGroup* group) const;
78 
79 private:
80  // Whether last set range was custom or not.
81  bool isCustom_;
82 
83  // Last set range.
84  double from_, to_;
85 
86 private slots:
87  // Slot for when the set range changes.
88  void rangeChanged();
89  void timeFromChanged();
90  void timeToChanged();
91 };
92 
93 }
94 
95 #endif /* PLOTRANGEWIDGET_QO_H */
double to_
virtual void addRadioButtonsToGroup(QButtonGroup *group) const
Adds any radio buttons in the widget to the given button group.
double from_
Last set range.
Widget for selecting a plot axis range.
void timeFromChanged()
PlotRangeWidget(bool customOnTwoLines=false, QWidget *parent=NULL)
Constructor which takes an optional parent widget.
bool isCustom_
Whether last set range was custom or not.
void setRange(bool isDate, bool isCustom, double from, double to)
void timeToChanged()
void rangeChanged()
Slot for when the set range changes.
bool isDate() const
Gets/Sets whether or not the displayed range widgets are for dates or not.
bool isCustom() const
Gets whether the currently set date is custom or not.
~PlotRangeWidget()
Destructor.
void getRange(double &from, double &to)
std::pair< double, double > prange_t
Typedef for range, which is two doubles (min and max).
Definition: PlotOptions.h:41
void setIsDate(bool isDate=true)
prange_t getRange() const
Gets/Sets the currently set range.
A simple parent for editing widgets.
void setRange(bool isDate, bool isCustom, prange_t range)