kdeui Library API Documentation

KContextMenuManager Class Reference

Convenience class to mangage context menus. More...

#include <kcmenumngr.h>

Inheritance diagram for KContextMenuManager:

QObject List of all members.

Static Public Methods

void insert (QWidget *widget, QPopupMenu *popup)
 Makes popup a context popup menu for widget widget.

bool showOnButtonPress (void)
 Use this method to get information about when a popup menu should be activated.


Detailed Description

Convenience class to mangage context menus.

Author:
Matthias Ettrich <ettrich@kde.org>
Version:
Id:
kcmenumngr.h,v 1.8 2001/11/21 21:24:08 ellis Exp

KContextMenuManager manages configurable context popup menus. Instead of reimplementing QWidget::mousePressEvent() or QWidget::mouseReleaseEvent() and/or QWidget::keyPressEvent(), simply create the popup menu and insert it into the context menu manager with the static function insert().

Example:

   include <kcmenumngr.h>
   ...
   KContextMenuManager::insert( myWidget, myPopupMenu );

Context menus are invoked with either a special shortcut key (usually the menu key) or the right mouse button.

Menus are configurable in the [ContextMenus] group of the application's configuration file, usually in kdeglobals:

    [ContextMenus]
    ShowOnPress=true|false

ShowOnPress defines whether the menu shall be shown on mouse press or on mouse release.

The shortcut key to invoke the context menu is defined in the standard [Keys] section of the application configuration:

   [Keys]
   ...
   PopupContextMenu=Menu
   ...
The key can be configured with the standard keys module in the KDE control center.

If the popup menu is invoked with the keyboard shortcut, it's shown at the position of the micro focus hint of the widget ( QWidget::microFocusHint() ).

Definition at line 78 of file kcmenumngr.h.


Member Function Documentation

void KContextMenuManager::insert QWidget   widget,
QPopupMenu   popup
[static]
 

Makes popup a context popup menu for widget widget.

Ownership of the popup menu is not transferred to the context menu manager.

Definition at line 57 of file kcmenumngr.cpp.

References QObject::connect(), QObject::destroyed(), QPtrDict< QPopupMenu >::insert(), and menus.

Referenced by KEdit::installRBPopup().

bool KContextMenuManager::showOnButtonPress void    [static]
 

Use this method to get information about when a popup menu should be activated.

This can be useful if the popup menu is to be activated from a listview.

Returns:
true if the menu should be made visible on a button press or false after a button press-release sequence.

Definition at line 49 of file kcmenumngr.cpp.

References showOnPress.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:03 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001