QtPlotWidget.qo.h

Go to the documentation of this file.
00001 //# QtPlotWidget.qo.h: Classes for GUI editing of plot customization objects.
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 QTPLOTWIDGET_QO_H_
00028 #define QTPLOTWIDGET_QO_H_
00029 
00030 #include <casaqt/QtUtilities/PlotColorWidget.ui.h>
00031 #include <casaqt/QtUtilities/PlotFillWidget.ui.h>
00032 #include <casaqt/QtUtilities/PlotLineWidget.ui.h>
00033 #include <casaqt/QtUtilities/PlotSymbolWidget.ui.h>
00034 #include <casaqt/QtUtilities/PlotFontWidget.ui.h>
00035 
00036 #include <casaqt/QtUtilities/QtEditingWidget.qo.h>
00037 #include <graphics/GenericPlotter/PlotFactory.h>
00038 
00039 namespace casa {
00040 
00041 // Parent for plot widgets.
00042 class QtPlotWidget : public QtEditingWidget {
00043     Q_OBJECT
00044     
00045 public:
00046     // Constructor which takes a PlotFactory and an optional parent widget.
00047     QtPlotWidget(PlotFactoryPtr factory, QWidget* parent = NULL);
00048     
00049     // Destructor.
00050     virtual ~QtPlotWidget();
00051     
00052 protected:
00053     // Factory.
00054     PlotFactoryPtr itsFactory_;
00055 };
00056 
00057 
00058 // Widget for choosing a plot color.
00059 class PlotColorWidget : public QtPlotWidget, Ui::ColorWidget {
00060     Q_OBJECT
00061     
00062 public:
00063     // Constructor which takes a PlotFactory, a flag for whether or not to show
00064     // an alpha spinner, and an optional parent widget.
00065     PlotColorWidget(PlotFactoryPtr factory, bool showAlpha = false,
00066             QWidget* parent = NULL);
00067     
00068     // Destructor.
00069     ~PlotColorWidget();    
00070     
00071     // Gets/Sets the currently set color on the widget.
00072     // <group>
00073     PlotColorPtr getColor() const;
00074     void setColor(PlotColorPtr color);
00075     // </group>
00076     
00077     // Gets/Sets the currently set color on the widget as a String.
00078     // <group>
00079     String getColorString() const;
00080     void setColor(const String& color);
00081     // </group>
00082     
00083 private:
00084     // Last set color.
00085     PlotColorPtr itsColor_;
00086     
00087 private slots:
00088     // Slot to show color chooser.
00089     void colorChoose();
00090     
00091     // Slot for when the set color changes.
00092     void colorChanged();
00093 };
00094 
00095 
00096 // Widget for choosing a plot area fill.  Uses a PlotColorWidget for the color.
00097 class PlotFillWidget : public QtPlotWidget, Ui::FillWidget {
00098     Q_OBJECT
00099     
00100 public:
00101     // Constructor which takes a PlotFactory, a flag for whether or not to show
00102     // an alpha spinner in the color widget, and an optional parent widget.
00103     PlotFillWidget(PlotFactoryPtr factory, bool showAlpha = false, String fillColor="blue",
00104             QWidget* parent = NULL);
00105     
00106     // Destructor.
00107     ~PlotFillWidget();
00108     
00109     // Gets/Sets the currently set area fill on the widget.
00110     // <group>
00111     PlotAreaFillPtr getFill() const;
00112     void setFill(PlotAreaFillPtr fill);
00113     // </group>
00114     
00115 private:
00116     // Color widget.
00117     PlotColorWidget* itsColorWidget_;
00118     
00119     // Last set area fill.
00120     PlotAreaFillPtr itsFill_;
00121     
00122 private slots:
00123     // Slot for when the set area fill changes.
00124     void fillChanged();
00125 };
00126 
00127 
00128 // Widget for choosing a plot line.  Uses a PlotColorWidget for the line
00129 // color.
00130 class PlotLineWidget : public QtPlotWidget, Ui::LineWidget {
00131     Q_OBJECT
00132     
00133 public:
00134     // Constructor which takes a PlotFactory, a flag for whether to use the
00135     // "compact" version of the widget, a flag for whether or not to show an
00136     // alpha spinner in the color widget, and an optional parent widget.
00137     PlotLineWidget(PlotFactoryPtr factory, bool useCompact = true,
00138             bool showAlpha = false, QWidget* parent = NULL);
00139     
00140     // Destructor.
00141     ~PlotLineWidget();    
00142     
00143     // Gets/Sets the currently set line on the widget.
00144     // <group>
00145     PlotLinePtr getLine() const;
00146     void setLine(PlotLinePtr line);
00147     // </group>
00148     
00149 private:
00150     // Color widget.
00151     PlotColorWidget* itsColorWidget_;
00152     
00153     // Last set line.
00154     PlotLinePtr itsLine_;
00155     
00156     
00157     // Gets/Sets the line style from the combo box.
00158     // <group>
00159     PlotLine::Style lineStyle() const;
00160     void setLineStyle(PlotLine::Style style);
00161     // </group>
00162     
00163 private slots:
00164     // Slot for when the set line changes.
00165     void lineChanged();
00166 };
00167 
00168 
00169 // Widget for choosing a plot symbol.  Uses a PlotFillWidget for the area fill
00170 // and a PlotLineWidget for the outline.  Lets the user choose between no
00171 // symbol, a default symbol given at construction, or a custom symbol they can
00172 // set.
00173 class PlotSymbolWidget : public QtPlotWidget, Ui::SymbolWidget {
00174     Q_OBJECT
00175     
00176 public:
00177     // Constructor which takes a PlotFactory, the symbol associated with the
00178     // "default" options, a flag for whether to show an alpha spinner for the
00179     // area fill, a flag for whether to allow the user to set a custom outline,
00180     // a flag for whether to show an alpha spinner for the custom outline, and
00181     // an optional parent widget.
00182     PlotSymbolWidget(PlotFactoryPtr factory, PlotSymbolPtr defaultSymbol,
00183             bool showAlphaFill = false, bool showCustom = true,
00184             bool showAlphaLine = false, bool showCharacter = true,
00185             QWidget* parent = NULL);
00186     
00187     // Destructor.
00188     ~PlotSymbolWidget();
00189     
00190     // Gets/Sets the currently set symbol on the widget.
00191     // <group>
00192     PlotSymbolPtr getSymbol() const;
00193     void setSymbol(PlotSymbolPtr symbol);
00194     // </group>
00195     
00196     // Overrides QtEditingWidget::addRadioButtonsToGroup().
00197     void addRadioButtonsToGroup(QButtonGroup* group) const;
00198     
00199     // Sets the allowable minimum sizes for the given symbol types.
00200     void setMinimumSizes(const std::map<PlotSymbol::Symbol, int>& minimumSizes);
00201     
00202 private:
00203     // Area fill widget.
00204     PlotFillWidget* itsFillWidget_;
00205     
00206     // Line widget.
00207     PlotLineWidget* itsLineWidget_;
00208     
00209     // Default symbol.
00210     PlotSymbolPtr itsDefault_;
00211     
00212     // Last set symbol.
00213     PlotSymbolPtr itsSymbol_;
00214     
00215     // Minimum allowable sizes.
00216     std::map<PlotSymbol::Symbol, int> itsMinSizes_;
00217     
00218 private slots:
00219     // Slot for when the set symbol changes.  The "check" flag can be used to
00220     // avoid emitting the changed signals twice (for example, when one radio
00221     // button turns off when another turns on).
00222     void symbolChanged(bool check = true);
00223 };
00224 
00225 
00226 // Widget for choosing a plot font.  Uses a PlotColorWidget for the font color.
00227 class PlotFontWidget : public QtPlotWidget, Ui::FontWidget {
00228     Q_OBJECT
00229     
00230 public:
00231     // Constructor which takes a PlotFactory, a flag for whether to show an
00232     // alpha spinner for the color, and an optional parent widget.
00233     PlotFontWidget(PlotFactoryPtr factory, bool showAlpha = false,
00234             QWidget* parent = NULL);
00235     
00236     // Destructor.
00237     ~PlotFontWidget();
00238     
00239     // Gets/Sets the currently set font on the widget.
00240     // <group>
00241     PlotFontPtr getFont() const;
00242     void setFont(PlotFontPtr font);
00243     // </group>
00244     
00245 private:
00246     // Color widget.
00247     PlotColorWidget* itsColorWidget_;
00248     
00249     // Last set font.
00250     PlotFontPtr itsFont_;
00251     
00252 private slots:
00253     // Slot for when the set font changes.
00254     void fontChanged();
00255 };
00256 
00257 }
00258 
00259 #endif /* QTPLOTWIDGET_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