lib/compat/kdeveditlistbox.h
Go to the documentation of this file.00001
#ifndef _KDEVEDITLISTBOX_H_
00002
#define _KDEVEDITLISTBOX_H_
00003
00004
00005
#include <kdeversion.h>
00006
00007
#if KDE_VERSION <= 305
00008
00009
#include <qgroupbox.h>
00010
#include <qobjectlist.h>
00011
#include <qlistbox.h>
00012
#include <klineedit.h>
00013
#include <knotifyclient.h>
00014
#include <kcombobox.h>
00015
#include <assert.h>
00016
00017
class QPushButton;
00018
00019
namespace KDevCompat {
00020
00021 class KEditListBoxPrivate
00022 {
00023
public:
00024 bool m_checkAtEntering;
00025 int buttons;
00026 };
00027
00036 class KEditListBox :
public QGroupBox
00037 {
00038 Q_OBJECT
00039
00040
public:
00042 class CustomEditor
00043 {
00044
public:
00045 CustomEditor()
00046 :
m_representationWidget( 0L ),
00047
m_lineEdit( 0L ) {}
00048 CustomEditor(
QWidget *repWidget,
KLineEdit *edit )
00049 :
m_representationWidget( repWidget ),
00050
m_lineEdit( edit ) {}
00051
CustomEditor(
KComboBox *combo );
00052
00053 void setRepresentationWidget(
QWidget *repWidget ) {
00054
m_representationWidget = repWidget;
00055 }
00056 void setLineEdit(
KLineEdit *edit ) {
00057
m_lineEdit = edit;
00058 }
00059
00060 virtual QWidget *
representationWidget()
const {
00061
return m_representationWidget;
00062 }
00063 virtual KLineEdit *
lineEdit()
const {
00064
return m_lineEdit;
00065 }
00066
00067
protected:
00068 QWidget *
m_representationWidget;
00069 KLineEdit *
m_lineEdit;
00070 };
00071
00072
public:
00073
00078 enum Button {
Add = 1,
Remove = 2,
UpDown = 4,
All =
Add|Remove|UpDown };
00079
00092
KEditListBox(
QWidget *parent = 0,
const char *name = 0,
00093
bool checkAtEntering=
false,
int buttons = All );
00100
KEditListBox(
const QString& title,
QWidget *parent = 0,
00101
const char *name = 0,
bool checkAtEntering=
false,
00102
int buttons = All );
00103
00116
KEditListBox(
const QString& title,
00117
const CustomEditor &customEditor,
00118
QWidget *parent = 0,
const char *name = 0,
00119
bool checkAtEntering =
false,
int buttons = All );
00120
00121
virtual ~KEditListBox();
00122
00126 QListBox*
listBox()
const {
return m_listBox; }
00130 KLineEdit*
lineEdit()
const {
return m_lineEdit; }
00134 QPushButton*
addButton()
const {
return servNewButton; }
00138 QPushButton*
removeButton()
const {
return servRemoveButton; }
00142 QPushButton*
upButton()
const {
return servUpButton; }
00146 QPushButton*
downButton()
const {
return servDownButton; }
00147
00151 int count()
const {
return int(
m_listBox->count()); }
00155
void insertStringList(
const QStringList& list,
int index=-1);
00159
void insertStrList(
const QStrList* list,
int index=-1);
00163
void insertStrList(
const QStrList& list,
int index=-1);
00167
void insertStrList(
const char ** list,
int numStrings=-1,
int index=-1);
00171 void insertItem(
const QString& text,
int index=-1) {
m_listBox->insertItem(
text,index);}
00175
void clear();
00179 QString text(
int index)
const {
return m_listBox->text(index); }
00183
int currentItem() const;
00187 QString currentText()
const {
return m_listBox->currentText(); }
00188
00192
QStringList items() const;
00193
00194 signals:
00195
void changed();
00196
00197 protected slots:
00198
00199
void moveItemUp();
00200
void moveItemDown();
00201
void addItem();
00202
void removeItem();
00203
void enableMoveButtons(
int index);
00204
void typedSomething(const
QString& text);
00205
00206 private:
00207 QListBox *m_listBox;
00208 QPushButton *servUpButton, *servDownButton;
00209 QPushButton *servNewButton, *servRemoveButton;
00210 KLineEdit *m_lineEdit;
00211
00212
00213
void init(
bool checkAtEntering,
int buttons,
00214
QWidget *representationWidget = 0L );
00215
00216 protected:
00217 virtual
void virtual_hook(
int id,
void* data );
00218 private:
00219
00220 KEditListBoxPrivate *d;
00221 };
00222
00223 };
00224
00225 #endif
00226
00227 #endif
00228
This file is part of the documentation for KDevelop Version 3.0.4.