1 | /* This file is part of the KDE project |
2 | Copyright (C) 2004 Esben Mose Hansen <kde@mosehansen.dk> |
3 | |
4 | This program is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; see the file COPYING. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | #ifndef POPUPPROXY_H |
20 | #define POPUPPROXY_H |
21 | |
22 | #include <QtCore/QObject> |
23 | #include <QtCore/QRegExp> |
24 | |
25 | #include "history.h" |
26 | |
27 | class ; |
28 | |
29 | class HistoryItem; |
30 | class ; |
31 | |
32 | /** |
33 | * Proxy helper for the "more" menu item |
34 | * |
35 | */ |
36 | class : public QObject |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | /** |
42 | * Inserts up to itemsPerMenu into parent from parent->youngest(), |
43 | * and spills any remaining items into a more menu. |
44 | */ |
45 | ( KlipperPopup* parent, int , int ); |
46 | |
47 | KlipperPopup* (); |
48 | |
49 | /** |
50 | * Called when rebuilding the menu |
51 | * Deletes any More menus.. and start (re)inserting into the toplevel menu. |
52 | * @param index Items are inserted at index. |
53 | * @param filter If non-empty, only insert items that match filter as a regex |
54 | * @return number of items inserted. |
55 | */ |
56 | int ( int index, const QRegExp& filter = QRegExp() ); |
57 | |
58 | public Q_SLOTS: |
59 | void (); |
60 | void (); |
61 | private: |
62 | /** |
63 | * Insert up to m_itemsPerMenu items from spill and a new |
64 | * more-menu if necessary. |
65 | * @param index Items are inserted at index |
66 | * @return number of items inserted. |
67 | */ |
68 | int ( int index = 0 ); |
69 | |
70 | /** |
71 | * Insert item into proxy_for_menu at index, |
72 | * subtracting the items height from remainingHeight |
73 | */ |
74 | void ( HistoryItem const * const item, int& remainingHeight, const int index ); |
75 | |
76 | /** |
77 | * Delete all "More..." menus current created. |
78 | */ |
79 | void (); |
80 | |
81 | private: |
82 | KMenu* ; |
83 | QByteArray ; |
84 | QRegExp ; |
85 | int ; |
86 | int ; |
87 | }; |
88 | |
89 | #endif |
90 | |