summaryrefslogtreecommitdiffstats
path: root/kregexpeditor/KMultiFormListBox
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /kregexpeditor/KMultiFormListBox
downloadtdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz
tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kregexpeditor/KMultiFormListBox')
-rw-r--r--kregexpeditor/KMultiFormListBox/Makefile.am15
-rw-r--r--kregexpeditor/KMultiFormListBox/TODO1
-rw-r--r--kregexpeditor/KMultiFormListBox/ccp.cpp83
-rw-r--r--kregexpeditor/KMultiFormListBox/ccp.h61
-rw-r--r--kregexpeditor/KMultiFormListBox/idx.xbm5
-rw-r--r--kregexpeditor/KMultiFormListBox/indexWindow.cpp97
-rw-r--r--kregexpeditor/KMultiFormListBox/indexWindow.h83
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.cpp305
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.h135
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox-shower.h53
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.cpp213
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.h83
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox.cpp104
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistbox.h125
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.cpp44
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.h73
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.cpp26
-rw-r--r--kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.h70
-rw-r--r--kregexpeditor/KMultiFormListBox/widgetwindow.cpp117
-rw-r--r--kregexpeditor/KMultiFormListBox/widgetwindow.h60
-rw-r--r--kregexpeditor/KMultiFormListBox/windowlistboxitem.cpp45
-rw-r--r--kregexpeditor/KMultiFormListBox/windowlistboxitem.h44
22 files changed, 1842 insertions, 0 deletions
diff --git a/kregexpeditor/KMultiFormListBox/Makefile.am b/kregexpeditor/KMultiFormListBox/Makefile.am
new file mode 100644
index 0000000..5ee885f
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/Makefile.am
@@ -0,0 +1,15 @@
+AM_CPPFLAGS = -DQT_NO_CAST_ASCII
+noinst_LTLIBRARIES = libkmultiformlistbox.la
+
+INCLUDES= -I$(srcdir)/../KWidgetStreamer $(all_includes)
+
+include_HEADERS = kmultiformlistboxentry.h kmultiformlistbox.h \
+ kmultiformlistboxfactory.h
+noinst_HEADERS = ccp.h indexWindow.h kmultiformlistbox-multivisible.h \
+ kmultiformlistbox-windowed.h widgetwindow.h windowlistboxitem.h
+libkmultiformlistbox_la_SOURCES = ccp.cpp kmultiformlistboxentry.cpp \
+ kmultiformlistbox.cpp kmultiformlistbox-multivisible.cpp \
+ kmultiformlistboxfactory.cpp indexWindow.cpp \
+ kmultiformlistbox-windowed.cpp widgetwindow.cpp windowlistboxitem.cpp
+
+METASOURCES = AUTO
diff --git a/kregexpeditor/KMultiFormListBox/TODO b/kregexpeditor/KMultiFormListBox/TODO
new file mode 100644
index 0000000..0c20864
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/TODO
@@ -0,0 +1 @@
+- cut/copy/paste should place/read data from the system clipboard.
diff --git a/kregexpeditor/KMultiFormListBox/ccp.cpp b/kregexpeditor/KMultiFormListBox/ccp.cpp
new file mode 100644
index 0000000..d64a3b2
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/ccp.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+//---------------------
+// ccp = Cut-Copy-Paste
+//---------------------
+
+#include "kmultiformlistbox-multivisible.h"
+#include "ccp.h"
+#include <qobjectlist.h>
+#include <qpopupmenu.h>
+#ifdef QT_ONLY
+ #include "compat.h"
+#else
+ #include <klocale.h>
+#endif
+
+CCP::CCP(KMultiFormListBoxMultiVisible *ee_, KMultiFormListBoxEntry *eee_) : QObject() {
+ ee = ee_;
+ eee = eee_;
+ install(eee);
+}
+
+void CCP::install(QObject *elm)
+{
+ elm->installEventFilter(this);
+ const QObjectList *children = elm->children();
+ if (children) {
+ QObjectListIt it = QObjectListIt(*children);
+
+ while (QObject *child=it.current()) {
+ if (child->inherits("KMultiFormListBoxMultiVisible")) {
+ // Stop if the widget is an KMultiFormListBox, as this widget has its own cut/copy/paste
+ }
+ else {
+ install(child);
+ }
+ ++it;
+ }
+ }
+}
+
+// This function post the Cut/Copy/Paste menu
+bool CCP::eventFilter(QObject *, QEvent *event)
+{
+ if (event->type() != QEvent::MouseButtonPress ||
+ ((QMouseEvent *) event)->button() != RightButton ||
+ ((QMouseEvent *) event)->state() != QEvent::ControlButton) {
+ return false;
+ }
+
+ QPoint pos = ((QMouseEvent *) event)->globalPos();
+
+ QPopupMenu *menu = new QPopupMenu();
+ menu->insertItem(i18n("Cut"),1);
+ menu->insertItem(i18n("Copy"),2);
+ menu->insertItem(i18n("Paste"),3);
+ menu->insertItem(i18n("Insert Blank"),4);
+
+ int res=menu->exec(pos);
+ switch (res) {
+ case 1: ee->cut(eee); break;
+ case 2: ee->copy(eee); break;
+ case 3: ee->paste(eee); break;
+ case 4: ee->addElement(eee); break;
+ }
+ return true;
+}
+
diff --git a/kregexpeditor/KMultiFormListBox/ccp.h b/kregexpeditor/KMultiFormListBox/ccp.h
new file mode 100644
index 0000000..41857a5
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/ccp.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __ccp
+#define __ccp
+
+
+/**
+ Helper class for @ref KMultiFormListBoxMultiVisible which is used to install EventFilters.
+
+ When the user presses CTRL + right mouse button then a menu should
+ appear which offers him cut and paste capabilities for the entries in
+ the KMultiFormListBoxMultiVisible.
+
+ To obtain this an event filter must be install for each subwidget of the
+ KMultiFormListBoxMultiVisible. This event filter must catch the right mouse press event and
+ post the menu. This requires a widget which has the method @ref
+ eventFilter defined. We have this helper class exactly for this purpose.
+
+ For each @ref KMultiFormListBoxEntry in the @ref KMultiFormListBoxMultiVisible widget an instance of
+ this class is associated.
+
+ CCP stand for Cut Copy and Paste
+
+ @internal
+**/
+class CCP :public QObject {
+
+private:
+ friend class KMultiFormListBoxMultiVisible;
+ /**
+ * Constructor is private so only the class @ref KMultiFormListBoxMultiVisible may create an
+ * instance of this widget.
+ **/
+ CCP(KMultiFormListBoxMultiVisible *,KMultiFormListBoxEntry *);
+
+ void install(QObject *);
+ bool eventFilter(QObject *, QEvent *);
+
+ // Instance variables.
+
+ KMultiFormListBoxMultiVisible *ee;
+ KMultiFormListBoxEntry *eee;
+};
+
+#endif /* ccp */
+
diff --git a/kregexpeditor/KMultiFormListBox/idx.xbm b/kregexpeditor/KMultiFormListBox/idx.xbm
new file mode 100644
index 0000000..e51baee
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/idx.xbm
@@ -0,0 +1,5 @@
+#define idx_width 16
+#define idx_height 12
+static char idx_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x04, 0x02, 0x04, 0x02, 0xc4, 0x8a,
+ 0x24, 0x53, 0x14, 0x22, 0x14, 0x22, 0x24, 0x53, 0xce, 0x8a, 0x00, 0x00};
diff --git a/kregexpeditor/KMultiFormListBox/indexWindow.cpp b/kregexpeditor/KMultiFormListBox/indexWindow.cpp
new file mode 100644
index 0000000..362d012
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/indexWindow.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifdef QT_ONLY
+ #include "compat.h"
+#else
+ #include "indexWindow.moc"
+#endif
+
+#include "indexWindow.h"
+#include <iostream>
+#include <qlayout.h>
+
+indexWindow::indexWindow() : QWidget(0,"", WStyle_Customize | WType_Popup)
+{
+ lb = new QListBox(this);
+ connect(lb,SIGNAL(selected(int)), this, SLOT(lbSelected(int)));
+ QHBoxLayout *lay = new QHBoxLayout(this);
+ lay->addWidget(lb);
+ lbFinish = false;
+}
+
+void indexWindow::lbSelected(int index)
+{
+ lbFinish = true;
+ hide();
+ lbFinish = false;
+ finish(index);
+}
+
+void indexWindow::finish(int index)
+{
+ itemSelected = index;
+ qApp->exit_loop();
+}
+
+
+void indexWindow::insertItem(QString txt)
+{
+ lb->insertItem(txt);
+}
+
+void indexWindow::hideEvent(QHideEvent *h)
+{
+ QWidget::hideEvent(h);
+ if (!lbFinish)
+ finish(-1);
+}
+
+
+int indexWindow::exec(const QPoint & /*start*/, int /*width*/)
+{
+ // This code is not xinerama safe, on the other hand this part of the widget
+ // is not used in KRegExpEditor. This is part of a widget which has
+ // never been completed, but which is used partly by KRegExpEditor.
+ // 23 Feb. 2003 11:28 -- Jesper K. Pedersen
+/*
+ // calculate the height of all the elements together.
+ // I need to do it this way, as sizeHint doesn't report the correct size
+ // and itemHeight doesn't neither.
+ int elm_h = lb->item(0)->height(lb) * lb->count();
+ elm_h += 2*lb->frameWidth();
+
+ QWidget *desktop = QApplication::desktop();
+ int desktop_h = desktop->height();
+ int rest_h = desktop_h - start.y();
+ int below_h = QMAX(rest_h, 200);
+
+ int start_y = start.y();
+
+ if (rest_h < 200 && elm_h > 200) {
+ start_y = desktop_h-QMIN(elm_h,200);
+ }
+
+ setGeometry(start.x(), start_y, width, QMIN(elm_h, below_h));
+ show();
+ qApp->enter_loop();
+ return itemSelected;
+*/
+ return 0;
+}
+
diff --git a/kregexpeditor/KMultiFormListBox/indexWindow.h b/kregexpeditor/KMultiFormListBox/indexWindow.h
new file mode 100644
index 0000000..3597960
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/indexWindow.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __indexWindow
+#define __indexWindow
+
+#include <qlistbox.h>
+
+/**
+ Post a toplevel listbox synchronously.
+
+ When the user presses the Idx button in the @ref KMultiFormListBox, then a
+ listbox with the elements from the KMultiFormListBox must be shown. From this
+ listbox the user should chose the element he wants to scroll to.
+ This widget takes care of posting this listbox, and ensuring that the
+ user can not do anything else before he has chosen an element.
+
+ This widget resembles the behavior of @ref QPopupMenu, the difference
+ is, however, that the QPopupMenu can not handle that the elements in the
+ menu exceed the size of the screen. This widget can.
+
+ In the future this widget may be replaced with the QPopupMenu if the
+ QPopupMenu can handle this situation. But for now - it works!
+
+ @internal
+**/
+class indexWindow : public QWidget{
+
+Q_OBJECT
+
+public:
+ indexWindow();
+
+ /**
+ This method inserts an element into the listbox which is shown when
+ the @ref exec method is invoked.
+ **/
+ void insertItem(QString txt);
+
+ /**
+ This function shows the index window with the elements inserted using
+ the @ref insertItem function. The function will not return before the
+ user has chosen an element in the listbox, or have pressed the right
+ mouse button outside the window. As a result of returning from this
+ function, the listbox is hidden.
+
+ @param start The upper left corner of the pop-up window.
+ @param width The width of the window
+ @return The index of the element chosen, or -1 if no element has been
+ chosen.
+ **/
+ int exec(const QPoint &start, int width);
+
+protected:
+ void finish(int retVal);
+ virtual void hideEvent(QHideEvent *h);
+
+protected slots:
+ void lbSelected(int);
+
+private:
+ QListBox *lb;
+ bool lbFinish;
+ int itemSelected;
+
+};
+
+#endif /* indexWindow */
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.cpp b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.cpp
new file mode 100644
index 0000000..335863b
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.cpp
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifdef QT_ONLY
+ #include "compat.h"
+ #include <qmessagebox.h>
+#else
+ #include <kmessagebox.h>
+ #include "kmultiformlistbox-multivisible.moc"
+#endif
+
+#include "kmultiformlistbox-multivisible.h"
+#include "indexWindow.h"
+#include "ccp.h"
+
+#include <qbitmap.h>
+
+const int indexButtonWidth = 16;
+const int indexButtonHeight = 12;
+const uchar indexButtonBits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x04, 0x02, 0x04, 0x02, 0xc4, 0x8a,
+ 0x24, 0x53, 0x14, 0x22, 0x14, 0x22, 0x24, 0x53, 0xce, 0x8a, 0x00, 0x00
+};
+
+
+KMultiFormListBoxMultiVisible::KMultiFormListBoxMultiVisible(KMultiFormListBoxFactory *fact, QWidget *parent, const char *name)
+ : QScrollView(parent, name)
+{
+ factory = fact;
+
+ // Initialize the element list
+ elms = new WidgetList();
+
+ // Initialize the clipper.
+ enableClipper(true);
+ resizeContents(50,50); // This is required for proper functionality
+}
+
+
+
+//----------------------------------------------------------------------
+// This function returns a list of the elements in the KMultiFormListBox widget.
+//----------------------------------------------------------------------
+KMultiFormListBoxEntryList KMultiFormListBoxMultiVisible::elements()
+{
+ KMultiFormListBoxEntryList res;
+ for (QWidget *child = elms->first(); child; child=elms->next()) {
+ if (strcmp(child->name(),"seperator") != 0) {
+ res.append((KMultiFormListBoxEntry *) child);
+ }
+ }
+ return res;
+}
+
+
+//----------------------------------------------------------------------
+// This function is called whenever the KMultiFormListBox widget is resized. It is
+// necessary to ensure that the content of the clipper is resized.
+//----------------------------------------------------------------------
+void KMultiFormListBoxMultiVisible::resizeEvent(QResizeEvent *e)
+{
+ // The call of the super class ensures that the outer border is updated.
+ QScrollView::resizeEvent(e);
+
+ updateClipperContent();
+}
+
+void KMultiFormListBoxMultiVisible::updateClipperContent()
+{
+ // Extract the current size of the clipper
+ int ClipperWidth = clipper()->size().width();
+ int ClipperHeight = clipper()->size().height();
+
+ // Initialize the calculation of the size of the new clipper.
+ int totalHeight = 0;
+ int maxWidth = ClipperWidth;
+ int count = 0;
+
+
+ // calculate the required size.
+ for (QWidget *child = elms->first(); child; child=elms->next()) {
+ maxWidth = QMAX(maxWidth, child->sizeHint().width());
+ if (strcmp(child->name(), "seperator") != 0) {
+ totalHeight += child->sizeHint().height();
+ count++;
+ }
+ else {
+ totalHeight += child->size().height();
+ }
+ }
+
+ // Calculate the extra height for the elements.
+ int extra = 0;
+ if (totalHeight < ClipperHeight && count != 0) {
+ extra = (ClipperHeight - totalHeight) / count;
+ totalHeight = ClipperHeight;
+ }
+
+ // Now place the elements in the clipper.
+ int yPos = 0;
+ for (QWidget *child2 = elms->first(); child2; child2=elms->next()) {
+ int h;
+ if ( strcmp(child2->name(),"seperator") != 0) {
+ h = child2->sizeHint().height();
+ h += extra;
+ }
+ else {
+ h = child2->size().height();
+ }
+
+ moveChild(child2, 0,yPos);
+
+ child2->resize(maxWidth,h);
+ yPos += h;
+ }
+
+ // Finally call the resize procedure for the clipper to ensure that the
+ // new sizes is shown properly.
+ resizeContents(maxWidth, totalHeight);
+}
+
+
+void KMultiFormListBoxMultiVisible::addElement()
+{
+ addElement(0);
+}
+
+void KMultiFormListBoxMultiVisible::addElement(KMultiFormListBoxEntry *after)
+{
+ KMultiFormListBoxEntry *elm = factory->create(viewport());
+ insertElmIntoWidget(elm, after);
+}
+
+void KMultiFormListBoxMultiVisible::append(KMultiFormListBoxEntry *elm)
+{
+ elm->reparent(viewport(), 0, QPoint(0,0), false);
+ insertElmIntoWidget(elm, 0);
+}
+
+void KMultiFormListBoxMultiVisible::delElement(QWidget *elm)
+{
+ int index = elms->find(elm);
+ QWidget *next = elms->at(index+1);
+ if (strcmp(next->name(),"seperator") != 0) {
+ elms->removeRef(next);
+ removeChild(next);
+ }
+
+ elms->removeRef(elm);
+ removeChild(elm);
+
+ updateClipperContent();
+}
+
+void KMultiFormListBoxMultiVisible::delAnElement()
+{
+ delElement(elms->at(0));
+}
+
+void KMultiFormListBoxMultiVisible::insertElmIntoWidget(KMultiFormListBoxEntry *elm, KMultiFormListBoxEntry *after)
+{
+ // Bind the index button if it exists.
+ if (elm->indexButton()) {
+ elm->indexButton()->setPixmap(QBitmap(indexButtonWidth, indexButtonHeight,
+ indexButtonBits, true));
+ connect(elm->indexButton(), SIGNAL(clicked()), elm, SLOT(acceptIndexButton()));
+ connect(elm, SIGNAL(gotoIndex(KMultiFormListBoxEntry *)),
+ this, SLOT(showIndexList(KMultiFormListBoxEntry *)));
+ }
+
+ // Find the location to insert the new element.
+ int index = elms->count();
+ if (after) {
+ index = elms->findRef(after);
+ }
+
+ // Now show the new element.
+ elms->insert(index, elm);
+ elm->show();
+ addChild(elm,0,0); // updateClipperContent will place the child correctly.
+
+ QWidget *sep = factory->separator(viewport());
+ if (sep != 0) {
+ sep->setName("seperator");
+ sep->show();
+ addChild(sep,0,0); // updateClipperContent will place the child correctly.
+ elms->insert(index+1, sep);
+ }
+
+ updateClipperContent();
+
+ showWidget(elm); // scroll to show the new widget.
+
+ // install cut'n'paste functionallity
+ new CCP(this,elm);
+}
+
+
+//----------------------------------------------------------------------
+// This function shows the list of available Idx elements.
+//----------------------------------------------------------------------
+void KMultiFormListBoxMultiVisible::showIndexList(KMultiFormListBoxEntry *elm)
+{
+ indexWindow *menu = new indexWindow();
+
+ // Insert the elements into the menu item.
+ for (QWidget *child = elms->first(); child; child=elms->next()) {
+ if ( strcmp(child->name(), "seperator") != 0) {
+ QString txt = ((KMultiFormListBoxEntry *) child)->idxString();
+ menu->insertItem(txt);
+ }
+ }
+
+ // Calculate the location of the window
+ QPoint start;
+ int width;
+ elm->indexWindowPos(&start, &width);
+
+ // Show the window.
+ int index = menu->exec(start,width);
+
+ if (index != -1) {
+ for (QWidget *child = elms->first(); child; child=elms->next()) {
+ if ( strcmp(child->name(), "seperator") != 0) {
+
+ if (index == 0) {
+ showWidget((KMultiFormListBoxEntry *) child);
+ break;
+ }
+ index--;
+ }
+ }
+ }
+ delete menu;
+}
+
+//----------------------------------------------------------------------
+// Scroll to the loaction of the given KMultiFormListBoxEntry element.
+//----------------------------------------------------------------------
+void KMultiFormListBoxMultiVisible::showWidget(KMultiFormListBoxEntry *elm)
+{
+ setContentsPos(childX(elm), childY(elm));
+}
+
+
+void KMultiFormListBoxMultiVisible::cut(KMultiFormListBoxEntry *elm)
+{
+ if (countElements(elms) == 1) {
+ KMessageBox::information(this, i18n("Due to a bug, it is not possible to remove the last element."), i18n("Internal Error") );
+ return;
+ }
+
+ QDataStream stream(clipboard, IO_WriteOnly);
+ factory->toStream( elm, stream );
+ delElement(elm);
+}
+
+void KMultiFormListBoxMultiVisible::copy(KMultiFormListBoxEntry *elm)
+{
+ QDataStream stream(clipboard, IO_WriteOnly);
+ factory->toStream(elm, stream);
+}
+
+void KMultiFormListBoxMultiVisible::paste(KMultiFormListBoxEntry *oldElm)
+{
+ if (clipboard.size() == 0) {
+ KMessageBox::information(this, i18n("There is no element on the clipboard to paste in."));
+ return;
+ }
+
+ KMultiFormListBoxEntry *newElm = factory->create(viewport());
+ QDataStream stream( clipboard, IO_ReadOnly );
+ factory->fromStream(stream, newElm);
+ insertElmIntoWidget(newElm,oldElm);
+}
+
+
+int KMultiFormListBoxMultiVisible::countElements(WidgetList *elms)
+{
+ int count = 0;
+
+ for (QWidget *child = elms->first(); child; child=elms->next()) {
+ if (dynamic_cast<const KMultiFormListBoxEntry *>(child))
+ count++;
+ }
+
+ return count;
+}
+
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.h b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.h
new file mode 100644
index 0000000..87aeba4
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-multivisible.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+// ------------------------------- Description ----------------------------
+// This is the KMultiFormListBox Widget. You do not need to inheret from this class,
+// your interface to it will be through the methods `append` and `elements'.
+//
+// To make an instance of the widget, you need to inherit the classes
+// `KMultiFormListBoxFactory' and `KMultiFormListBoxEntry'.
+// ------------------------------------------------------------------------
+#ifndef __kmultiformlistboxmultivisble
+#define __kmultiformlistboxmultivisble
+
+// -------------------------------- includes ------------------------------
+#include "kmultiformlistbox.h"
+//-------------------------------------------------------------------------
+
+/**
+ @internal
+*/
+class KMultiFormListBoxMultiVisible :public QScrollView, KMultiFormListBoxShower {
+
+Q_OBJECT
+
+friend class KMultiFormListBox;
+
+private:
+ /**
+ @param factory A factory used to generate the instances of KMultiFormListBoxEntry
+ class which is repeated in the KMultiFormListBox
+ @param parent A pointer to the parent widget
+ */
+ KMultiFormListBoxMultiVisible(KMultiFormListBoxFactory *factory, QWidget *parent = 0, const char *name = 0);
+
+ /**
+ @return The elements in the KMultiFormListBox
+ */
+ KMultiFormListBoxEntryList elements();
+ void append(KMultiFormListBoxEntry *);
+
+ QWidget* qWidget() { return this; }
+
+
+public slots:
+
+ /**
+ This slot should be connected to a button which lets the user know that
+ he may get more elements in this KMultiFormListBox by pressing it.
+ The button should be labeled ``More Entries'' or something similar.
+ */
+ void addElement(); // Adds an empty element to the KMultiFormListBox
+
+
+protected slots:
+
+ /**
+ When this slot is invoked then the Idx menu will be shown.
+ @param elm The KMultiFormListBoxEntry element where the Idx button was
+ pressed. This information is necessary to be able to calculate the
+ location where the drop down menu should be shown
+ */
+ void showIndexList(KMultiFormListBoxEntry *elm);
+
+protected:
+ /**
+ Copies the element pointed to by which to the clipboard and removes it
+ from the interface.
+ This function is accessed from the class @ref CCP.
+ @param which A pointer to the element to cut.
+ */
+ void cut(KMultiFormListBoxEntry *which);
+
+ /**
+ Copies the element pointed to by which to the clipboard.
+ This function is accessed from the class @ref CCP.
+ @param which A pointer to the element to copied.
+ */
+ void copy(KMultiFormListBoxEntry *which);
+
+ /**
+ Paste the element from the clipboard to the KMultiFormListBox
+ This function is accessed from the class @ref CCP.
+ @param which A pointer to the KMultiFormListBoxEntry element which the
+ clipboard element should be inserted before,.
+ */
+ void paste(KMultiFormListBoxEntry *which);
+
+ /**
+ Inserts an empty KMultiFormListBoxEntry into the widget.
+ @param which A pointer to the element which the new empty widget
+ should be inserted before.
+ */
+
+ void addElement(KMultiFormListBoxEntry *);
+
+ friend class CCP;
+
+ virtual void resizeEvent(QResizeEvent *);
+ void addElemBefore(KMultiFormListBoxEntry *newElm, QWidget *existing);
+ void insertElmIntoWidget(KMultiFormListBoxEntry *elm, KMultiFormListBoxEntry *after);
+ void showWidget(KMultiFormListBoxEntry *elm);
+ void delElement(QWidget *);
+ void delAnElement();
+ void addElemBefore(KMultiFormListBoxEntry *newElm, KMultiFormListBoxEntry *existing);
+ void updateClipperContent();
+ int countElements(WidgetList *);
+
+
+
+private:
+ // Instance variables
+
+ KMultiFormListBoxFactory *factory;
+ WidgetList *elms;
+ QPushButton *addBut;
+ QByteArray clipboard;
+};
+
+
+#endif /* kmultiformlistboxmultivisble */
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox-shower.h b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-shower.h
new file mode 100644
index 0000000..fe786d7
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-shower.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __kmultiformlistboxshower
+#define __kmultiformlistboxshower
+
+// -------------------------------- includes ------------------------------
+//-------------------------------------------------------------------------
+typedef QPtrList<KMultiFormListBoxEntry> KMultiFormListBoxEntryList ;
+
+/**
+ Abstract class defining the interface for widgets showing a number of @ref KMultiFormListBoxEntry.
+
+ @internal
+*/
+class KMultiFormListBoxShower {
+
+public:
+ virtual KMultiFormListBoxEntryList elements() = 0;
+
+ /** Appends the given argument to the list */
+ virtual void append(KMultiFormListBoxEntry *) = 0;
+
+ /** Return the element as a QWidget */
+ virtual QWidget* qWidget() = 0;
+
+ /** Adds an empty element. */
+ virtual void addElement() = 0;
+
+ /** Deletes an element at the given index. */
+ virtual void delElement(QWidget *) = 0;
+
+ /** Deletes any element from the list */
+ virtual void delAnElement() = 0;
+};
+
+
+#endif /* kmultiformlistboxshower */
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.cpp b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.cpp
new file mode 100644
index 0000000..6ef14d3
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.cpp
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifdef QT_ONLY
+ #include "compat.h"
+#else
+ #include <kmessagebox.h>
+ #include <kpushbutton.h>
+ #include <kstdguiitem.h>
+ #include "kmultiformlistbox-windowed.moc"
+#endif
+
+#include "widgetwindow.h"
+#include "windowlistboxitem.h"
+
+KMultiFormListBoxWindowed::KMultiFormListBoxWindowed(KMultiFormListBoxFactory *factory, QWidget *parent,
+ bool showUpDownButtons, bool showHelpButton,
+ QString addButtonText,const char *name)
+ : QWidget( parent, name )
+{
+ _layout = new QVBoxLayout(this);
+
+ QHBoxLayout *innerLayout = new QHBoxLayout();
+ _layout->addLayout(innerLayout);
+
+ _listbox = new KListBox(this,"listbox");
+ _listbox->setSelectionMode(QListBox::Single);
+ innerLayout->addWidget(_listbox);
+
+ QVBoxLayout *buttons = new QVBoxLayout();
+ innerLayout->addLayout(buttons);
+
+ QPushButton *but = new QPushButton(addButtonText, this,"Add Button");
+ buttons->addWidget(but,0);
+ connect(but, SIGNAL(clicked()), this, SLOT(addNewElement()));
+
+ but = new QPushButton(i18n("Edit"), this,"Edit Button");
+ buttons->addWidget(but,0);
+ connect(but,SIGNAL(clicked()), this, SLOT(slotEditSelected()));
+ connect(_listbox, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(slotEditSelected(QListBoxItem *)));
+ _buttonList.append(but);
+
+ but = new QPushButton(i18n("Delete"), this, "Delete Button");
+ buttons->addWidget(but,0);
+ connect(but, SIGNAL(clicked()), this, SLOT(slotDeleteEntry()));
+ _buttonList.append(but);
+
+ but = new QPushButton(i18n("Copy"), this, "Copy Button");
+ buttons->addWidget(but,0);
+ connect(but, SIGNAL(clicked()), this, SLOT(slotCopySelected()));
+ _buttonList.append(but);
+
+ if (showUpDownButtons) {
+ but = new QPushButton(i18n("Up"), this, "Up Button");
+ buttons->addWidget(but, 0);
+ connect(but, SIGNAL(clicked()), this, SLOT(slotMoveItemUp()));
+ _buttonList.append(but);
+
+ but = new QPushButton(i18n("Down"), this, "Down Button");
+ buttons->addWidget(but, 0);
+ connect(but, SIGNAL(clicked()), this, SLOT(slotMoveItemDown()));
+ _buttonList.append(but);
+ }
+
+ if (showHelpButton) {
+ but = new KPushButton(KStdGuiItem::help(), this, "Help Button");
+ buttons->addWidget(but, 0);
+ connect(but, SIGNAL(clicked()), this, SIGNAL(showHelp()));
+ }
+
+ buttons->addStretch(1);
+ _factory = factory;
+ slotUpdateButtonState();
+
+}
+
+KMultiFormListBoxEntryList KMultiFormListBoxWindowed::elements()
+{
+ KMultiFormListBoxEntryList list;
+ for (unsigned int i=0; i < _listbox->count(); i++) {
+ WindowListboxItem *item = (WindowListboxItem *) _listbox->item(i);
+ list.append(item->entry());
+ }
+ return list;
+}
+
+void KMultiFormListBoxWindowed::delElement(QWidget */*elm*/)
+{
+ // kdDebug() << "KMultiFormListBoxWindowed::delElement NOT YET IMPLEMENTED"<<endl;
+ // TODO
+}
+
+void KMultiFormListBoxWindowed::delAnElement()
+{
+ // kdDebug() << "KMultiFormListBoxWindowed::delAnElement NOT YET IMPLEMENTED"<<endl;
+ // TODO
+}
+
+
+void KMultiFormListBoxWindowed::append(KMultiFormListBoxEntry *elm)
+{
+ (void) new WidgetWindow(_factory, elm, _listbox);
+ slotUpdateButtonState();
+}
+
+void KMultiFormListBoxWindowed::addNewElement()
+{
+ // kdDebug() << "addNewElement " << _factory << "," << _listbox << endl;
+
+ QWidget *widget = new WidgetWindow(_factory, _listbox);
+ widget->show();
+ connect(widget, SIGNAL(finished()), this, SLOT(slotUpdateButtonState()));
+}
+
+void KMultiFormListBoxWindowed::addElement()
+{
+ new WidgetWindow(_factory, _listbox);
+ slotUpdateButtonState();
+}
+
+void KMultiFormListBoxWindowed::slotEditSelected(QListBoxItem *item)
+{
+ ((WindowListboxItem *) item)->displayWidget();
+}
+
+void KMultiFormListBoxWindowed::slotEditSelected()
+{
+ WindowListboxItem *item = selected();
+ if (item) {
+ slotEditSelected(item);
+ }
+}
+
+void KMultiFormListBoxWindowed::slotDeleteEntry()
+{
+ WindowListboxItem *item = selected();
+ if (item) {
+ int answer =
+ KMessageBox::warningContinueCancel(0, i18n("Delete item \"%1\"?").arg(item->text()),i18n("Delete Item"),KStdGuiItem::del());
+ if (answer == KMessageBox::Continue) {
+ delete item;
+ slotUpdateButtonState();
+ }
+ }
+}
+
+void KMultiFormListBoxWindowed::slotCopySelected()
+{
+ WindowListboxItem *item = selected();
+ if (item) {
+ item->clone();
+ }
+}
+
+WindowListboxItem *KMultiFormListBoxWindowed::selected()
+{
+ int i = _listbox->currentItem();
+ if (i == -1) {
+ return 0;
+ } else {
+ return (WindowListboxItem *) _listbox->item(i);
+ }
+}
+
+void KMultiFormListBoxWindowed::slotMoveItemUp()
+{
+ WindowListboxItem *item = selected();
+ if (item == 0)
+ return;
+
+ int index = _listbox->index(item);
+ if (index != 0) {
+ _listbox->takeItem(item);
+ _listbox->insertItem(item, index-1);
+ _listbox->setCurrentItem(item);
+ }
+}
+
+void KMultiFormListBoxWindowed::slotMoveItemDown()
+{
+ WindowListboxItem *item = selected();
+ if (item == 0)
+ return;
+
+ unsigned int index = _listbox->index(item);
+ if (index < _listbox->count()) {
+ _listbox->takeItem(item);
+ _listbox->insertItem(item, index+1);
+ _listbox->setCurrentItem(item);
+ }
+}
+
+void KMultiFormListBoxWindowed::slotUpdateButtonState()
+{
+ bool on = (_listbox->count() != 0);
+ for (unsigned int i=0; i<_buttonList.count(); i++) {
+ _buttonList.at(i)->setEnabled(on);
+ }
+}
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.h b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.h
new file mode 100644
index 0000000..74d6d9f
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox-windowed.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __kmultiformlistboxwindowed
+#define __kmultiformlistboxwindowed
+
+#ifdef QT_ONLY
+ #include "compat.h"
+ #include <qlistbox.h>
+#else
+ #include <klistbox.h>
+#endif
+
+#include "kmultiformlistboxfactory.h"
+#include "kmultiformlistbox.h"
+class WindowListboxItem;
+
+
+/**
+ This class implements the windowed look for a @ref KMultiFormListBox
+
+ @internal
+*/
+class KMultiFormListBoxWindowed :public QWidget, KMultiFormListBoxShower {
+
+Q_OBJECT
+
+friend class KMultiFormListBox;
+
+private:
+ KMultiFormListBoxWindowed(KMultiFormListBoxFactory *factory, QWidget *parent,
+ bool showUpDownButtons, bool showHelpButton, QString addButtonText,
+ const char *name);
+
+ KMultiFormListBoxEntryList elements();
+ const KMultiFormListBoxEntryList elements() const;
+ void append(KMultiFormListBoxEntry *);
+ WindowListboxItem *selected();
+ QWidget* qWidget() { return this; }
+
+ QVBoxLayout* _layout;
+ KMultiFormListBoxFactory* _factory;
+ QPtrList<QPushButton> _buttonList;
+ KListBox* _listbox;
+ virtual void delElement(QWidget *); // Deletes the given element
+ virtual void delAnElement();
+ void addElement();
+
+
+public slots:
+ void addNewElement();
+
+signals:
+ void showHelp();
+
+private slots:
+ void slotEditSelected();
+ void slotEditSelected(QListBoxItem *item);
+ void slotCopySelected();
+ void slotMoveItemUp();
+ void slotMoveItemDown();
+ void slotDeleteEntry();
+ void slotUpdateButtonState();
+
+};
+
+
+#endif /* kmultiformlistboxwindowed */
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox.cpp b/kregexpeditor/KMultiFormListBox/kmultiformlistbox.cpp
new file mode 100644
index 0000000..57b5abb
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef QT_ONLY
+ #include "kmultiformlistbox.moc"
+#endif
+
+#include "kmultiformlistbox-multivisible.h"
+#include "kmultiformlistbox-windowed.h"
+
+KMultiFormListBox::KMultiFormListBox( KMultiFormListBoxFactory *factory, KMultiFormListBoxType tp, QWidget *parent,
+ bool showUpDownButtons, bool showHelpButton, QString addButtonText,
+ const char *name ) : QWidget( parent, name )
+{
+ switch ( tp ) {
+
+ case MultiVisible:
+ theWidget = new KMultiFormListBoxMultiVisible( factory, this, "KMultiFormListBox Widget" );
+ break;
+
+ case Windowed:
+ theWidget = new KMultiFormListBoxWindowed( factory, this, showUpDownButtons,
+ showHelpButton, addButtonText, "KMultiFormListBox Widget" );
+ break;
+ }
+
+ QWidget *widget = theWidget->qWidget();
+
+ QHBoxLayout *layout = new QHBoxLayout( this );
+ _factory = factory;
+ layout->addWidget( widget );
+}
+
+void KMultiFormListBox::append( KMultiFormListBoxEntry *element )
+{
+ theWidget->append( element );
+}
+
+void KMultiFormListBox::addElement()
+{
+ theWidget->addElement();
+}
+
+KMultiFormListBoxEntryList KMultiFormListBox::elements()
+{
+ return theWidget->elements();
+}
+
+const KMultiFormListBoxEntryList KMultiFormListBox::elements() const
+{
+ return const_cast<KMultiFormListBox*>(this)->elements();
+}
+
+void KMultiFormListBox::slotChangeFace( KMultiFormListBoxType /*newFace*/ )
+{
+ // TODO
+ // kdDebug() << "It's not possible yet to change the face on the fly." << endl
+ // << "Please let me (blackie@kde.org) know that you need it, and I'll work on it" << endl;
+}
+
+void KMultiFormListBox::toStream( QDataStream& stream ) const
+{
+ const KMultiFormListBoxEntryList elms = elements();
+ stream << elms.count();
+ for ( QPtrListIterator<KMultiFormListBoxEntry> it(elms); *it; ++it)
+ _factory->toStream( *it, stream );
+}
+
+void KMultiFormListBox::fromStream( QDataStream& stream )
+{
+ unsigned int fromCount, toCount;
+ stream >> fromCount;
+
+ toCount = elements().count();
+
+ // adds/remove elements in the to list, to make it have the correct length.
+ for (unsigned int j=toCount; j< fromCount; ++j) {
+ addElement();
+ }
+ for (unsigned int k=fromCount; k < toCount; ++k) {
+ theWidget->delAnElement();
+ }
+
+ KMultiFormListBoxEntryList elms = elements();
+ for (QPtrListIterator<KMultiFormListBoxEntry> it(elms); *it; ++it)
+ _factory->fromStream( stream, *it );
+}
+
+
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistbox.h b/kregexpeditor/KMultiFormListBox/kmultiformlistbox.h
new file mode 100644
index 0000000..8e85808
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistbox.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __kmultiformlistbox
+#define __kmultiformlistbox
+
+#include "kmultiformlistboxfactory.h"
+#include "kmultiformlistbox-shower.h"
+#include "kmultiformlistboxentry.h"
+#include <qptrlist.h>
+#include <qlayout.h>
+#include <qscrollview.h>
+
+#ifdef QT_ONLY
+ #include "compat.h"
+#else
+ #include <klocale.h>
+#endif
+
+class QDataStream;
+
+
+typedef QPtrList<KMultiFormListBoxEntry> KMultiFormListBoxEntryList ;
+typedef QPtrList<QWidget> WidgetList;
+class KMultiFormListBoxMultiVisible;
+
+/**
+ The main class used to get an KMultiFormListBox widget.
+
+ The KMultiFormListBox widget consist of a sub-widget which is repeated a
+ number of times, it is up to the end user to determine the number of times
+ the sub widget is repeated, and he may require an additional copy simply
+ by pressing a ``Add'' or ``More Entries'' button. The KMultiFormListBox
+ widget has two different faces (i.e. two different end user
+ interfaces). One (Windowed) will show a listbox from which the end user
+ can access each subwidget containing data by pressing the LMB on a name
+ for the element. The other face (MultiVisible) shows all the subwidgets in
+ one huge ``Listbox''.
+
+ To use the KMultiFormListBox widget you must create a class which is inherited
+ from the @ref KMultiFormListBoxFactory class. This new class must override the
+ function `create'. This function must return a freshly made instance of
+ the class @ref KMultiFormListBoxEntry (or a subclass of this). The KMultiFormListBoxEntry
+ instance is the one inserted into the KMultiFormListBox widget (one instance for
+ each sub widget in the KMultiFormListBox widget).
+
+ @author Jesper Kjær Pedersen <blackie@kde.org>
+ **/
+class KMultiFormListBox : public QWidget {
+
+Q_OBJECT
+
+public:
+
+ enum KMultiFormListBoxType {MultiVisible, Windowed};
+
+ /**
+ @param factory A factory used to generate the instances of
+ KMultiFormListBoxEntry class which is repeated in the KMultiFormListBox
+ @param parent A pointer to the parent widget
+ **/
+ KMultiFormListBox(KMultiFormListBoxFactory *factory,
+ KMultiFormListBoxType tp=Windowed,
+ QWidget *parent = 0, bool showUpDownButtons = true,
+ bool showHelpButton = true, QString addButtonText = i18n("Add"),
+ const char *name = 0);
+
+ /**
+ @return The elements in the KMultiFormListBox.
+ **/
+ KMultiFormListBoxEntryList elements();
+ const KMultiFormListBoxEntryList elements() const;
+
+ /**
+ TODO.
+ **/
+ void append(KMultiFormListBoxEntry *);
+
+ /** write data out to stream */
+ void toStream( QDataStream& stream ) const;
+
+ /** reads data in from stream */
+ void fromStream( QDataStream& stream );
+
+public slots:
+
+ /**
+ Adds an empty element to the KMultiFormListBox.
+
+ This slot is only required for the @ref MultiVisible face. It should
+ be connected to a button which lets the user know that he may get more
+ elements in this KMultiFormListBox by pressing it. The button should
+ be labeled ``More Entries'' or something similar.
+ **/
+ void addElement(); // Adds an empty element to the KMultiFormListBox
+
+ /**
+ Changes the face of the KMultiFormListBox.
+ @param face The new face of the KMultiFormListBox
+ **/
+ void slotChangeFace(KMultiFormListBoxType newFace);
+
+private:
+ KMultiFormListBoxShower *theWidget;
+ KMultiFormListBoxFactory *_factory;
+
+};
+
+
+#endif /* kmultiformlistbox */
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.cpp b/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.cpp
new file mode 100644
index 0000000..e6768a3
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef QT_ONLY
+ #include "kmultiformlistboxentry.moc"
+#endif
+
+#include "kmultiformlistboxentry.h"
+//----------------------------------------------------------------------
+// This function is needed to signal which of the KMultiFormListBox entries
+// the Idx button was invoked from.
+//----------------------------------------------------------------------
+void KMultiFormListBoxEntry::acceptIndexButton()
+{
+ emit gotoIndex(this);
+}
+
+
+void KMultiFormListBoxEntry::indexWindowPos(QPoint *start, int *width)
+{
+ // Calculate the position of the value widgets left-buttom border
+ QPoint global_point = valueWidget()->mapToGlobal(QPoint(0,0));
+ start->setX(global_point.x());
+ start->setY(global_point.y() + valueWidget()->height());
+
+ // Calculate the width of the list.
+ global_point = indexButton()->mapToGlobal(QPoint(0,0));
+ *width = global_point.x() + indexButton()->width() - start->x();
+}
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.h b/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.h
new file mode 100644
index 0000000..7937fe1
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __kmultiformlistboxentry
+#define __kmultiformlistboxentry
+
+#include <qpoint.h>
+#include <qwidget.h>
+#include <qpushbutton.h>
+
+/**
+ This widget must be the base class for an entry widget used in the @ref
+ KMultiFormListBox class. It is necessary for you to inherit this class to get any
+ information attached to the elements in the KMultiFormListBox.
+
+ The KMultiFormListBox widget features a fast scrolling mechanism through the Idx
+ button. If you want to use this in you KMultiFormListBox, then you must do the
+ following:
+ @li Create a @ref QPushButton as a sub-widget to your KMultiFormListBoxEntry.
+ @li Override the @ref indexButton method to return your QPushButton
+ @li Override the @ref idxString to return a @ref QString
+ with a textual representation of the content in this KMultiFormListBoxEntry. This
+ string will be used in the drop-down box which the user gets when he
+ presses the Idx button.
+ @li The drop down window must be aligned horizontal to some widget
+ (which should be next to the Idx button, to ensure a good looking GUI. The
+ position of the drop down widget may be specified in two ways: (1)
+ override the @ref valueWidget method to return a widget, to align with
+ (that is the upper right corner of the drop down window will be the
+ same as the lower right corner of this widget) or (2) override the @ref
+ indexWindowPos method to return a start point for the drop down window and
+ a width.
+ **/
+class KMultiFormListBoxEntry : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KMultiFormListBoxEntry(QWidget *parent, const char *name) : QWidget(parent,name) {}
+
+ virtual QPushButton *indexButton() { return 0; }
+ virtual QWidget *valueWidget() { return 0; }
+
+ virtual void indexWindowPos(QPoint *start, int *width); // both variables are return values.
+
+ // This function must return a string representing the KMultiFormListBox. This is
+ // used when showing the fast-search menu available from the `Idx' button.
+ virtual QString idxString() { return QString::fromLatin1(""); }
+
+public slots:
+ void acceptIndexButton();
+
+signals:
+ void gotoIndex(KMultiFormListBoxEntry *);
+
+};
+
+#endif /* kmultiformlistboxentry */
+
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.cpp b/kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.cpp
new file mode 100644
index 0000000..89b5d74
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#include "kmultiformlistboxfactory.h"
+#include <qframe.h>
+
+QWidget *KMultiFormListBoxFactory::separator(QWidget *parent) {
+ QFrame* sep = new QFrame( parent );
+ sep->setFrameStyle( QFrame::HLine | QFrame::Sunken);
+ sep->setLineWidth(1);
+ return sep;
+}
diff --git a/kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.h b/kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.h
new file mode 100644
index 0000000..13f6561
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/kmultiformlistboxfactory.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+// -------------------------------- includes ------------------------------
+#ifndef __kmultiformlistboxfactory
+#define __kmultiformlistboxfactory
+#include <qobject.h>
+#include "kwidgetstreamer.h"
+class KMultiFormListBoxEntry;
+//-------------------------------------------------------------------------
+
+
+/**
+ Factory use to generate elements for the @ref KMultiFormListBox widget.
+
+ To use an @ref KMultiFormListBox, one must inherit from the class KMultiFormListBoxFactory
+ and override the method @ref create. This method must return an empty
+ element for the KMultiFormListBox (that is an @ref KMultiFormListBoxEntry or a subclass of
+ it).
+
+ If you dislike the default separator between each of the elements or
+ simply do not want a separator in the KMultiFormListBox, then you may override
+ the method @ref separator.
+**/
+class KMultiFormListBoxFactory : public KWidgetStreamer
+{
+public:
+ virtual ~KMultiFormListBoxFactory() {}
+
+ /**
+ This method must be overridden in subclasses and must return an
+ ``empty'' instance of the @ref KMultiFormListBoxEntry class, or perhaps rather
+ a subclass of this class. This instance will be owned by the caller of
+ this function.
+
+ @param parent A pointer to the parent of this KMultiFormListBoxEntry widget
+ returned.
+ @return A fresh @ref KMultiFormListBoxEntry to be used in an instance of the
+ @ref KMultiFormListBox class.
+ **/
+ virtual KMultiFormListBoxEntry *create(QWidget *parent) = 0;
+
+ /**
+ This method is used to get a separator between the elements in an @ref
+ KMultiFormListBox. The widget returned from this method will be owned by the
+ caller.
+
+ @param parent A pointer to the parent of the QWidget returned.
+ @return A widget which must be used as a separator between the @ref
+ KMultiFormListBoxEntry elements in an @ref KMultiFormListBox.
+ **/
+ virtual QWidget *separator(QWidget *parent);
+};
+
+#endif /* kmultiformlistbox */
+
diff --git a/kregexpeditor/KMultiFormListBox/widgetwindow.cpp b/kregexpeditor/KMultiFormListBox/widgetwindow.cpp
new file mode 100644
index 0000000..022e452
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/widgetwindow.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#include "widgetwindow.h"
+#include "windowlistboxitem.h"
+#include <iostream>
+
+WidgetWindow::WidgetWindow(KMultiFormListBoxFactory *factory, KListBox *lb)
+ :KDialogBase(Plain, i18n("Widget Configuration"), Ok | Cancel, Ok, 0, "ConfigWindow", false)
+{
+ init(factory, lb);
+}
+
+WidgetWindow::WidgetWindow(KMultiFormListBoxFactory *factory, KMultiFormListBoxEntry *widget, KListBox *lb)
+ :KDialogBase(Plain, i18n("Widget Configuration"), Ok | Cancel, Ok, 0, "ConfigWindow", false)
+{
+ init(factory, lb, widget);
+}
+
+void WidgetWindow::init(KMultiFormListBoxFactory *factory, KListBox *lb, KMultiFormListBoxEntry *widget)
+{
+ listbox = lb;
+ myFact = factory;
+
+ QFrame *frame = plainPage();
+ QHBoxLayout *lay = new QHBoxLayout(frame,0,-1,"WidgetWindow::init::lay");
+
+ if (widget != 0) {
+ myWidget = widget;
+ widget->reparent(frame, 0, QPoint(0,0));
+ }
+ else {
+ myWidget = factory->create(frame);
+ }
+ QDataStream stream( _backup, IO_WriteOnly );
+ myFact->toStream( myWidget, stream );
+
+ lay->addWidget(myWidget);
+
+ if (widget != 0) {
+ initialShow = false;
+ myListboxItem = new WindowListboxItem(listbox,myWidget->idxString(), this);
+ }
+ else {
+ initialShow = true;
+ }
+}
+
+
+
+WidgetWindow::~WidgetWindow()
+{
+ delete myWidget;
+}
+
+void WidgetWindow::slotOk()
+{
+ if (initialShow) {
+ myListboxItem = new WindowListboxItem(listbox,myWidget->idxString(), this);
+ }
+ else {
+ myListboxItem->setText(myWidget->idxString());
+ }
+ initialShow = false;
+ KDialogBase::slotOk();
+}
+
+void WidgetWindow::slotCancel()
+{
+ if (initialShow) {
+ deleteLater();
+ }
+ else {
+ QDataStream stream( _backup, IO_ReadOnly );
+ myFact->fromStream( stream, myWidget );
+ }
+ KDialogBase::slotCancel();
+}
+
+WidgetWindow *WidgetWindow::clone()
+{
+ WidgetWindow *item = new WidgetWindow(myFact, listbox);
+ QByteArray data;
+ QDataStream ws( data, IO_WriteOnly );
+ myFact->toStream( myWidget, ws );
+ QDataStream rs( data, IO_ReadOnly );
+ myFact->fromStream( rs, item->myWidget );
+
+ item->slotOk();
+ return item;
+}
+
+void WidgetWindow::display()
+{
+ QDataStream stream( _backup, IO_WriteOnly);
+ myFact->toStream( myWidget, stream );
+ show();
+}
+
+KMultiFormListBoxEntry *WidgetWindow::entry()
+{
+ return myWidget;
+}
diff --git a/kregexpeditor/KMultiFormListBox/widgetwindow.h b/kregexpeditor/KMultiFormListBox/widgetwindow.h
new file mode 100644
index 0000000..f81b359
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/widgetwindow.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __configwindow
+#define __configwindow
+
+#ifdef QT_ONLY
+ #include "compat.h"
+ #include <qlistbox.h>
+#else
+ #include <kdialogbase.h>
+ #include <klistbox.h>
+#endif
+
+#include "kmultiformlistbox-windowed.h"
+
+/**
+ @internal
+*/
+class WidgetWindow :public KDialogBase
+{
+ friend class KMultiFormListBoxWindowed;
+ friend class WindowListboxItem;
+
+ WidgetWindow(KMultiFormListBoxFactory *, KListBox *);
+ WidgetWindow(KMultiFormListBoxFactory *, KMultiFormListBoxEntry *widget, KListBox *);
+ void init(KMultiFormListBoxFactory *, KListBox *, KMultiFormListBoxEntry *widget = 0);
+ void display();
+ KMultiFormListBoxEntry *entry();
+ WidgetWindow *clone();
+ ~WidgetWindow();
+
+protected slots:
+ void slotOk();
+ void slotCancel();
+
+private:
+ KMultiFormListBoxFactory *myFact;
+ KMultiFormListBoxEntry *myWidget;
+ QByteArray _backup;
+ KListBox *listbox;
+ WindowListboxItem *myListboxItem;
+ bool initialShow;
+};
+
+#endif // configwindow
diff --git a/kregexpeditor/KMultiFormListBox/windowlistboxitem.cpp b/kregexpeditor/KMultiFormListBox/windowlistboxitem.cpp
new file mode 100644
index 0000000..41f9e5b
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/windowlistboxitem.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#include "windowlistboxitem.h"
+#include "widgetwindow.h"
+
+WindowListboxItem::WindowListboxItem(QListBox *lb, QString text, WidgetWindow *windowWidget)
+ :QListBoxText(lb, text), myItem(windowWidget)
+{
+}
+
+WindowListboxItem::~WindowListboxItem()
+{
+ delete myItem;
+}
+
+void WindowListboxItem::displayWidget()
+{
+ myItem->display();
+}
+
+void WindowListboxItem::clone()
+{
+ myItem->clone();
+}
+
+KMultiFormListBoxEntry *WindowListboxItem::entry()
+{
+ return myItem->entry();
+}
+
diff --git a/kregexpeditor/KMultiFormListBox/windowlistboxitem.h b/kregexpeditor/KMultiFormListBox/windowlistboxitem.h
new file mode 100644
index 0000000..2505b88
--- /dev/null
+++ b/kregexpeditor/KMultiFormListBox/windowlistboxitem.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef __windowlistboxitem
+#define __windowlistboxitem
+#include <qlistbox.h>
+class WidgetWindow;
+class KMultiFormListBoxWindowed;
+class KMultiFormListBoxEntry;
+
+
+/**
+ @internal
+*/
+class WindowListboxItem :public QListBoxText
+{
+ friend class WidgetWindow;
+ friend class KMultiFormListBoxWindowed;
+public:
+ WindowListboxItem(QListBox *, QString, WidgetWindow *);
+ ~WindowListboxItem();
+ void clone();
+ void displayWidget();
+ KMultiFormListBoxEntry *entry();
+
+private:
+ WidgetWindow *myItem;
+};
+
+#endif // __windowlistboxitem