|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt3Support module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef Q3COMBOBOX_H |
|
43 #define Q3COMBOBOX_H |
|
44 |
|
45 #include <QtGui/qwidget.h> |
|
46 |
|
47 QT_BEGIN_HEADER |
|
48 |
|
49 QT_BEGIN_NAMESPACE |
|
50 |
|
51 QT_MODULE(Qt3SupportLight) |
|
52 |
|
53 #ifndef QT_NO_COMBOBOX |
|
54 |
|
55 class Q3StrList; |
|
56 class QStringList; |
|
57 class QLineEdit; |
|
58 class QValidator; |
|
59 class Q3ListBox; |
|
60 class Q3ComboBoxData; |
|
61 class QWheelEvent; |
|
62 |
|
63 class Q_COMPAT_EXPORT Q3ComboBox : public QWidget |
|
64 { |
|
65 Q_OBJECT |
|
66 Q_ENUMS( Policy ) |
|
67 Q_PROPERTY( bool editable READ editable WRITE setEditable ) |
|
68 Q_PROPERTY( int count READ count ) |
|
69 Q_PROPERTY( QString currentText READ currentText WRITE setCurrentText DESIGNABLE false ) |
|
70 Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem ) |
|
71 Q_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false ) |
|
72 Q_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit ) |
|
73 Q_PROPERTY( int maxCount READ maxCount WRITE setMaxCount ) |
|
74 Q_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy ) |
|
75 Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) |
|
76 Q_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled ) |
|
77 |
|
78 public: |
|
79 Q3ComboBox( QWidget* parent=0, const char* name=0 ); |
|
80 Q3ComboBox( bool rw, QWidget* parent=0, const char* name=0 ); |
|
81 ~Q3ComboBox(); |
|
82 |
|
83 int count() const; |
|
84 |
|
85 void insertStringList( const QStringList &, int index=-1 ); |
|
86 void insertStrList( const Q3StrList &, int index=-1 ); |
|
87 void insertStrList( const Q3StrList *, int index=-1 ); |
|
88 void insertStrList( const char **, int numStrings=-1, int index=-1); |
|
89 |
|
90 void insertItem( const QString &text, int index=-1 ); |
|
91 void insertItem( const QPixmap &pixmap, int index=-1 ); |
|
92 void insertItem( const QPixmap &pixmap, const QString &text, int index=-1 ); |
|
93 |
|
94 void removeItem( int index ); |
|
95 |
|
96 int currentItem() const; |
|
97 virtual void setCurrentItem( int index ); |
|
98 |
|
99 QString currentText() const; |
|
100 virtual void setCurrentText( const QString& ); |
|
101 |
|
102 QString text( int index ) const; |
|
103 const QPixmap *pixmap( int index ) const; |
|
104 |
|
105 void changeItem( const QString &text, int index ); |
|
106 void changeItem( const QPixmap &pixmap, int index ); |
|
107 void changeItem( const QPixmap &pixmap, const QString &text, int index ); |
|
108 |
|
109 bool autoResize() const; |
|
110 virtual void setAutoResize( bool ); |
|
111 QSize sizeHint() const; |
|
112 |
|
113 void setPalette( const QPalette & ); |
|
114 void setFont( const QFont & ); |
|
115 void setEnabled( bool ); |
|
116 |
|
117 virtual void setSizeLimit( int ); |
|
118 int sizeLimit() const; |
|
119 |
|
120 virtual void setMaxCount( int ); |
|
121 int maxCount() const; |
|
122 |
|
123 enum Policy { NoInsertion, |
|
124 AtTop, |
|
125 AtCurrent, |
|
126 AtBottom, |
|
127 AfterCurrent, |
|
128 BeforeCurrent, |
|
129 NoInsert = NoInsertion, |
|
130 InsertAtTop = AtTop, |
|
131 InsertAtCurrent = AtCurrent, |
|
132 InsertAtBottom = AtBottom, |
|
133 InsertAfterCurrent = AfterCurrent, |
|
134 InsertBeforeCurrent = BeforeCurrent |
|
135 }; |
|
136 |
|
137 virtual void setInsertionPolicy( Policy policy ); |
|
138 Policy insertionPolicy() const; |
|
139 |
|
140 virtual void setValidator( const QValidator * ); |
|
141 const QValidator * validator() const; |
|
142 |
|
143 virtual void setListBox( Q3ListBox * ); |
|
144 Q3ListBox * listBox() const; |
|
145 |
|
146 virtual void setLineEdit( QLineEdit *edit ); |
|
147 QLineEdit* lineEdit() const; |
|
148 |
|
149 virtual void setAutoCompletion( bool ); |
|
150 bool autoCompletion() const; |
|
151 |
|
152 bool eventFilter( QObject *object, QEvent *event ); |
|
153 |
|
154 void setDuplicatesEnabled( bool enable ); |
|
155 bool duplicatesEnabled() const; |
|
156 |
|
157 bool editable() const; |
|
158 void setEditable( bool ); |
|
159 |
|
160 virtual void popup(); |
|
161 |
|
162 void hide(); |
|
163 |
|
164 public Q_SLOTS: |
|
165 void clear(); |
|
166 void clearValidator(); |
|
167 void clearEdit(); |
|
168 virtual void setEditText( const QString &); |
|
169 |
|
170 Q_SIGNALS: |
|
171 void activated( int index ); |
|
172 void highlighted( int index ); |
|
173 void activated( const QString &); |
|
174 void highlighted( const QString &); |
|
175 void textChanged( const QString &); |
|
176 |
|
177 private Q_SLOTS: |
|
178 void internalActivate( int ); |
|
179 void internalHighlight( int ); |
|
180 void internalClickTimeout(); |
|
181 void returnPressed(); |
|
182 |
|
183 protected: |
|
184 void paintEvent( QPaintEvent * ); |
|
185 void resizeEvent( QResizeEvent * ); |
|
186 void mousePressEvent( QMouseEvent * ); |
|
187 void mouseMoveEvent( QMouseEvent * ); |
|
188 void mouseReleaseEvent( QMouseEvent * ); |
|
189 void mouseDoubleClickEvent( QMouseEvent * ); |
|
190 void keyPressEvent( QKeyEvent *e ); |
|
191 void focusInEvent( QFocusEvent *e ); |
|
192 void focusOutEvent( QFocusEvent *e ); |
|
193 #ifndef QT_NO_WHEELEVENT |
|
194 void wheelEvent( QWheelEvent *e ); |
|
195 #endif |
|
196 void styleChange( QStyle& ); |
|
197 |
|
198 void updateMask(); |
|
199 |
|
200 private: |
|
201 void setUpListBox(); |
|
202 void setUpLineEdit(); |
|
203 void popDownListBox(); |
|
204 void reIndex(); |
|
205 void currentChanged(); |
|
206 int completionIndex( const QString &, int ) const; |
|
207 |
|
208 Q3ComboBoxData *d; |
|
209 |
|
210 private: // Disabled copy constructor and operator= |
|
211 #if defined(Q_DISABLE_COPY) |
|
212 Q3ComboBox( const Q3ComboBox & ); |
|
213 Q3ComboBox &operator=( const Q3ComboBox & ); |
|
214 #endif |
|
215 }; |
|
216 |
|
217 |
|
218 #endif // QT_NO_COMBOBOX |
|
219 |
|
220 QT_END_NAMESPACE |
|
221 |
|
222 QT_END_HEADER |
|
223 |
|
224 #endif // Q3COMBOBOX_H |