• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

  • sources
  • kde-4.14
  • kdelibs
  • kde3support
  • kdeui
k3popupmenu.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Daniel M. Duley <mosfet@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., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef _K3POPUPMENU_H
20 #define _K3POPUPMENU_H
21 
22 #ifndef QT3_SUPPORT
23 #define QT3_SUPPORT
24 #endif
25 
26 #include <kde3support_export.h>
27 
28 #include <Qt3Support/Q3PopupMenu>
29 #include <QtGui/QMenuItem>
30 
49 class KDE3SUPPORT_EXPORT K3PopupMenu : public Q3PopupMenu {
50  Q_OBJECT
51 public:
55  K3PopupMenu(QWidget *parent=0);
56 
60  ~K3PopupMenu();
61 
65  QAction* addTitle(const QString &text, QAction* before = 0L);
69  QAction* addTitle(const QIcon &icon, const QString &text, QAction* before = 0L);
70 
84  void setKeyboardShortcutsEnabled(bool enable);
85 
90  void setKeyboardShortcutsExecute(bool enable);
91 
95  Q3PopupMenu* contextMenu();
96 
100  const Q3PopupMenu* contextMenu() const;
101 
105  void hideContextMenu();
106 
110  static K3PopupMenu* contextMenuFocus();
111 
115  static QAction* contextMenuFocusAction();
116 
117 #ifdef QT3_SUPPORT
118 
122  Qt::ButtonState state() const;
123 #endif
124 
128  Qt::MouseButtons mouseButtons() const;
129 
133  Qt::KeyboardModifiers keyboardModifiers() const;
134 
135 #ifdef QT3_SUPPORT
136 
139  int insertTitle(const QString &text, int id=-1, int index=-1);
143  int insertTitle(const QPixmap &icon, const QString &text, int id=-1,
144  int index=-1);
149  void changeTitle(int id, const QString &text);
153  void changeTitle(int id, const QPixmap &icon, const QString &text);
159  QString title(int id=-1) const;
163  QPixmap titlePixmap(int id) const;
164 
170  K3PopupMenu(const QString &title, QWidget *parent=0);
171 
177  void setTitle(const QString &title);
178 
182  static int contextMenuFocusItem();
183 
187  virtual void activateItemAt(int index);
188  // END compat methods
189 
194  static int actionId(QAction* action)
195  {
196  if (!action)
197  return -1;
198  return static_cast<QMenuItem*>(action)->id();
199  }
200 #endif
201 Q_SIGNALS:
208  void aboutToShowContextMenu(K3PopupMenu* menu, QAction* menuAction, QMenu* ctxMenu);
210  void aboutToShowContextMenu(K3PopupMenu* menu, int menuItem, Q3PopupMenu* ctxMenu);
211 
212 protected:
213  virtual void closeEvent(QCloseEvent *);
214  virtual void keyPressEvent(QKeyEvent* e);
215  virtual void mouseReleaseEvent(QMouseEvent* e);
216  virtual void mousePressEvent(QMouseEvent* e);
217  virtual bool focusNextPrevChild( bool next );
218  virtual void contextMenuEvent(QContextMenuEvent *e);
219  virtual void hideEvent(QHideEvent*);
220 
221  virtual void virtual_hook( int id, void* data );
222 
223 protected Q_SLOTS:
224  QString underlineText(const QString& text, uint length);
225  void resetKeyboardVars(bool noMatches = false);
226  void actionHovered(QAction* action);
227  void showCtxMenu(const QPoint &pos);
228  void ctxMenuHiding();
229  void ctxMenuHideShowingMenu();
230 
231 private:
232  class K3PopupMenuPrivate;
233  K3PopupMenuPrivate *d;
234  Q_DISABLE_COPY( K3PopupMenu )
235 };
236 
237 #endif
QHideEvent
QWidget
K3PopupMenu
A menu with keyboard searching and convenience methods for title items.
Definition: k3popupmenu.h:49
QMenu::focusNextPrevChild
virtual bool focusNextPrevChild(bool next)
QPoint
QMouseEvent
QMenu::activateItemAt
void activateItemAt(int index)
QMenuItem
Q3PopupMenu
QCloseEvent
K3PopupMenu::actionId
static int actionId(QAction *action)
Helper for porting things.
Definition: k3popupmenu.h:194
QWidget::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *event)
kde3support_export.h
QContextMenuEvent
QMenu::mousePressEvent
virtual void mousePressEvent(QMouseEvent *e)
Qt::ButtonState
typedef ButtonState
QMenu::title
QString title() const
QString
QMenu::hideEvent
virtual void hideEvent(QHideEvent *)
QPixmap
QMenu
QKeyEvent
Qt::MouseButtons
typedef MouseButtons
QAction
QWidget::closeEvent
virtual void closeEvent(QCloseEvent *event)
QMenu::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *e)
QIcon
QMenu::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e)
Qt::KeyboardModifiers
typedef KeyboardModifiers
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

Skip menu "KDE3Support"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal