droptionview.h
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 00020 #ifndef DROPTIONVIEW_H 00021 #define DROPTIONVIEW_H 00022 00023 #include <qwidget.h> 00024 #include <qgroupbox.h> 00025 #include <qstringlist.h> 00026 00027 class QLineEdit; 00028 class QSlider; 00029 class QLabel; 00030 class KListBox; 00031 class QListBoxItem; 00032 class QVButtonGroup; 00033 class QWidgetStack; 00034 class QListViewItem; 00035 class DrBase; 00036 class DriverItem; 00037 00038 class OptionBaseView : public QWidget 00039 { 00040 Q_OBJECT 00041 public: 00042 OptionBaseView(QWidget *parent = 0, const char *name = 0); 00043 virtual void setOption(DrBase*); 00044 virtual void setValue(const QString&); 00045 00046 signals: 00047 void valueChanged(const QString&); 00048 00049 protected: 00050 bool blockSS; 00051 }; 00052 00053 class OptionNumericView : public OptionBaseView 00054 { 00055 Q_OBJECT 00056 public: 00057 OptionNumericView(QWidget *parent = 0, const char *name = 0); 00058 void setOption(DrBase *opt); 00059 void setValue(const QString& val); 00060 00061 protected slots: 00062 void slotSliderChanged(int); 00063 void slotEditChanged(const QString&); 00064 00065 private: 00066 QLineEdit *m_edit; 00067 QSlider *m_slider; 00068 QLabel *m_minval, *m_maxval; 00069 bool m_integer; 00070 }; 00071 00072 class OptionStringView : public OptionBaseView 00073 { 00074 public: 00075 OptionStringView(QWidget *parent = 0, const char *name = 0); 00076 void setOption(DrBase *opt); 00077 void setValue(const QString& val); 00078 00079 private: 00080 QLineEdit *m_edit; 00081 }; 00082 00083 class OptionListView : public OptionBaseView 00084 { 00085 Q_OBJECT 00086 public: 00087 OptionListView(QWidget *parent = 0, const char *name = 0); 00088 void setOption(DrBase *opt); 00089 void setValue(const QString& val); 00090 00091 protected slots: 00092 void slotSelectionChanged(); 00093 00094 private: 00095 KListBox *m_list; 00096 QStringList m_choices; 00097 }; 00098 00099 class OptionBooleanView : public OptionBaseView 00100 { 00101 Q_OBJECT 00102 public: 00103 OptionBooleanView(QWidget *parent = 0, const char *name = 0); 00104 void setOption(DrBase *opt); 00105 void setValue(const QString& val); 00106 00107 protected slots: 00108 void slotSelected(int); 00109 00110 private: 00111 QVButtonGroup *m_group; 00112 QStringList m_choices; 00113 }; 00114 00115 class DrOptionView : public QGroupBox 00116 { 00117 Q_OBJECT 00118 public: 00119 DrOptionView(QWidget *parent = 0, const char *name = 0); 00120 void setAllowFixed(bool on) { m_allowfixed = on; } 00121 00122 signals: 00123 void changed(); 00124 00125 public slots: 00126 void slotValueChanged(const QString&); 00127 void slotItemSelected(QListViewItem*); 00128 00129 private: 00130 QWidgetStack *m_stack; 00131 DriverItem *m_item; 00132 bool m_block; 00133 bool m_allowfixed; 00134 }; 00135 00136 #endif