File indexing completed on 2024-12-22 04:17:50

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 VIEWITEMDIALOG_H
0014 #define VIEWITEMDIALOG_H
0015 
0016 #include "dialog.h"
0017 #include "editmultiplewidget.h"
0018 
0019 #include <QPointer>
0020 #include <QLabel>
0021 
0022 #include "kst_export.h"
0023 
0024 namespace Kst {
0025 
0026 class ViewItem;
0027 class FillTab;
0028 class StrokeTab;
0029 class LayoutTab;
0030 class DimensionsTab;
0031 class EditMultipleWidget;
0032 
0033 class ViewItemDialog : public Dialog
0034 {
0035   Q_OBJECT
0036   public:
0037     friend class DialogSI;
0038     enum EditMode { Single, Multiple };
0039     explicit ViewItemDialog(ViewItem *item, QWidget *parent = 0);
0040     virtual ~ViewItemDialog();
0041 
0042     void setSupportsMultipleEdit(bool enabled);
0043 
0044     void setTagString(const QString& tagString) { _tagString->setText(tagString); }
0045     QString tagString() const { return _tagString->text(); }
0046 
0047     void addMultipleEditOption(QString name, QString descriptionTip, QString shortName);
0048     QList<ViewItem*> selectedMultipleEditObjects();
0049     void clearMultipleEditOptions();
0050 
0051     EditMode editMode() const { return _mode; }
0052 
0053     DimensionsTab *_dimensionsTab;
0054 
0055   public Q_SLOTS:
0056     void setSingleEdit();
0057     void setMultipleEdit();
0058     virtual void setupDimensions();
0059 
0060   Q_SIGNALS:
0061     void editMultipleMode();
0062     void editSingleMode();
0063 
0064   private Q_SLOTS:
0065     void fillChanged();
0066     void strokeChanged();
0067     void layoutChanged();
0068     void dimensionsChanged();
0069     void slotEditMultiple();
0070 
0071   protected:
0072     void setupFill();
0073     void setupStroke();
0074     void setupLayout();
0075     void setupChildViewOptions();
0076 
0077     void saveFill(ViewItem *item);
0078     void saveStroke(ViewItem *item);
0079     void saveLayout(ViewItem *item);
0080     virtual void saveDimensions(ViewItem *item);
0081 
0082   private:
0083 
0084     QMap <QString, QString> _multiNameShortName;
0085     QLabel *_tagStringLabel;
0086     QLineEdit *_tagString;
0087     EditMultipleWidget *_editMultipleWidget;
0088     QPushButton *_editMultipleButton;
0089     EditMode _mode;
0090     QWidget *_editMultipleBox;
0091     
0092   protected:
0093     QPointer<ViewItem> _item;
0094     FillTab *_fillTab;
0095     StrokeTab *_strokeTab;
0096     LayoutTab *_layoutTab;
0097 };
0098 
0099 }
0100 
0101 #endif
0102 
0103 // vim: ts=2 sw=2 et