summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/klistbox.h
Unidiff
Diffstat (limited to 'microkde/kdeui/klistbox.h') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdeui/klistbox.h141
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 **/
38class KListBox : public QListBox
39{
40 Q_OBJECT
41
42public:
43 KListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
44
45signals:
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
88protected 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
99protected:
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
131private slots:
132 void slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos );
133
134protected:
135 virtual void virtual_hook( int id, void* data );
136private:
137 class KListBoxPrivate;
138 KListBoxPrivate *d;
139};
140
141#endif