1 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
2 /* This file is part of the KDE project
3 Copyright (C) 2004 Esben Mose Hansen <kde@mosehansen.dk>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
20 #ifndef _POPUPPROXY_H_
21 #define _POPUPPROXY_H_
34 * Proxy helper for the "more" menu item
37 class PopupProxy
: public QObject
43 * Inserts up to itemsPerMenu into parent from parent->youngest(),
44 * and spills any remaining items into a more menu.
46 PopupProxy( KlipperPopup
* parent
, int menu_height
, int menu_width
);
48 KlipperPopup
* parent();
51 * Called when rebuilding the menu
52 * Deletes any More menus.. and start (re)inserting into the toplevel menu.
53 * @param index Items are inserted at index.
54 * @param filter If non-empty, only insert items that match filter as a regex
55 * @return number of items inserted.
57 int buildParent( int index
, const QRegExp
& filter
= QRegExp() );
60 void slotAboutToShow();
61 void slotHistoryChanged();
64 * Insert up to m_itemsPerMenu items from spill and a new
65 * more-menu if necessary.
66 * @param index Items are inserted at index
67 * @return number of items inserted.
69 int insertFromSpill( int index
= 0 );
72 * Insert item into proxy_for_menu at index,
73 * subtracting the items height from remainingHeight
75 void tryInsertItem( HistoryItem
const * const item
, int& remainingHeight
, const int index
);
78 * Delete all "More..." menus current created.
80 void deleteMoreMenus();
83 KMenu
* m_proxy_for_menu
;
84 History::iterator m_spillPointer
;