From 79fd2b2bbd9f842ce3c84c67e3314033a9cceea4 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:18:06 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- .../KMultiFormListBox/tdemultiformlistbox.cpp | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 kregexpeditor/KMultiFormListBox/tdemultiformlistbox.cpp (limited to 'kregexpeditor/KMultiFormListBox/tdemultiformlistbox.cpp') diff --git a/kregexpeditor/KMultiFormListBox/tdemultiformlistbox.cpp b/kregexpeditor/KMultiFormListBox/tdemultiformlistbox.cpp new file mode 100644 index 0000000..33eda27 --- /dev/null +++ b/kregexpeditor/KMultiFormListBox/tdemultiformlistbox.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2002-2003 Jesper K. Pedersen + * + * 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 TQT_ONLY + #include "tdemultiformlistbox.moc" +#endif + +#include "tdemultiformlistbox-multivisible.h" +#include "tdemultiformlistbox-windowed.h" + +KMultiFormListBox::KMultiFormListBox( KMultiFormListBoxFactory *factory, KMultiFormListBoxType tp, TQWidget *parent, + bool showUpDownButtons, bool showHelpButton, TQString addButtonText, + const char *name ) : TQWidget( 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; + } + + TQWidget *widget = theWidget->qWidget(); + + TQHBoxLayout *layout = new TQHBoxLayout( 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(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( TQDataStream& stream ) const +{ + const KMultiFormListBoxEntryList elms = elements(); + stream << elms.count(); + for ( TQPtrListIterator it(elms); *it; ++it) + _factory->toStream( TQT_TQOBJECT(*it), stream ); +} + +void KMultiFormListBox::fromStream( TQDataStream& 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 (TQPtrListIterator it(elms); *it; ++it) + _factory->fromStream( stream, TQT_TQOBJECT(*it) ); +} + + + -- cgit v1.2.3