Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opopupmenu.h

Go to the documentation of this file.
00001 //FIXME what is ODE? ODE Desktop Environemt? -zecke
00002 //FIXME do we need titles? space is limited that is only eyecandy? -zecke
00003 //FIXME keyboard navigation is also not that popular on a PDA might be with a keyboard (tuxphone) -zecke
00004 /* This file is part of the ODE libraries
00005    Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License version 2 as published by the Free Software Foundation.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
00020 */
00021 #ifndef _OPOPUP_H
00022 #define _OPOPUP_H
00023 
00024 #define INCLUDE_MENUITEM_DEF
00025 
00026 /* QT */
00027 
00028 #include <qpopupmenu.h>
00029 
00030 /* OPIE */
00031 
00032 #include <opie2/opixmapeffect.h>
00033 
00034 namespace Opie {
00035 namespace Ui   {
00046 class OPopupTitle : public QWidget
00047 {
00048     Q_OBJECT
00049 
00050 public:
00055     OPopupTitle(QWidget *parent=0, const char *name=0);
00060     OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color,
00061                 const QColor &textColor, QWidget *parent=0,
00062                 const char *name=0);
00067     OPopupTitle(const OPixmap &background, const QColor &color,
00068                 const QColor &textColor, QWidget *parent=0,
00069                 const char *name=0);
00075     void setTitle(const QString &text, const QPixmap *icon=NULL);
00079     QString title() const { return(titleStr); }
00083     QPixmap icon() const { return(miniicon); }
00084 
00085     QSize sizeHint() const;
00086 
00087 public slots:
00089     void setText( const QString &text );
00091     void setIcon( const QPixmap &pix );
00092 
00093 protected:
00094     void paintEvent(QPaintEvent *ev);
00095 
00096     QString titleStr;
00097     QPixmap miniicon;
00098     
00099     // Remove in KDE4
00100     OPixmapEffect::GradientType grType;
00101     QPixmap fill;
00102     QColor fgColor, bgColor, grHigh, grLow;
00103     bool useGradient;
00104 
00105 protected:
00106     virtual void virtual_hook( int id, void* data );
00107 private:
00108     class OPopupTitlePrivate;
00109     OPopupTitlePrivate *d;
00110 };
00111 
00129 class OPopupMenu : public QPopupMenu {
00130     Q_OBJECT
00131 public:
00135     OPopupMenu(QWidget *parent=0, const char *name=0);
00136 
00140     ~OPopupMenu();
00141 
00145     int insertTitle(const QString &text, int id=-1, int index=-1);
00149     int insertTitle(const QPixmap &icon, const QString &text, int id=-1,
00150                     int index=-1);
00155     void changeTitle(int id, const QString &text);
00159     void changeTitle(int id, const QPixmap &icon, const QString &text);
00165     QString title(int id=-1) const;
00169     QPixmap titlePixmap(int id) const;
00170 
00185     void setKeyboardShortcutsEnabled(bool enable);
00186 
00192     void setKeyboardShortcutsExecute(bool enable);
00193 
00198     OPopupMenu(const QString &title, QWidget *parent=0, const char *name=0);
00203     void setTitle(const QString &title);
00204 
00209     QPopupMenu* contextMenu();
00210 
00215     void cancelContextMenuShow();
00216 
00221     static OPopupMenu* contextMenuFocus();
00222 
00227     static int contextMenuFocusItem();
00228 
00229 signals:
00237     void aboutToShowContextMenu(Opie::Ui::OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu);
00238 
00239 protected:
00240     virtual void closeEvent(QCloseEvent *);
00241     virtual void keyPressEvent(QKeyEvent* e);
00242     virtual bool eventFilter(QObject* obj, QEvent* event);
00243     virtual void hideEvent(QHideEvent*);
00244 
00245     virtual void virtual_hook( int id, void* data );
00246 
00247 protected slots:
00249     QString underlineText(const QString& text, uint length);
00251     void resetKeyboardVars(bool noMatches = false);
00252     void itemHighlighted(int whichItem);
00253     void showCtxMenu(QPoint pos);
00254     void ctxMenuHiding();
00255 
00256 private:
00257     class OPopupMenuPrivate;
00258     OPopupMenuPrivate *d;
00259 };
00260 
00261 }
00262 }
00263 
00264 #endif

Generated on Sat Nov 5 16:16:27 2005 for OPIE by  doxygen 1.4.2