You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdevelop/lib/widgets/kcomboview.h

82 lines
2.2 KiB

/* This file is part of the KDE project
Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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 KCOMBOVIEW_H
#define KCOMBOVIEW_H
#include <kcompletion.h>
#include "qcomboview.h"
/**
@file kcomboview.h
KComboView class.
*/
/**
KComboView - a combo with a TQListView as a popup widget.
KComboView provides text completion.
@sa QComboView for a description.
*/
///This can be used to insert own KCompletion-implementations
class CustomCompleter : public KCompletion {
public:
virtual void addItem (const TQString &item) {
KCompletion::addItem( item );
}
virtual void removeItem (const TQString &item) {
KCompletion::removeItem( item );
}
virtual void clear() {
KCompletion::clear();
}
};
class KComboView: public QComboView
{
Q_OBJECT
public:
///The combo-view takes the ownership of the completer and deletes it on destruction
KComboView( bool rw, int defaultWidth = 100, TQWidget* parent=0, const char* name=0, CustomCompleter* completer = new CustomCompleter() );
virtual ~KComboView();
virtual void addItem(TQListViewItem *it);
virtual void removeItem(TQListViewItem *it);
virtual void renameItem(TQListViewItem *it, const TQString &newName);
virtual void setDefaultText(const TQString &text);
virtual void clear();
int defaultWidth();
private:
virtual void setUpListView();
CustomCompleter* m_comp;
int m_defaultWidth;
TQString m_defaultText;
};
#endif