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

KDE3Support

k3popupmenu.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef _K3POPUPMENU_H
00020 #define _K3POPUPMENU_H
00021 
00022 #ifndef QT3_SUPPORT
00023 #define QT3_SUPPORT
00024 #endif
00025 
00026 #include <kde3support_export.h>
00027 
00028 #include <Qt3Support/Q3PopupMenu>
00029 #include <QtGui/QMenuItem>
00030 
00049 class KDE3SUPPORT_EXPORT K3PopupMenu : public Q3PopupMenu {
00050     Q_OBJECT
00051 public:
00055     K3PopupMenu(QWidget *parent=0);
00056 
00060     ~K3PopupMenu();
00061 
00065     QAction* addTitle(const QString &text, QAction* before = 0L);
00069     QAction* addTitle(const QIcon &icon, const QString &text, QAction* before = 0L);
00070 
00084     void setKeyboardShortcutsEnabled(bool enable);
00085 
00090     void setKeyboardShortcutsExecute(bool enable);
00091 
00095     Q3PopupMenu* contextMenu();
00096 
00100     const Q3PopupMenu* contextMenu() const;
00101 
00105     void hideContextMenu();
00106 
00110     static K3PopupMenu* contextMenuFocus();
00111 
00115     static QAction* contextMenuFocusAction();
00116 
00117 #ifdef QT3_SUPPORT
00118 
00122     Qt::ButtonState state() const;
00123 #endif
00124 
00128     Qt::MouseButtons mouseButtons() const;
00129 
00133     Qt::KeyboardModifiers keyboardModifiers() const;
00134 
00135 #ifdef QT3_SUPPORT
00136 
00139     int insertTitle(const QString &text, int id=-1, int index=-1);
00143     int insertTitle(const QPixmap &icon, const QString &text, int id=-1,
00144                     int index=-1);
00149     void changeTitle(int id, const QString &text);
00153     void changeTitle(int id, const QPixmap &icon, const QString &text);
00159     QString title(int id=-1) const;
00163     QPixmap titlePixmap(int id) const;
00164 
00170     K3PopupMenu(const QString &title, QWidget *parent=0);
00171 
00177     void setTitle(const QString &title);
00178 
00182     static int contextMenuFocusItem();
00183 
00187     virtual void activateItemAt(int index);
00188     // END compat methods
00189 
00194     static int actionId(QAction* action)
00195     {
00196         if (!action)
00197             return -1;
00198         return static_cast<QMenuItem*>(action)->id();
00199     }
00200 #endif
00201 Q_SIGNALS:
00208     void aboutToShowContextMenu(K3PopupMenu* menu, QAction* menuAction, QMenu* ctxMenu);
00210     void aboutToShowContextMenu(K3PopupMenu* menu, int menuItem, Q3PopupMenu* ctxMenu);
00211 
00212 protected:
00213     virtual void closeEvent(QCloseEvent *);
00214     virtual void keyPressEvent(QKeyEvent* e);
00215     virtual void mouseReleaseEvent(QMouseEvent* e);
00216     virtual void mousePressEvent(QMouseEvent* e);
00217     virtual bool focusNextPrevChild( bool next );
00218     virtual void contextMenuEvent(QContextMenuEvent *e);
00219     virtual void hideEvent(QHideEvent*);
00220 
00221     virtual void virtual_hook( int id, void* data );
00222 
00223 protected Q_SLOTS:
00224     QString underlineText(const QString& text, uint length);
00225     void resetKeyboardVars(bool noMatches = false);
00226     void actionHovered(QAction* action);
00227     void showCtxMenu(const QPoint &pos);
00228     void ctxMenuHiding();
00229     void ctxMenuHideShowingMenu();
00230 
00231 private:
00232     class K3PopupMenuPrivate;
00233     K3PopupMenuPrivate *d;
00234     Q_DISABLE_COPY( K3PopupMenu )
00235 };
00236 
00237 #endif

KDE3Support

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal