input.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _INPUT_H
00015 #define _INPUT_H
00016
00017 #include <qcheckbox.h>
00018 #include <qdict.h>
00019
00020 class QComboBox;
00021 class QLabel;
00022 class QLineEdit;
00023 class QListBox;
00024 class QPushButton;
00025 class QSpinBox;
00026
00027 class IInput
00028 {
00029 public:
00030 virtual void init() = 0;
00031 virtual void setEnabled(bool) = 0;
00032 virtual QObject *qobject() = 0;
00033 };
00034
00035
00036 class InputBool : public QWidget, public IInput
00037 {
00038 Q_OBJECT
00039
00040 public:
00041 InputBool(const QCString &key, const QString &text, QWidget *parent, bool &flag);
00042 ~InputBool();
00043
00044 void init();
00045 virtual void setEnabled(bool b);
00046 virtual QObject *qobject() { return this; }
00047 virtual bool getState() const { return state; }
00048
00049 signals:
00050 void changed();
00051 void toggle(const QString &, bool);
00052
00053 private slots:
00054 void valueChanged(bool);
00055
00056 private:
00057 bool &state;
00058 QCString key;
00059 QCheckBox *cb;
00060 };
00061
00062
00063 class InputInt : public QWidget, public IInput
00064 {
00065 Q_OBJECT
00066
00067 public:
00068 InputInt(const QString &text, QWidget *parent,
00069 int &val, int minVal, int maxVal);
00070 ~InputInt();
00071
00072 void init();
00073 virtual void setEnabled(bool);
00074 QObject *qobject() { return this; }
00075
00076 signals:
00077 void changed();
00078
00079 private slots:
00080 void valueChanged(int val);
00081
00082 private:
00083 QLabel *lab;
00084 QSpinBox *sp;
00085 int &m_val;
00086 int m_minVal;
00087 int m_maxVal;
00088 };
00089
00090
00091 class InputString : public QWidget, public IInput
00092 {
00093 Q_OBJECT
00094
00095 public:
00096 enum StringMode { StringFree=0,
00097 StringFile=1,
00098 StringDir=2,
00099 StringFixed=3
00100 };
00101
00102 InputString(const QString &text, QWidget *parent,
00103 QCString &s, StringMode m=StringFree);
00104 ~InputString();
00105
00106 void init();
00107 void addValue(const char *s);
00108 void setEnabled(bool);
00109 QObject *qobject() { return this; }
00110
00111 signals:
00112 void changed();
00113
00114 private slots:
00115 void textChanged(const QString&);
00116 void browse();
00117 void clear();
00118
00119 private:
00120 QLabel *lab;
00121 QLineEdit *le;
00122 QPushButton *br;
00123 QComboBox *com;
00124 QCString &str;
00125 StringMode sm;
00126 QDict<int> *m_values;
00127 int m_index;
00128 };
00129
00130
00131 class InputStrList : public QWidget, public IInput
00132 {
00133 Q_OBJECT
00134
00135 public:
00136 enum ListMode { ListString=0,
00137 ListFile=1,
00138 ListDir=2,
00139 ListFileDir=ListFile|ListDir
00140 };
00141
00142 InputStrList(const QString &text, QWidget *parent,
00143 QStrList &sl, ListMode v=ListString);
00144 ~InputStrList();
00145
00146 void init();
00147 void setEnabled(bool);
00148 QObject *qobject() { return this; }
00149
00150 signals:
00151 void changed();
00152
00153 private slots:
00154 void addString();
00155 void delString();
00156 void updateString();
00157 void selectText(const QString &s);
00158 void browseFiles();
00159 void browseDir();
00160
00161 private:
00162 QLabel *lab;
00163 QLineEdit *le;
00164 QPushButton *add;
00165 QPushButton *del;
00166 QPushButton *upd;
00167 QPushButton *brFile;
00168 QPushButton *brDir;
00169 QListBox *lb;
00170 QStrList &strList;
00171 };
00172
00173 #endif
This file is part of the documentation for KDevelop Version 3.1.2.