casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtPlotWidget.qo.h
Go to the documentation of this file.
1 //# QtPlotWidget.qo.h: Classes for GUI editing of plot customization objects.
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 QTPLOTWIDGET_QO_H_
28 #define QTPLOTWIDGET_QO_H_
29 
30 #include <casaqt/QtUtilities/PlotColorWidget.ui.h>
31 #include <casaqt/QtUtilities/PlotFillWidget.ui.h>
32 #include <casaqt/QtUtilities/PlotLineWidget.ui.h>
33 #include <casaqt/QtUtilities/PlotSymbolWidget.ui.h>
34 #include <casaqt/QtUtilities/PlotFontWidget.ui.h>
35 
38 
39 namespace casa {
40 
41 // Parent for plot widgets.
42 class QtPlotWidget : public QtEditingWidget {
43  Q_OBJECT
44 
45 public:
46  // Constructor which takes a PlotFactory and an optional parent widget.
47  QtPlotWidget(PlotFactoryPtr factory, QWidget* parent = NULL);
48 
49  // Destructor.
50  virtual ~QtPlotWidget();
51 
52 protected:
53  // Factory.
55 };
56 
57 
58 // Widget for choosing a plot color.
59 class PlotColorWidget : public QtPlotWidget, Ui::ColorWidget {
60  Q_OBJECT
61 
62 public:
63  // Constructor which takes a PlotFactory, a flag for whether or not to show
64  // an alpha spinner, and an optional parent widget.
65  PlotColorWidget(PlotFactoryPtr factory, bool showAlpha = false,
66  QWidget* parent = NULL);
67 
68  // Destructor.
70 
71  // Gets/Sets the currently set color on the widget.
72  // <group>
73  PlotColorPtr getColor() const;
75  // </group>
76 
77  // Gets/Sets the currently set color on the widget as a String.
78  // <group>
80  void setColor(const casacore::String& color);
81  // </group>
82 
83 private:
84  // Last set color.
86 
87 private slots:
88  // Slot to show color chooser.
89  void colorChoose();
90 
91  // Slot for when the set color changes.
92  void colorChanged();
93 };
94 
95 
96 // Widget for choosing a plot area fill. Uses a PlotColorWidget for the color.
97 class PlotFillWidget : public QtPlotWidget, Ui::FillWidget {
98  Q_OBJECT
99 
100 public:
101  // Constructor which takes a PlotFactory, a flag for whether or not to show
102  // an alpha spinner in the color widget, and an optional parent widget.
103  PlotFillWidget(PlotFactoryPtr factory, bool showAlpha = false, casacore::String fillColor="blue",
104  QWidget* parent = NULL);
105 
106  // Destructor.
107  ~PlotFillWidget();
108 
109  // Gets/Sets the currently set area fill on the widget.
110  // <group>
111  PlotAreaFillPtr getFill() const;
112  void setFill(PlotAreaFillPtr fill);
113  // </group>
114 
115 private:
116  // Color widget.
118 
119  // Last set area fill.
121 
122 private slots:
123  // Slot for when the set area fill changes.
124  void fillChanged();
125 };
126 
127 
128 // Widget for choosing a plot line. Uses a PlotColorWidget for the line
129 // color.
130 class PlotLineWidget : public QtPlotWidget, Ui::LineWidget {
131  Q_OBJECT
132 
133 public:
134  // Constructor which takes a PlotFactory, a flag for whether to use the
135  // "compact" version of the widget, a flag for whether or not to show an
136  // alpha spinner in the color widget, and an optional parent widget.
137  PlotLineWidget(PlotFactoryPtr factory, bool useCompact = true,
138  bool showAlpha = false, QWidget* parent = NULL);
139 
140  // Destructor.
141  ~PlotLineWidget();
142 
143  // Gets/Sets the currently set line on the widget.
144  // <group>
145  PlotLinePtr getLine() const;
146  void setLine(PlotLinePtr line);
147  // </group>
148 
149 private:
150  // Color widget.
152 
153  // Last set line.
155 
156 
157  // Gets/Sets the line style from the combo box.
158  // <group>
159  PlotLine::Style lineStyle() const;
160  void setLineStyle(PlotLine::Style style);
161  // </group>
162 
163 private slots:
164  // Slot for when the set line changes.
165  void lineChanged();
166 };
167 
168 
169 // Widget for choosing a plot symbol. Uses a PlotFillWidget for the area fill
170 // and a PlotLineWidget for the outline. Lets the user choose between no
171 // symbol, a default symbol given at construction, or a custom symbol they can
172 // set.
173 class PlotSymbolWidget : public QtPlotWidget, Ui::SymbolWidget {
174  Q_OBJECT
175 
176 public:
177  // Constructor which takes a PlotFactory, the symbol associated with the
178  // "default" options, a flag for whether to show an alpha spinner for the
179  // area fill, a flag for whether to allow the user to set a custom outline,
180  // a flag for whether to show an alpha spinner for the custom outline, and
181  // an optional parent widget.
182  PlotSymbolWidget(PlotFactoryPtr factory, PlotSymbolPtr defaultSymbol,
183  bool showAlphaFill = false, bool showCustom = true,
184  bool showAlphaLine = false, bool showCharacter = true,
185  QWidget* parent = NULL);
186 
187  // Destructor.
189 
190  // Gets/Sets the currently set symbol on the widget.
191  // <group>
192  PlotSymbolPtr getSymbol() const;
193  void setSymbol(PlotSymbolPtr symbol);
194  // </group>
195 
196  // Overrides QtEditingWidget::addRadioButtonsToGroup().
197  void addRadioButtonsToGroup(QButtonGroup* group) const;
198 
199  // Sets the allowable minimum sizes for the given symbol types.
200  void setMinimumSizes(const std::map<PlotSymbol::Symbol, int>& minimumSizes);
201 
202 private:
203  // Area fill widget.
205 
206  // Line widget.
208 
209  // Default symbol.
211 
212  // Last set symbol.
214 
215  // Minimum allowable sizes.
216  std::map<PlotSymbol::Symbol, int> itsMinSizes_;
217 
218 private slots:
219  // Slot for when the set symbol changes. The "check" flag can be used to
220  // avoid emitting the changed signals twice (for example, when one radio
221  // button turns off when another turns on).
222  void symbolChanged(bool check = true);
223 };
224 
225 
226 // Widget for choosing a plot font. Uses a PlotColorWidget for the font color.
227 class PlotFontWidget : public QtPlotWidget, Ui::FontWidget {
228  Q_OBJECT
229 
230 public:
231  // Constructor which takes a PlotFactory, a flag for whether to show an
232  // alpha spinner for the color, and an optional parent widget.
233  PlotFontWidget(PlotFactoryPtr factory, bool showAlpha = false,
234  QWidget* parent = NULL);
235 
236  // Destructor.
237  ~PlotFontWidget();
238 
239  // Gets/Sets the currently set font on the widget.
240  // <group>
241  PlotFontPtr getFont() const;
242  void setFont(PlotFontPtr font);
243  // </group>
244 
245 private:
246  // Color widget.
248 
249  // Last set font.
251 
252 private slots:
253  // Slot for when the set font changes.
254  void fontChanged();
255 };
256 
257 }
258 
259 #endif /* QTPLOTWIDGET_QO_H_ */
PlotColorWidget * itsColorWidget_
Color widget.
~PlotColorWidget()
Destructor.
void setMinimumSizes(const std::map< PlotSymbol::Symbol, int > &minimumSizes)
Sets the allowable minimum sizes for the given symbol types.
~PlotFontWidget()
Destructor.
casacore::String getColorString() const
Gets/Sets the currently set color on the widget as a String.
PlotSymbolPtr getSymbol() const
Gets/Sets the currently set symbol on the widget.
PlotAreaFillPtr getFill() const
Gets/Sets the currently set area fill on the widget.
PlotLineWidget * itsLineWidget_
Line widget.
std::map< PlotSymbol::Symbol, int > itsMinSizes_
Minimum allowable sizes.
Widget for choosing a plot line.
Widget for choosing a plot area fill.
PlotLinePtr getLine() const
Gets/Sets the currently set line on the widget.
PlotFontWidget(PlotFactoryPtr factory, bool showAlpha=false, QWidget *parent=NULL)
Constructor which takes a PlotFactory, a flag for whether to show an alpha spinner for the color...
~PlotLineWidget()
Destructor.
PlotSymbolPtr itsDefault_
Default symbol.
void fontChanged()
Slot for when the set font changes.
PlotFillWidget * itsFillWidget_
Area fill widget.
QtPlotWidget(PlotFactoryPtr factory, QWidget *parent=NULL)
Constructor which takes a PlotFactory and an optional parent widget.
PlotColorWidget * itsColorWidget_
Color widget.
void fillChanged()
Slot for when the set area fill changes.
void symbolChanged(bool check=true)
Slot for when the set symbol changes.
void colorChanged()
Slot for when the set color changes.
PlotFactoryPtr itsFactory_
Factory.
PlotAreaFillPtr itsFill_
Last set area fill.
void setSymbol(PlotSymbolPtr symbol)
PlotFillWidget(PlotFactoryPtr factory, bool showAlpha=false, casacore::String fillColor="blue", QWidget *parent=NULL)
Constructor which takes a PlotFactory, a flag for whether or not to show an alpha spinner in the colo...
PlotColorPtr getColor() const
Gets/Sets the currently set color on the widget.
Style
Static //.
Definition: PlotOptions.h:373
PlotFontPtr getFont() const
Gets/Sets the currently set font on the widget.
void lineChanged()
Slot for when the set line changes.
PlotLine::Style lineStyle() const
Gets/Sets the line style from the combo box.
void setColor(PlotColorPtr color)
void addRadioButtonsToGroup(QButtonGroup *group) const
Overrides QtEditingWidget::addRadioButtonsToGroup().
PlotColorWidget * itsColorWidget_
Color widget.
PlotFontPtr itsFont_
Last set font.
~PlotSymbolWidget()
Destructor.
Parent for plot widgets.
PlotLinePtr itsLine_
Last set line.
void setLineStyle(PlotLine::Style style)
void colorChoose()
Slot to show color chooser.
PlotColorWidget(PlotFactoryPtr factory, bool showAlpha=false, QWidget *parent=NULL)
Constructor which takes a PlotFactory, a flag for whether or not to show an alpha spinner...
PlotLineWidget(PlotFactoryPtr factory, bool useCompact=true, bool showAlpha=false, QWidget *parent=NULL)
Constructor which takes a PlotFactory, a flag for whether to use the &quot;compact&quot; version of the widget...
virtual ~QtPlotWidget()
Destructor.
PlotSymbolWidget(PlotFactoryPtr factory, PlotSymbolPtr defaultSymbol, bool showAlphaFill=false, bool showCustom=true, bool showAlphaLine=false, bool showCharacter=true, QWidget *parent=NULL)
Constructor which takes a PlotFactory, the symbol associated with the &quot;default&quot; options, a flag for whether to show an alpha spinner for the area fill, a flag for whether to allow the user to set a custom outline, a flag for whether to show an alpha spinner for the custom outline, and an optional parent widget.
Widget for choosing a plot font.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void setFont(PlotFontPtr font)
A simple parent for editing widgets.
Widget for choosing a plot color.
void setFill(PlotAreaFillPtr fill)
PlotColorPtr itsColor_
Last set color.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
~PlotFillWidget()
Destructor.
Widget for choosing a plot symbol.
PlotSymbolPtr itsSymbol_
Last set symbol.
void setLine(PlotLinePtr line)