author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kdeui/klistbox.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | microkde/kdeui/klistbox.h | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/microkde/kdeui/klistbox.h b/microkde/kdeui/klistbox.h new file mode 100644 index 0000000..8023780 --- a/dev/null +++ b/microkde/kdeui/klistbox.h | |||
@@ -0,0 +1,141 @@ | |||
1 | /* This file is part of the KDE libraries | ||
2 | Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org> | ||
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 version 2 as published by the Free Software Foundation. | ||
7 | |||
8 | This library is distributed in the hope that it will be useful, | ||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | Library General Public License for more details. | ||
12 | |||
13 | You should have received a copy of the GNU Library General Public License | ||
14 | along with this library; see the file COPYING.LIB. If not, write to | ||
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
16 | Boston, MA 02111-1307, USA. | ||
17 | */ | ||
18 | #ifndef KLISTBOX_H | ||
19 | #define KLISTBOX_H | ||
20 | |||
21 | #include <qlistbox.h> | ||
22 | |||
23 | /** | ||
24 | * Extends the functionality of @ref QListBox to honor the system | ||
25 | * wide settings for Single Click/Double Click mode, Auto Selection and | ||
26 | * Change Cursor over Link. | ||
27 | * | ||
28 | * There is a new signal @ref executed(). It gets connected to either | ||
29 | * @ref QListBox::clicked() or @ref QListBox::doubleClicked() | ||
30 | * depending on the KDE wide Single Click/Double Click settings. It is | ||
31 | * strongly recomended that you use this signal instead of the above | ||
32 | * mentioned. This way you don't need to care about the current | ||
33 | * settings. If you want to get informed when the user selects | ||
34 | * something connect to the @ref QListBox::selectionChanged() signal. | ||
35 | * | ||
36 | * @short A variant of @ref QListBox that honors KDE's system-wide settings. | ||
37 | **/ | ||
38 | class KListBox : public QListBox | ||
39 | { | ||
40 | Q_OBJECT | ||
41 | |||
42 | public: | ||
43 | KListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | ||
44 | |||
45 | signals: | ||
46 | |||
47 | /** | ||
48 | * Emitted whenever the user executes an listbox item. | ||
49 | * | ||
50 | * That means depending on the KDE wide Single Click/Double Click | ||
51 | * setting the user clicked or double clicked on that item. | ||
52 | * @param item is the pointer to the executed listbox item. | ||
53 | * | ||
54 | * Note that you may not delete any @ref QListBoxItem objects in slots | ||
55 | * connected to this signal. | ||
56 | */ | ||
57 | void executed( QListBoxItem *item ); | ||
58 | |||
59 | /** | ||
60 | * Emitted whenever the user executes an listbox item. | ||
61 | * | ||
62 | * That means depending on the KDE wide Single Click/Double Click | ||
63 | * setting the user clicked or double clicked on that item. | ||
64 | * @param item is the pointer to the executed listbox item. | ||
65 | * @param pos is the position where the user has clicked | ||
66 | * | ||
67 | * Note that you may not delete any @ref QListBoxItem objects in slots | ||
68 | * connected to this signal. | ||
69 | */ | ||
70 | void executed( QListBoxItem *item, const QPoint &pos ); | ||
71 | |||
72 | /** | ||
73 | * This signal gets emitted whenever the user double clicks into the | ||
74 | * listbox. | ||
75 | * | ||
76 | * @param item The pointer to the clicked listbox item. | ||
77 | * @param pos The position where the user has clicked. | ||
78 | * | ||
79 | * Note that you may not delete any @ref QListBoxItem objects in slots | ||
80 | * connected to this signal. | ||
81 | * | ||
82 | * This signal is more or less here for the sake of completeness. | ||
83 | * You should normally not need to use this. In most cases it's better | ||
84 | * to use @ref executed() instead. | ||
85 | */ | ||
86 | void doubleClicked( QListBoxItem *item, const QPoint &pos ); | ||
87 | |||
88 | protected slots: | ||
89 | void slotOnItem( QListBoxItem *item ); | ||
90 | void slotOnViewport(); | ||
91 | |||
92 | //US void slotSettingsChanged(int); | ||
93 | |||
94 | /** | ||
95 | * Auto selection happend. | ||
96 | */ | ||
97 | void slotAutoSelect(); | ||
98 | |||
99 | protected: | ||
100 | void emitExecute( QListBoxItem *item, const QPoint &pos ); | ||
101 | |||
102 | /** | ||
103 | * @reimplemented | ||
104 | */ | ||
105 | virtual void keyPressEvent(QKeyEvent *e); | ||
106 | /** | ||
107 | * @reimplemented | ||
108 | */ | ||
109 | virtual void focusOutEvent( QFocusEvent *fe ); | ||
110 | /** | ||
111 | * @reimplemented | ||
112 | */ | ||
113 | virtual void leaveEvent( QEvent *e ); | ||
114 | /** | ||
115 | * @reimplemented | ||
116 | */ | ||
117 | virtual void contentsMousePressEvent( QMouseEvent *e ); | ||
118 | /** | ||
119 | * @reimplemented | ||
120 | */ | ||
121 | virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e ); | ||
122 | |||
123 | bool m_bUseSingle; | ||
124 | //US bool m_bChangeCursorOverItem; | ||
125 | |||
126 | QListBoxItem* m_pCurrentItem; | ||
127 | |||
128 | QTimer* m_pAutoSelect; | ||
129 | int m_autoSelectDelay; | ||
130 | |||
131 | private slots: | ||
132 | void slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ); | ||
133 | |||
134 | protected: | ||
135 | virtual void virtual_hook( int id, void* data ); | ||
136 | private: | ||
137 | class KListBoxPrivate; | ||
138 | KListBoxPrivate *d; | ||
139 | }; | ||
140 | |||
141 | #endif | ||