-rw-r--r-- | microkde/keditlistbox.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/microkde/keditlistbox.h b/microkde/keditlistbox.h index 130d933..e43d958 100644 --- a/microkde/keditlistbox.h +++ b/microkde/keditlistbox.h | |||
@@ -1,63 +1,65 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org> | 2 | Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef KEDITLISTBOX_H | 20 | #ifndef KEDITLISTBOX_H |
21 | #define KEDITLISTBOX_H | 21 | #define KEDITLISTBOX_H |
22 | 22 | ||
23 | #include <qgroupbox.h> | 23 | #include <q3groupbox.h> |
24 | #include <qlistbox.h> | 24 | #include <q3listbox.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3StrList> | ||
25 | 27 | ||
26 | class KLineEdit; | 28 | class KLineEdit; |
27 | class KComboBox; | 29 | class KComboBox; |
28 | class QPushButton; | 30 | class QPushButton; |
29 | 31 | ||
30 | class KEditListBoxPrivate; | 32 | class KEditListBoxPrivate; |
31 | /** | 33 | /** |
32 | * An editable listbox | 34 | * An editable listbox |
33 | * | 35 | * |
34 | * This class provides a editable listbox ;-), this means | 36 | * This class provides a editable listbox ;-), this means |
35 | * a listbox which is accompanied by a line edit to enter new | 37 | * a listbox which is accompanied by a line edit to enter new |
36 | * items into the listbox and pushbuttons to add and remove | 38 | * items into the listbox and pushbuttons to add and remove |
37 | * items from the listbox and two buttons to move items up and down. | 39 | * items from the listbox and two buttons to move items up and down. |
38 | */ | 40 | */ |
39 | class KEditListBox : public QGroupBox | 41 | class KEditListBox : public Q3GroupBox |
40 | { | 42 | { |
41 | Q_OBJECT | 43 | Q_OBJECT |
42 | 44 | ||
43 | public: | 45 | public: |
44 | /// @since 3.1 | 46 | /// @since 3.1 |
45 | class CustomEditor | 47 | class CustomEditor |
46 | { | 48 | { |
47 | public: | 49 | public: |
48 | CustomEditor() | 50 | CustomEditor() |
49 | : m_representationWidget( 0L ), | 51 | : m_representationWidget( 0L ), |
50 | m_lineEdit( 0L ) {} | 52 | m_lineEdit( 0L ) {} |
51 | CustomEditor( QWidget *repWidget, KLineEdit *edit ) | 53 | CustomEditor( QWidget *repWidget, KLineEdit *edit ) |
52 | : m_representationWidget( repWidget ), | 54 | : m_representationWidget( repWidget ), |
53 | m_lineEdit( edit ) {} | 55 | m_lineEdit( edit ) {} |
54 | CustomEditor( KComboBox *combo ); | 56 | CustomEditor( KComboBox *combo ); |
55 | 57 | ||
56 | void setRepresentationWidget( QWidget *repWidget ) { | 58 | void setRepresentationWidget( QWidget *repWidget ) { |
57 | m_representationWidget = repWidget; | 59 | m_representationWidget = repWidget; |
58 | } | 60 | } |
59 | void setLineEdit( KLineEdit *edit ) { | 61 | void setLineEdit( KLineEdit *edit ) { |
60 | m_lineEdit = edit; | 62 | m_lineEdit = edit; |
61 | } | 63 | } |
62 | 64 | ||
63 | virtual QWidget *representationWidget() const { | 65 | virtual QWidget *representationWidget() const { |
@@ -105,122 +107,122 @@ public: | |||
105 | int buttons = All ); | 107 | int buttons = All ); |
106 | 108 | ||
107 | /** | 109 | /** |
108 | * Another constructor, which allows to use a custom editing widget | 110 | * Another constructor, which allows to use a custom editing widget |
109 | * instead of the standard KLineEdit widget. E.g. you can use a | 111 | * instead of the standard KLineEdit widget. E.g. you can use a |
110 | * @ref KURLRequester or a @ref KComboBox as input widget. The custom | 112 | * @ref KURLRequester or a @ref KComboBox as input widget. The custom |
111 | * editor must consist of a lineedit and optionally another widget that | 113 | * editor must consist of a lineedit and optionally another widget that |
112 | * is used as representation. A KComboBox or a KURLRequester have a | 114 | * is used as representation. A KComboBox or a KURLRequester have a |
113 | * KLineEdit as child-widget for example, so the KComboBox is used as | 115 | * KLineEdit as child-widget for example, so the KComboBox is used as |
114 | * the representation widget. | 116 | * the representation widget. |
115 | * | 117 | * |
116 | * @see KURLRequester::customEditor() | 118 | * @see KURLRequester::customEditor() |
117 | * @since 3.1 | 119 | * @since 3.1 |
118 | */ | 120 | */ |
119 | KEditListBox( const QString& title, | 121 | KEditListBox( const QString& title, |
120 | const CustomEditor &customEditor, | 122 | const CustomEditor &customEditor, |
121 | QWidget *parent = 0, const char *name = 0, | 123 | QWidget *parent = 0, const char *name = 0, |
122 | bool checkAtEntering = false, int buttons = All ); | 124 | bool checkAtEntering = false, int buttons = All ); |
123 | 125 | ||
124 | virtual ~KEditListBox(); | 126 | virtual ~KEditListBox(); |
125 | 127 | ||
126 | /** | 128 | /** |
127 | * Return a pointer to the embedded QListBox. | 129 | * Return a pointer to the embedded QListBox. |
128 | */ | 130 | */ |
129 | QListBox* listBox() const { return m_listBox; } | 131 | Q3ListBox* listBox() const { return m_listBox; } |
130 | /** | 132 | /** |
131 | * Return a pointer to the embedded QLineEdit. | 133 | * Return a pointer to the embedded QLineEdit. |
132 | */ | 134 | */ |
133 | KLineEdit* lineEdit() const { return m_lineEdit; } | 135 | KLineEdit* lineEdit() const { return m_lineEdit; } |
134 | /** | 136 | /** |
135 | * Return a pointer to the Add button | 137 | * Return a pointer to the Add button |
136 | */ | 138 | */ |
137 | QPushButton* addButton() const { return servNewButton; } | 139 | QPushButton* addButton() const { return servNewButton; } |
138 | /** | 140 | /** |
139 | * Return a pointer to the Remove button | 141 | * Return a pointer to the Remove button |
140 | */ | 142 | */ |
141 | QPushButton* removeButton() const { return servRemoveButton; } | 143 | QPushButton* removeButton() const { return servRemoveButton; } |
142 | /** | 144 | /** |
143 | * Return a pointer to the Up button | 145 | * Return a pointer to the Up button |
144 | */ | 146 | */ |
145 | QPushButton* upButton() const { return servUpButton; } | 147 | QPushButton* upButton() const { return servUpButton; } |
146 | /** | 148 | /** |
147 | * Return a pointer to the Down button | 149 | * Return a pointer to the Down button |
148 | */ | 150 | */ |
149 | QPushButton* downButton() const { return servDownButton; } | 151 | QPushButton* downButton() const { return servDownButton; } |
150 | 152 | ||
151 | /** | 153 | /** |
152 | * See @ref QListBox::count() | 154 | * See @ref QListBox::count() |
153 | */ | 155 | */ |
154 | int count() const { return int(m_listBox->count()); } | 156 | int count() const { return int(m_listBox->count()); } |
155 | /** | 157 | /** |
156 | * See @ref QListBox::insertStringList() | 158 | * See @ref QListBox::insertStringList() |
157 | */ | 159 | */ |
158 | void insertStringList(const QStringList& list, int index=-1); | 160 | void insertStringList(const QStringList& list, int index=-1); |
159 | /** | 161 | /** |
160 | * See @ref QListBox::insertStringList() | 162 | * See @ref QListBox::insertStringList() |
161 | */ | 163 | */ |
162 | void insertStrList(const QStrList* list, int index=-1); | 164 | void insertStrList(const Q3StrList* list, int index=-1); |
163 | /** | 165 | /** |
164 | * See @ref QListBox::insertStrList() | 166 | * See @ref QListBox::insertStrList() |
165 | */ | 167 | */ |
166 | void insertStrList(const QStrList& list, int index=-1); | 168 | void insertStrList(const Q3StrList& list, int index=-1); |
167 | /** | 169 | /** |
168 | * See @ref QListBox::insertStrList() | 170 | * See @ref QListBox::insertStrList() |
169 | */ | 171 | */ |
170 | void insertStrList(const char ** list, int numStrings=-1, int index=-1); | 172 | void insertStrList(const char ** list, int numStrings=-1, int index=-1); |
171 | /** | 173 | /** |
172 | * See @ref QListBox::insertItem() | 174 | * See @ref QListBox::insertItem() |
173 | */ | 175 | */ |
174 | void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);} | 176 | void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);} |
175 | /** | 177 | /** |
176 | * Clears both the listbox and the line edit. | 178 | * Clears both the listbox and the line edit. |
177 | */ | 179 | */ |
178 | void clear(); | 180 | void clear(); |
179 | /** | 181 | /** |
180 | * See @ref QListBox::text() | 182 | * See @ref QListBox::text() |
181 | */ | 183 | */ |
182 | QString text(int index) const { return m_listBox->text(index); } | 184 | QString text(int index) const { return m_listBox->text(index); } |
183 | /** | 185 | /** |
184 | * See @ref QListBox::currentItem() | 186 | * See @ref QListBox::currentItem() |
185 | */ | 187 | */ |
186 | int currentItem() const; | 188 | int currentItem() const; |
187 | /** | 189 | /** |
188 | * See @ref QListBox::currentText() | 190 | * See @ref QListBox::currentText() |
189 | */ | 191 | */ |
190 | QString currentText() const { return m_listBox->currentText(); } | 192 | QString currentText() const { return m_listBox->currentText(); } |
191 | 193 | ||
192 | /** | 194 | /** |
193 | * @returns a stringlist of all items in the listbox | 195 | * @returns a stringlist of all items in the listbox |
194 | */ | 196 | */ |
195 | QStringList items() const; | 197 | QStringList items() const; |
196 | 198 | ||
197 | signals: | 199 | signals: |
198 | void changed(); | 200 | void changed(); |
199 | 201 | ||
200 | protected slots: | 202 | protected slots: |
201 | //the names should be self-explaining | 203 | //the names should be self-explaining |
202 | void moveItemUp(); | 204 | void moveItemUp(); |
203 | void moveItemDown(); | 205 | void moveItemDown(); |
204 | void addItem(); | 206 | void addItem(); |
205 | void removeItem(); | 207 | void removeItem(); |
206 | void enableMoveButtons(int index); | 208 | void enableMoveButtons(int index); |
207 | void typedSomething(const QString& text); | 209 | void typedSomething(const QString& text); |
208 | 210 | ||
209 | private: | 211 | private: |
210 | QListBox *m_listBox; | 212 | Q3ListBox *m_listBox; |
211 | QPushButton *servUpButton, *servDownButton; | 213 | QPushButton *servUpButton, *servDownButton; |
212 | QPushButton *servNewButton, *servRemoveButton; | 214 | QPushButton *servNewButton, *servRemoveButton; |
213 | KLineEdit *m_lineEdit; | 215 | KLineEdit *m_lineEdit; |
214 | 216 | ||
215 | //this is called in both ctors, to avoid code duplication | 217 | //this is called in both ctors, to avoid code duplication |
216 | void init( bool checkAtEntering, int buttons, | 218 | void init( bool checkAtEntering, int buttons, |
217 | QWidget *representationWidget = 0L ); | 219 | QWidget *representationWidget = 0L ); |
218 | 220 | ||
219 | protected: | 221 | protected: |
220 | virtual void virtual_hook( int id, void* data ); | 222 | virtual void virtual_hook( int id, void* data ); |
221 | private: | 223 | private: |
222 | //our lovely private d-pointer | 224 | //our lovely private d-pointer |
223 | KEditListBoxPrivate *d; | 225 | KEditListBoxPrivate *d; |
224 | }; | 226 | }; |
225 | 227 | ||
226 | #endif | 228 | #endif |