~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to lib/widgets/kcomboview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
3
 
 
4
 
   This library is free software; you can redistribute it and/or
5
 
   modify it under the terms of the GNU Library General Public
6
 
   License as published by the Free Software Foundation; either
7
 
   version 2 of the License, or (at your option) any later version.
8
 
 
9
 
   This library is distributed in the hope that it will be useful,
10
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
   Library General Public License for more details.
13
 
 
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
16
 
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
 
   Boston, MA 02111-1307, USA.
18
 
*/
19
 
#ifndef KCOMBOVIEW_H
20
 
#define KCOMBOVIEW_H
21
 
 
22
 
#include <kcompletion.h>
23
 
 
24
 
#include "qcomboview.h"
25
 
 
26
 
/**
27
 
@file kcomboview.h
28
 
KComboView class.
29
 
*/
30
 
 
31
 
/**
32
 
KComboView - a combo with a QListView as a popup widget.
33
 
KComboView provides text completion.
34
 
@sa QComboView for a description.
35
 
*/
36
 
 
37
 
 
38
 
///This can be used to insert own KCompletion-implementations
39
 
class CustomCompleter : public KCompletion {
40
 
    public:
41
 
    virtual void addItem (const QString &item) {
42
 
        KCompletion::addItem( item );
43
 
    }
44
 
    
45
 
    virtual void removeItem (const QString &item) {
46
 
        KCompletion::removeItem( item );
47
 
    }
48
 
    
49
 
    virtual void clear() {
50
 
        KCompletion::clear();
51
 
    }
52
 
};
53
 
 
54
 
 
55
 
class KComboView: public QComboView
56
 
{
57
 
    Q_OBJECT
58
 
public:
59
 
    ///The combo-view takes the ownership of the completer and deletes it on destruction
60
 
    KComboView( bool rw, int defaultWidth = 100, QWidget* parent=0, const char* name=0, CustomCompleter* completer = new CustomCompleter() );
61
 
    virtual ~KComboView();
62
 
 
63
 
    virtual void addItem(QListViewItem *it);
64
 
    virtual void removeItem(QListViewItem *it);
65
 
    virtual void renameItem(QListViewItem *it, const QString &newName);
66
 
 
67
 
    virtual void setDefaultText(const QString &text);
68
 
 
69
 
    virtual void clear();
70
 
 
71
 
    int defaultWidth();
72
 
private:
73
 
    virtual void setUpListView();
74
 
 
75
 
    CustomCompleter* m_comp;
76
 
    int m_defaultWidth;
77
 
    QString m_defaultText;
78
 
};
79
 
 
80
 
#endif