/usr/include/kmenu.h is in kdelibs5-dev 4:4.14.38-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | /* This file is part of the KDE libraries
Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
Copyright (C) 2006 Olivier Goffart <ogoffart@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KMENU_H
#define KMENU_H
#include <kdeui_export.h>
#include <QtGui/QMenu>
/**
* @short A menu with keyboard searching
*
* KMenu is a class for menus with keyboard
* accessibility for popups with many options and/or varying options. It acts
* identically to QMenu, with the addition of setKeyboardShortcutsEnabled() and
* setKeyboardShortcutsExecute() methods.
*
*
* The keyboard search algorithm is incremental with additional underlining
* for user feedback.
*
* @author Daniel M. Duley <mosfet@kde.org>
* @author Hamish Rodda <rodda@kde.org>
*/
class KDEUI_EXPORT KMenu : public QMenu {
Q_OBJECT
public:
/**
* Constructs a KMenu.
*/
explicit KMenu(QWidget *parent = 0L);
/**
* Constructs a KMenu.
* \param title The text displayed in a parent menu when it is inserted
* into another menu as a submenu.
* \param parent the parent QWidget object
*/
explicit KMenu(const QString& title, QWidget *parent = 0L);
/**
* Destructs the object
*/
~KMenu();
/**
* Inserts a title item with no icon.
*/
QAction* addTitle(const QString &text, QAction* before = 0L);
/**
* Inserts a title item with the given icon and title.
*/
QAction* addTitle(const QIcon &icon, const QString &text, QAction* before = 0L);
/**
* Enables keyboard navigation by searching for the entered key sequence.
* Also underlines the currently selected item, providing feedback on the search.
*
* Defaults to off.
*
* \warning calls to text() of currently keyboard-selected items will
* contain additional ampersand characters.
*
* \warning though pre-existing keyboard shortcuts will not interfere with the
* operation of this feature, they may be confusing to the user as the existing
* shortcuts will not work. In addition, where text already contains ampersands,
* the underline produced is likely to confuse the user (as this feature uses
* underlining of text to indicate the current key selection sequence).
*/
void setKeyboardShortcutsEnabled(bool enable);
/**
* Enables execution of the menu item once it is uniquely specified.
* Defaults to off.
*/
void setKeyboardShortcutsExecute(bool enable);
/**
* Returns the context menu associated with this menu
* The data property of all actions inserted into the context menu is modified
* all the time to point to the action and menu it has been shown for
*/
QMenu* contextMenu();
/**
* Returns the context menu associated with this menu
*/
const QMenu* contextMenu() const;
/**
* Hides the context menu if shown
*/
void hideContextMenu();
/**
* Returns the KMenu associated with the current context menu
*/
static KMenu* contextMenuFocus();
/**
* returns the QAction associated with the current context menu
*/
static QAction* contextMenuFocusAction();
/**
* Return the state of the mouse buttons when the last menuitem was activated.
*/
Qt::MouseButtons mouseButtons() const;
/**
* Return the state of the keyboard modifiers when the last menuitem was activated.
*/
Qt::KeyboardModifiers keyboardModifiers() const;
Q_SIGNALS:
/**
* connect to this signal to be notified when a context menu is about to be shown
* @param menu The menu that the context menu is about to be shown for
* @param menuAction The action that the context menu is currently on
* @param ctxMenu The context menu itself
*/
void aboutToShowContextMenu(KMenu* menu, QAction* menuAction, QMenu* ctxMenu);
protected:
virtual void closeEvent(QCloseEvent *);
virtual void keyPressEvent(QKeyEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void mousePressEvent(QMouseEvent* e);
virtual bool focusNextPrevChild( bool next );
virtual void contextMenuEvent(QContextMenuEvent *e);
virtual void hideEvent(QHideEvent*);
private:
QString underlineText(const QString& text, uint length);
class KMenuPrivate;
KMenuPrivate * const d;
Q_PRIVATE_SLOT(d, void resetKeyboardVars(bool b = false))
Q_PRIVATE_SLOT(d, void actionHovered(QAction*))
Q_PRIVATE_SLOT(d, void showCtxMenu(const QPoint &))
};
#endif
|