File indexing completed on 2024-12-22 04:17:42
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2007 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 #ifndef PLOTITEMMANAGER_H 0014 #define PLOTITEMMANAGER_H 0015 0016 #include <QObject> 0017 0018 #include <QHash> 0019 #include <QList> 0020 0021 namespace Kst { 0022 0023 class View; 0024 class ViewItem; 0025 class PlotItem; 0026 class SharedAxisBoxItem; 0027 0028 class PlotItemManager : public QObject 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 static PlotItemManager *self(); 0034 0035 static QList<PlotItem*> plotsForView(View *view); 0036 static QList<ViewItem*> tieableItemsForView(View *view); 0037 static QList<ViewItem*> tieableItems(); 0038 0039 static void clearPlotsForView(View *view); 0040 0041 static QList<PlotItem*> tiedZoomPlotsForView(View *view); 0042 static QList<PlotItem*> tiedZoomPlotsForViewItem(ViewItem *viewItem); 0043 static QList<PlotItem*> tiedZoomPlots(PlotItem* plotItem); 0044 static QList<ViewItem*> tiedZoomViewItems(PlotItem* plotItem); 0045 0046 void toggleAllTiedZoom(View *view); 0047 void clearAllTiedZoom(View *view); 0048 0049 Q_SIGNALS: 0050 void tiedZoomRemoved(); 0051 void allPlotsTiedZoom(); 0052 0053 public Q_SLOTS: 0054 void clearFocusedPlots(); 0055 0056 private: 0057 static void cleanup(); 0058 0059 PlotItemManager(); 0060 virtual ~PlotItemManager(); 0061 0062 void addTiedZoomPlot(PlotItem *plotItem, bool checkAll = true); 0063 void addTiedZoomViewItem(ViewItem *viewItem, bool checkAll = true); 0064 void removeTiedZoomPlot(PlotItem *plotItem); 0065 void removeTiedZoomViewItem(ViewItem *viewItem); 0066 0067 void setFocusPlot(PlotItem *plotItem); 0068 void removeFocusPlot(PlotItem *plotItem); 0069 0070 void checkAllTied(View* view); 0071 0072 private: 0073 friend class ViewItem; 0074 friend class PlotItem; 0075 friend class SharedAxisBoxItem; 0076 QHash< View*, QList<PlotItem*> > _tiedZoomViewPlotLists; 0077 QHash< View*, QList<ViewItem*> > _tiedZoomViewItemLists; 0078 QHash< ViewItem*, QList<PlotItem*> > _tiedZoomViewItemPlotLists; 0079 }; 0080 0081 } 0082 0083 #endif 0084 0085 // vim: ts=2 sw=2 et