Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package


** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
** This file is part of the Qt3Support module of the Qt Toolkit.
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file.  Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation. In
** addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.1, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE

#ifndef Q3COMBOBOX_H
#define Q3COMBOBOX_H

#include <QtGui/qwidget.h>




class Q3StrList;
class QStringList;
class QLineEdit;
class QValidator;
class Q3ListBox;
class Q3ComboBoxData;
class QWheelEvent;

00063 class Q_COMPAT_EXPORT Q3ComboBox : public QWidget
    Q_ENUMS( Policy )
00067     Q_PROPERTY( bool editable READ editable WRITE setEditable )
00068     Q_PROPERTY( int count READ count )
00069     Q_PROPERTY( QString currentText READ currentText WRITE setCurrentText DESIGNABLE false )
00070     Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
00071     Q_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false )
00072     Q_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit )
00073     Q_PROPERTY( int maxCount READ maxCount WRITE setMaxCount )
00074     Q_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy )
00075     Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
00076     Q_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled )

    Q3ComboBox( QWidget* parent=0, const char* name=0 );
    Q3ComboBox( bool rw, QWidget* parent=0, const char* name=0 );

    int           count() const;

    void    insertStringList( const QStringList &, int index=-1 );
    void    insertStrList( const Q3StrList &, int index=-1 );
    void    insertStrList( const Q3StrList *, int index=-1 );
    void    insertStrList( const char **, int numStrings=-1, int index=-1);

    void    insertItem( const QString &text, int index=-1 );
    void    insertItem( const QPixmap &pixmap, int index=-1 );
    void    insertItem( const QPixmap &pixmap, const QString &text, int index=-1 );

    void    removeItem( int index );

    int           currentItem() const;
    virtual void setCurrentItem( int index );

    QString       currentText() const;
    virtual void setCurrentText( const QString& );

    QString       text( int index ) const;
    const QPixmap *pixmap( int index ) const;

    void    changeItem( const QString &text, int index );
    void    changeItem( const QPixmap &pixmap, int index );
    void    changeItem( const QPixmap &pixmap, const QString &text, int index );

    bool    autoResize()      const;
    virtual void setAutoResize( bool );
    QSize   sizeHint() const;

    void    setPalette( const QPalette & );
    void    setFont( const QFont & );
    void    setEnabled( bool );

    virtual void setSizeLimit( int );
    int           sizeLimit() const;

    virtual void setMaxCount( int );
    int           maxCount() const;

00123     enum Policy { NoInsertion,
                  NoInsert = NoInsertion,
                  InsertAtTop = AtTop,
                  InsertAtCurrent = AtCurrent,
                  InsertAtBottom = AtBottom,
                  InsertAfterCurrent = AfterCurrent,
                  InsertBeforeCurrent = BeforeCurrent

    virtual void setInsertionPolicy( Policy policy );
    Policy  insertionPolicy() const;

    virtual void setValidator( const QValidator * );
    const QValidator * validator() const;

    virtual void setListBox( Q3ListBox * );
    Q3ListBox *   listBox() const;

    virtual void setLineEdit( QLineEdit *edit );
    QLineEdit*    lineEdit() const;

    virtual void setAutoCompletion( bool );
    bool    autoCompletion() const;

    bool    eventFilter( QObject *object, QEvent *event );

    void    setDuplicatesEnabled( bool enable );
    bool    duplicatesEnabled() const;

    bool    editable() const;
    void    setEditable( bool );

    virtual void popup();

    void    hide();

public Q_SLOTS:
    void    clear();
    void    clearValidator();
    void    clearEdit();
    virtual void setEditText( const QString &);

    void    activated( int index );
    void    highlighted( int index );
    void    activated( const QString &);
    void    highlighted( const QString &);
    void    textChanged( const QString &);

private Q_SLOTS:
    void    internalActivate( int );
    void    internalHighlight( int );
    void    internalClickTimeout();
    void    returnPressed();

    void    paintEvent( QPaintEvent * );
    void    resizeEvent( QResizeEvent * );
    void    mousePressEvent( QMouseEvent * );
    void    mouseMoveEvent( QMouseEvent * );
    void    mouseReleaseEvent( QMouseEvent * );
    void    mouseDoubleClickEvent( QMouseEvent * );
    void    keyPressEvent( QKeyEvent *e );
    void    focusInEvent( QFocusEvent *e );
    void    focusOutEvent( QFocusEvent *e );
    void    wheelEvent( QWheelEvent *e );
    void    styleChange( QStyle& );

    void    updateMask();

    void    setUpListBox();
    void    setUpLineEdit();
    void    popDownListBox();
    void    reIndex();
    void    currentChanged();
    int           completionIndex( const QString &, int ) const;

    Q3ComboBoxData      *d;

private:    // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
    Q3ComboBox( const Q3ComboBox & );
    Q3ComboBox &operator=( const Q3ComboBox & );

#endif // QT_NO_COMBOBOX


#endif // Q3COMBOBOX_H

Generated by  Doxygen 1.6.0   Back to index