casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PlotMSMultiAxesTab.qo.h
Go to the documentation of this file.
00001 //# PlotMSMultiAxesTab.qo.h: Plot tab for multi axes parameters.
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 PLOTMSMULTIAXESTAB_QO_H_
00028 #define PLOTMSMULTIAXESTAB_QO_H_
00029 
00030 #include <plotms/GuiTabs/PlotMSMultiAxesTab.ui.h>
00031 
00032 #include <plotms/GuiTabs/PlotMSPlotTab.qo.h>
00033 
00034 #include <casa/namespace.h>
00035 
00036 namespace casa {
00037 
00038 //# Forward declarations.
00039 class PlotMSAxisWidget;
00040 
00041 
00042 // Subclass of PlotMSPlotSubtab that manages multiple plot axes parameters.
00043 class PlotMSMultiAxesTab : public PlotMSPlotSubtab, Ui::MultiAxesTab {
00044     Q_OBJECT
00045     
00046 public:
00047     // Constructor which takes the parent tab and plotter.
00048     PlotMSMultiAxesTab(PlotMSPlotTab* plotTab, PlotMSPlotter* parent);
00049     
00050     // Destructor.
00051     ~PlotMSMultiAxesTab();
00052     
00053     
00054     // Implements PlotMSTab::tabName().
00055     QString tabName() const { return "Axes"; }
00056     
00057     // Implements PlotMSPlotSubtab::getValue().
00058     void getValue(PlotMSPlotParameters& params) const;
00059     
00060     // Implements PlotMSPlotSubtab::setValue().
00061     void setValue(const PlotMSPlotParameters& params);
00062     
00063     // Implements PlotMSPlotSubtab::update().
00064     void update(const PlotMSPlot& plot);
00065     
00066 private:
00067     // Class that manages the list of axes widgets.
00068     class MultiAxes {        
00069     public:
00070         // Constructor that takes parent.
00071         MultiAxes(PlotMSMultiAxesTab* parent);
00072         
00073         // Destructor.
00074         ~MultiAxes();
00075         
00076         
00077         // Sets up into the given widget.
00078         void setupUi(QWidget* widget);
00079         
00080         // Returns the size of the axes list.
00081         int size() const;
00082         
00083         // Returns the axis widget at the given index.
00084         // <group>
00085         PlotMSAxisWidget* axis(int index);
00086         const PlotMSAxisWidget* axis(int index) const;
00087         // </group>
00088         
00089         // Adds the given axis with the given canvas attach axes flag.
00090         // Connects the remove button to the given slot on the parent.
00091         void addAxis(PMS::Axis value, int attachAxes, const char* removeSlot);
00092         
00093         // Removes the axis at the given index.
00094         void removeAxis(int index);
00095         
00096         // Returns the index of the given button.
00097         int indexOfButton(QPushButton* button);
00098         
00099     private:
00100         // Parent.
00101         PlotMSMultiAxesTab* itsParent_;
00102         
00103         // Main layout.
00104         QVBoxLayout* itsLayout_;
00105         
00106         // Layouts, that hold the widget and close buttons.
00107         QList<QHBoxLayout*> itsLayouts_;
00108         
00109         // Axes widgets.
00110         QList<PlotMSAxisWidget*> itsAxisWidgets_;
00111         
00112         // Buttons.
00113         QList<QPushButton*> itsButtons_;
00114     };
00115     
00116     // X and Y axes lists.
00117     MultiAxes itsXAxes_, itsYAxes_;
00118     
00119     
00120 private slots:
00121     // Slots for adding new axes.
00122     // <group>
00123     void addX();
00124     void addY();
00125     // </group>
00126     
00127     // Slots for removing an axis.
00128     // <group>
00129     void removeX();
00130     void removeY();
00131     // </group>
00132 };
00133 
00134 }
00135 
00136 #endif /* PLOTMSMULTIAXESTAB_QO_H_ */