File indexing completed on 2024-12-22 04:18:19

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 STRINGSELECTOR_H
0014 #define STRINGSELECTOR_H
0015 
0016 #include <QWidget>
0017 #include "ui_stringselector.h"
0018 
0019 #include <string_kst.h>
0020 
0021 #include "kstwidgets_export.h"
0022 
0023 namespace Kst {
0024 
0025 class ObjectStore;
0026 
0027 class KSTWIDGETS_EXPORT StringSelector : public QWidget, public Ui::StringSelector {
0028   Q_OBJECT
0029   public:
0030     explicit StringSelector(QWidget *parent = 0, ObjectStore *store = 0);
0031     virtual ~StringSelector();
0032 
0033     void setObjectStore(ObjectStore *store);
0034 
0035     StringPtr selectedString() const;
0036     void setSelectedString(StringPtr selectedString);
0037 
0038     bool allowEmptySelection() const;
0039     void setAllowEmptySelection(bool allowEmptySelection);
0040 
0041     void fillStrings();
0042 
0043   Q_SIGNALS:
0044     void selectionChanged(const QString&);
0045 
0046   private Q_SLOTS:
0047     void newString();
0048     void editString();
0049     void emitSelectionChanged();
0050     void updateDescriptionTip();
0051 
0052   private:
0053     bool _allowEmptySelection;
0054 
0055     ObjectStore *_store;
0056 };
0057 
0058 }
0059 
0060 #endif
0061 
0062 // vim: ts=2 sw=2 et