File indexing completed on 2025-07-06 04:10:18

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 VECTORSELECTOR_H
0014 #define VECTORSELECTOR_H
0015 
0016 #include <QWidget>
0017 #include "ui_vectorselector.h"
0018 
0019 #include <vector.h>
0020 
0021 #include "kstwidgets_export.h"
0022 
0023 namespace Kst {
0024 
0025 class ObjectStore;
0026 
0027 class KSTWIDGETS_EXPORT VectorSelector : public QWidget, public Ui::VectorSelector {
0028   Q_OBJECT
0029   public:
0030     explicit VectorSelector(QWidget *parent = 0, ObjectStore *store = 0);
0031     virtual ~VectorSelector();
0032 
0033     void setObjectStore(ObjectStore *store);
0034 
0035     VectorPtr selectedVector() const;
0036     bool vectorSelected() const;
0037     bool selectedVectorDirty() const;
0038     void setSelectedVector(VectorPtr selectedVector);
0039 
0040     bool allowEmptySelection() const;
0041     void setAllowEmptySelection(bool allowEmptySelection);
0042 
0043     void clearSelection();
0044 
0045     void setToLastX(QString field = QString());
0046 
0047     void setIsX(bool is_x) {_isX = is_x;}
0048     int count() {return _vector->count();}
0049 
0050     virtual QSize   minimumSizeHint () const;
0051 
0052     int iconWidth() const;
0053 
0054 
0055   public Q_SLOTS:
0056     void fillVectors();
0057 
0058   Q_SIGNALS:
0059     void selectionChanged(const QString&);
0060     void contentChanged(); // something in the combo changed (new or edit)
0061 
0062   private Q_SLOTS:
0063     void newVector();
0064     void editVector();
0065     void emitSelectionChanged();
0066     void updateDescriptionTip();
0067 
0068   private:
0069     bool _allowEmptySelection;
0070     bool _isX;
0071 
0072     ObjectStore *_store;
0073 };
0074 
0075 }
0076 
0077 #endif
0078 
0079 // vim: ts=2 sw=2 et