Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** $Id: qt/qcombobox.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QComboBox class 00005 ** 00006 ** Created : 950426 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the widgets module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QCOMBOBOX_H 00039 #define QCOMBOBOX_H 00040 00041 #ifndef QT_H 00042 #include "qwidget.h" 00043 #endif // QT_H 00044 00045 #ifndef QT_NO_COMBOBOX 00046 00047 00048 class QStrList; 00049 class QStringList; 00050 class QLineEdit; 00051 class QValidator; 00052 class QListBox; 00053 class QComboBoxData; 00054 class QWheelEvent; 00055 00056 class Q_EXPORT QComboBox : public QWidget 00057 { 00058 Q_OBJECT 00059 Q_ENUMS( Policy ) 00060 Q_PROPERTY( bool editable READ editable WRITE setEditable ) 00061 Q_PROPERTY( int count READ count ) 00062 Q_PROPERTY( QString currentText READ currentText WRITE setCurrentText DESIGNABLE false ) 00063 Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem ) 00064 Q_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false ) 00065 Q_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit ) 00066 Q_PROPERTY( int maxCount READ maxCount WRITE setMaxCount ) 00067 Q_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy ) 00068 Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) 00069 Q_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled ) 00070 Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) 00071 00072 public: 00073 QComboBox( QWidget* parent=0, const char* name=0 ); 00074 QComboBox( bool rw, QWidget* parent=0, const char* name=0 ); 00075 ~QComboBox(); 00076 00077 int count() const; 00078 00079 void insertStringList( const QStringList &, int index=-1 ); 00080 void insertStrList( const QStrList &, int index=-1 ); 00081 void insertStrList( const QStrList *, int index=-1 ); 00082 void insertStrList( const char **, int numStrings=-1, int index=-1); 00083 00084 void insertItem( const QString &text, int index=-1 ); 00085 void insertItem( const QPixmap &pixmap, int index=-1 ); 00086 void insertItem( const QPixmap &pixmap, const QString &text, int index=-1 ); 00087 00088 void removeItem( int index ); 00089 00090 int currentItem() const; 00091 virtual void setCurrentItem( int index ); 00092 00093 QString currentText() const; 00094 virtual void setCurrentText( const QString& ); 00095 00096 QString text( int index ) const; 00097 const QPixmap *pixmap( int index ) const; 00098 00099 void changeItem( const QString &text, int index ); 00100 void changeItem( const QPixmap &pixmap, int index ); 00101 void changeItem( const QPixmap &pixmap, const QString &text, int index ); 00102 00103 bool autoResize() const; 00104 virtual void setAutoResize( bool ); 00105 QSize sizeHint() const; 00106 00107 void setPalette( const QPalette & ); 00108 void setFont( const QFont & ); 00109 void setEnabled( bool ); 00110 00111 virtual void setSizeLimit( int ); 00112 int sizeLimit() const; 00113 00114 virtual void setMaxCount( int ); 00115 int maxCount() const; 00116 00117 enum Policy { NoInsertion, AtTop, AtCurrent, AtBottom, 00118 AfterCurrent, BeforeCurrent }; 00119 00120 virtual void setInsertionPolicy( Policy policy ); 00121 Policy insertionPolicy() const; 00122 00123 virtual void setValidator( const QValidator * ); 00124 const QValidator * validator() const; 00125 00126 virtual void setListBox( QListBox * ); 00127 QListBox * listBox() const; 00128 00129 virtual void setLineEdit( QLineEdit *edit ); 00130 QLineEdit* lineEdit() const; 00131 00132 virtual void setAutoCompletion( bool ); 00133 bool autoCompletion() const; 00134 00135 bool eventFilter( QObject *object, QEvent *event ); 00136 00137 void setDuplicatesEnabled( bool enable ); 00138 bool duplicatesEnabled() const; 00139 00140 bool editable() const; 00141 void setEditable( bool ); 00142 00143 virtual void popup(); 00144 00145 void hide(); 00146 00147 public slots: 00148 void clear(); 00149 void clearValidator(); 00150 void clearEdit(); 00151 virtual void setEditText( const QString &); 00152 00153 signals: 00154 void activated( int index ); 00155 void highlighted( int index ); 00156 void activated( const QString &); 00157 void highlighted( const QString &); 00158 void textChanged( const QString &); 00159 00160 private slots: 00161 void internalActivate( int ); 00162 void internalHighlight( int ); 00163 void internalClickTimeout(); 00164 void returnPressed(); 00165 00166 protected: 00167 void paintEvent( QPaintEvent * ); 00168 void resizeEvent( QResizeEvent * ); 00169 void mousePressEvent( QMouseEvent * ); 00170 void mouseMoveEvent( QMouseEvent * ); 00171 void mouseReleaseEvent( QMouseEvent * ); 00172 void mouseDoubleClickEvent( QMouseEvent * ); 00173 void keyPressEvent( QKeyEvent *e ); 00174 void focusInEvent( QFocusEvent *e ); 00175 void focusOutEvent( QFocusEvent *e ); 00176 #ifndef QT_NO_WHEELEVENT 00177 void wheelEvent( QWheelEvent *e ); 00178 #endif 00179 void styleChange( QStyle& ); 00180 00181 void updateMask(); 00182 00183 private: 00184 void setUpListBox(); 00185 void setUpLineEdit(); 00186 void popDownListBox(); 00187 void reIndex(); 00188 void currentChanged(); 00189 int completionIndex( const QString &, int ) const; 00190 00191 QComboBoxData *d; 00192 00193 private: // Disabled copy constructor and operator= 00194 #if defined(Q_DISABLE_COPY) 00195 QComboBox( const QComboBox & ); 00196 QComboBox &operator=( const QComboBox & ); 00197 #endif 00198 }; 00199 00200 00201 #endif // QT_NO_COMBOBOX 00202 00203 #endif // QCOMBOBOX_H