kpopupmenu.h
/* This file is part of the KDE libraries
Copyright (C) 2000 Daniel M. Duley <mosfet@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 _KPOPUP_H
#define _KPOPUP_H "$Id: kpopupmenu.h 465272 2005-09-29 09:47:40Z mueller $"
#define INCLUDE_MENUITEM_DEF
#include <qpopupmenu.h>
#include <kpixmapeffect.h>
#include <kpixmap.h>
#include <kdelibs_export.h>
class KDEUI_EXPORT KPopupTitle : public QWidget
{
Q_OBJECT
public:
KPopupTitle(QWidget *parent=0, const char *name=0);
KPopupTitle(KPixmapEffect::GradientType gradient, const QColor &color,
const QColor &textColor, QWidget *parent=0,
const char *name=0) KDE_DEPRECATED;
KPopupTitle(const KPixmap &background, const QColor &color,
const QColor &textColor, QWidget *parent=0,
const char *name=0) KDE_DEPRECATED;
void setTitle(const QString &text, const QPixmap *icon=0);
QString title() const { return titleStr; }
QPixmap icon() const { return miniicon; }
QSize sizeHint() const;
public slots:
void setText( const QString &text );
void setIcon( const QPixmap &pix );
protected:
void calcSize();
void paintEvent(QPaintEvent *ev);
// Remove in KDE4
KPixmapEffect::GradientType grType;
QString titleStr;
// Remove in KDE4
KPixmap fill;
QPixmap miniicon;
QColor fgColor, bgColor, grHigh, grLow;
bool useGradient;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KPopupTitlePrivate;
KPopupTitlePrivate *d;
};
class KDEUI_EXPORT KPopupMenu : public QPopupMenu {
Q_OBJECT
public:
KPopupMenu(QWidget *parent=0, const char *name=0);
~KPopupMenu();
int insertTitle(const QString &text, int id=-1, int index=-1);
int insertTitle(const QPixmap &icon, const QString &text, int id=-1,
int index=-1);
void changeTitle(int id, const QString &text);
void changeTitle(int id, const QPixmap &icon, const QString &text);
QString title(int id=-1) const;
QPixmap titlePixmap(int id) const;
void setKeyboardShortcutsEnabled(bool enable);
void setKeyboardShortcutsExecute(bool enable);
KPopupMenu(const QString &title, QWidget *parent=0, const char *name=0) KDE_DEPRECATED;
void setTitle(const QString &title) KDE_DEPRECATED;
QPopupMenu* contextMenu();
const QPopupMenu* contextMenu() const;
void hideContextMenu();
static KPopupMenu* contextMenuFocus();
static int contextMenuFocusItem();
virtual void activateItemAt(int index);
Qt::ButtonState state() const;
signals:
void aboutToShowContextMenu(KPopupMenu* menu, int menuItem, QPopupMenu* 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*);
virtual void virtual_hook( int id, void* data );
protected slots:
QString underlineText(const QString& text, uint length);
void resetKeyboardVars(bool noMatches = false);
void itemHighlighted(int whichItem);
void showCtxMenu(QPoint pos);
void ctxMenuHiding();
void ctxMenuHideShowingMenu();
private:
class KPopupMenuPrivate;
KPopupMenuPrivate *d;
};
#endif
KPixmap
KPopupTitle::title
QString title() const
Returns the current title.
Definition: kpopupmenu.h:71
KPopupTitle::icon
QPixmap icon() const
Returns the current icon.
Definition: kpopupmenu.h:75
KPopupTitle
KPopupMenu title widget.
Definition: kpopupmenu.h:38

KDE Home | KDE Accessibility Home | Description of Access Keys