kpopupmenu.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kpopupmenu.h

    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., 59 Temple Place - Suite 330,
    00016    Boston, MA 02111-1307, USA.
    00017 */
    00018 #ifndef _KPOPUP_H
    00019 #define _KPOPUP_H "$Id: kpopupmenu.h,v 1.18 2002/09/28 15:16:22 tjansen Exp $"
    00020
    00021 #define INCLUDE_MENUITEM_DEF
    00022
    00023 #include <qpopupmenu.h>
    00024 #include <kpixmapeffect.h>
    00025 #include <kpixmap.h>
    00026
    00037 class KPopupTitle : public QWidget
    00038 {
    00039     Q_OBJECT
    00040
    00041 public:
    00046     KPopupTitle(QWidget *parent=0, const char *name=0);
    00050     KPopupTitle(KPixmapEffect::GradientType gradient, const QColor &color,
    00051                 const QColor &textColor, QWidget *parent=0,
    00052                 const char *name=0);
    00056     KPopupTitle(const KPixmap &background, const QColor &color,
    00057                 const QColor &textColor, QWidget *parent=0,
    00058                 const char *name=0);
    00064     void setTitle(const QString &text, const QPixmap *icon=NULL);
    00068     QString title() const { return(titleStr); }
    00072     QPixmap icon() const { return(miniicon); }
    00073
    00074     QSize sizeHint() const;
    00075
    00076 public slots:
    00078     void setText( const QString &text );
    00080     void setIcon( const QPixmap &pix );
    00081
    00082 protected:
    00083     void paintEvent(QPaintEvent *ev);
    00084
    00085     KPixmapEffect::GradientType grType;
    00086     QString titleStr;
    00087     KPixmap fill;
    00088     QPixmap miniicon;
    00089     QColor fgColor, bgColor, grHigh, grLow;
    00090     bool useGradient;
    00091
    00092 protected:
    00093     virtual void virtual_hook( int id, void* data );
    00094 private:
    00095     class KPopupTitlePrivate;
    00096     KPopupTitlePrivate *d;
    00097 };
    00098
    00116 class KPopupMenu : public QPopupMenu {
    00117     Q_OBJECT
    00118 public:
    00122     KPopupMenu(QWidget *parent=0, const char *name=0);
    00123
    00127     ~KPopupMenu();
    00128
    00132     int insertTitle(const QString &text, int id=-1, int index=-1);
    00136     int insertTitle(const QPixmap &icon, const QString &text, int id=-1,
    00137                     int index=-1);
    00142     void changeTitle(int id, const QString &text);
    00146     void changeTitle(int id, const QPixmap &icon, const QString &text);
    00152     QString title(int id=-1) const;
    00156     QPixmap titlePixmap(int id) const;
    00157
    00172     void setKeyboardShortcutsEnabled(bool enable);
    00173
    00179     void setKeyboardShortcutsExecute(bool enable);
    00180
    00185     KPopupMenu(const QString &title, QWidget *parent=0, const char *name=0);
    00190     void setTitle(const QString &title);
    00191
    00192 protected:
    00193     virtual void closeEvent(QCloseEvent *);
    00194     virtual void keyPressEvent(QKeyEvent* e);
    00195
    00196     virtual void virtual_hook( int id, void* data );
    00197
    00198 protected slots:
    00200     QString underlineText(const QString& text, uint length);
    00202     void resetKeyboardVars(bool noMatches = false);
    00203
    00204 private:
    00205     class KPopupMenuPrivate;
    00206     KPopupMenuPrivate *d;
    00207 };
    00208
    00209 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:34 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001