home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qcombobox.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  6KB  |  197 lines

  1. /**********************************************************************
  2. ** $Id:  qt/qcombobox.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QComboBox class
  5. **
  6. ** Created : 950426
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QCOMBOBOX_H
  39. #define QCOMBOBOX_H
  40.  
  41. #ifndef QT_H
  42. #include "qwidget.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_COMBOBOX
  46.  
  47.  
  48. class QStrList;
  49. class QStringList;
  50. class QLineEdit;
  51. class QValidator;
  52. class QListBox;
  53. class QComboBoxData;
  54.  
  55. class Q_EXPORT QComboBox : public QWidget
  56. {
  57.     Q_OBJECT
  58.     Q_ENUMS( Policy )
  59.     Q_PROPERTY( bool editable READ editable WRITE setEditable )
  60.     Q_PROPERTY( int count READ count )
  61.     Q_PROPERTY( QString currentText READ currentText WRITE setCurrentText DESIGNABLE false )
  62.     Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
  63.     Q_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false )
  64.     Q_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit )
  65.     Q_PROPERTY( int maxCount READ maxCount WRITE setMaxCount )
  66.     Q_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy )
  67.     Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
  68.     Q_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled )
  69.     Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true )
  70.  
  71. public:
  72.     QComboBox( QWidget* parent=0, const char* name=0 );
  73.     QComboBox( bool rw, QWidget* parent=0, const char* name=0 );
  74.     ~QComboBox();
  75.  
  76.     int        count() const;
  77.  
  78.     void    insertStringList( const QStringList &, int index=-1 );
  79.     void    insertStrList( const QStrList &, int index=-1 );
  80.     void    insertStrList( const QStrList *, int index=-1 );
  81.     void    insertStrList( const char **, int numStrings=-1, int index=-1);
  82.  
  83.     void    insertItem( const QString &text, int index=-1 );
  84.     void    insertItem( const QPixmap &pixmap, int index=-1 );
  85.     void    insertItem( const QPixmap &pixmap, const QString &text, int index=-1 );
  86.  
  87.     void    removeItem( int index );
  88.  
  89.     int        currentItem() const;
  90.     virtual void setCurrentItem( int index );
  91.  
  92.     QString     currentText() const;
  93.     virtual void setCurrentText( const QString& );
  94.  
  95.     QString     text( int index ) const;
  96.     const QPixmap *pixmap( int index ) const;
  97.  
  98.     void    changeItem( const QString &text, int index );
  99.     void    changeItem( const QPixmap &pixmap, int index );
  100.     void    changeItem( const QPixmap &pixmap, const QString &text, int index );
  101.  
  102.     bool    autoResize()    const;
  103.     virtual void setAutoResize( bool );
  104.     QSize    sizeHint() const;
  105.  
  106.     void    setPalette( const QPalette & );
  107.     void    setFont( const QFont & );
  108.     void    setEnabled( bool );
  109.  
  110.     virtual void setSizeLimit( int );
  111.     int        sizeLimit() const;
  112.  
  113.     virtual void setMaxCount( int );
  114.     int        maxCount() const;
  115.  
  116.     enum Policy { NoInsertion, AtTop, AtCurrent, AtBottom,
  117.           AfterCurrent, BeforeCurrent };
  118.  
  119.     virtual void setInsertionPolicy( Policy policy );
  120.     Policy    insertionPolicy() const;
  121.  
  122.     virtual void setValidator( const QValidator * );
  123.     const QValidator * validator() const;
  124.  
  125.     virtual void setListBox( QListBox * );
  126.     QListBox *    listBox() const;
  127.  
  128.     virtual void setLineEdit( QLineEdit *edit );
  129.     QLineEdit*    lineEdit() const;
  130.  
  131.     virtual void setAutoCompletion( bool );
  132.     bool    autoCompletion() const;
  133.  
  134.     bool    eventFilter( QObject *object, QEvent *event );
  135.  
  136.     void    setDuplicatesEnabled( bool enable );
  137.     bool    duplicatesEnabled() const;
  138.  
  139.     bool    editable() const;
  140.     void    setEditable( bool );
  141.  
  142.     virtual void popup();
  143.  
  144. public slots:
  145.     void    clear();
  146.     void    clearValidator();
  147.     void    clearEdit();
  148.     virtual void setEditText( const QString &);
  149.  
  150. signals:
  151.     void    activated( int index );
  152.     void    highlighted( int index );
  153.     void    activated( const QString &);
  154.     void    highlighted( const QString &);
  155.     void    textChanged( const QString &);
  156.  
  157. private slots:
  158.     void    internalActivate( int );
  159.     void    internalHighlight( int );
  160.     void    internalClickTimeout();
  161.     void    returnPressed();
  162.  
  163. protected:
  164.     void    paintEvent( QPaintEvent * );
  165.     void    resizeEvent( QResizeEvent * );
  166.     void    mousePressEvent( QMouseEvent * );
  167.     void    mouseMoveEvent( QMouseEvent * );
  168.     void    mouseReleaseEvent( QMouseEvent * );
  169.     void    mouseDoubleClickEvent( QMouseEvent * );
  170.     void    keyPressEvent( QKeyEvent *e );
  171.     void    focusInEvent( QFocusEvent *e );
  172.     void    styleChange( QStyle& );
  173.  
  174.     void    updateMask();
  175.  
  176. private:
  177.     void    setUpListBox();
  178.     void    setUpLineEdit();
  179.     void    popDownListBox();
  180.     void    reIndex();
  181.     void    currentChanged();
  182.     int        completionIndex( const QString &, int ) const;
  183.  
  184.     QComboBoxData    *d;
  185.  
  186. private:    // Disabled copy constructor and operator=
  187. #if defined(Q_DISABLE_COPY)
  188.     QComboBox( const QComboBox & );
  189.     QComboBox &operator=( const QComboBox & );
  190. #endif
  191. };
  192.  
  193.  
  194. #endif // QT_NO_COMBOBOX
  195.  
  196. #endif // QCOMBOBOX_H
  197.