00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _TDEPOPUP_H
00019 #define _TDEPOPUP_H "$Id$"
00020
00021 #define INCLUDE_MENUITEM_DEF
00022
00023 #include <tqpopupmenu.h>
00024 #include <kpixmapeffect.h>
00025 #include <kpixmap.h>
00026 #include <tdelibs_export.h>
00038 class TDEUI_EXPORT TDEPopupTitle : public TQWidget
00039 {
00040 Q_OBJECT
00041
00042 public:
00047 TDEPopupTitle(TQWidget *parent=0, const char *name=0);
00052 TDEPopupTitle(KPixmapEffect::GradientType gradient, const TQColor &color,
00053 const TQColor &textColor, TQWidget *parent=0,
00054 const char *name=0) KDE_DEPRECATED;
00059 TDEPopupTitle(const KPixmap &background, const TQColor &color,
00060 const TQColor &textColor, TQWidget *parent=0,
00061 const char *name=0) KDE_DEPRECATED;
00067 void setTitle(const TQString &text, const TQPixmap *icon=0);
00071 TQString title() const { return titleStr; }
00075 TQPixmap icon() const { return miniicon; }
00076
00077 TQSize sizeHint() const;
00078
00079 public slots:
00081 void setText( const TQString &text );
00083 void setIcon( const TQPixmap &pix );
00084
00085 protected:
00086 void calcSize();
00087 void paintEvent(TQPaintEvent *ev);
00088
00089
00090 KPixmapEffect::GradientType grType;
00091 TQString titleStr;
00092
00093 KPixmap fill;
00094 TQPixmap miniicon;
00095 TQColor fgColor, bgColor, grHigh, grLow;
00096 bool useGradient;
00097
00098 protected:
00099 virtual void virtual_hook( int id, void* data );
00100 private:
00101 class TDEPopupTitlePrivate;
00102 TDEPopupTitlePrivate *d;
00103 };
00104
00123 class TDEUI_EXPORT TDEPopupMenu : public TQPopupMenu {
00124 Q_OBJECT
00125
00126 public:
00130 TDEPopupMenu(TQWidget *parent=0, const char *name=0);
00131
00135 ~TDEPopupMenu();
00136
00140 int insertTitle(const TQString &text, int id=-1, int index=-1);
00144 int insertTitle(const TQPixmap &icon, const TQString &text, int id=-1,
00145 int index=-1);
00150 void changeTitle(int id, const TQString &text);
00154 void changeTitle(int id, const TQPixmap &icon, const TQString &text);
00160 TQString title(int id=-1) const;
00164 TQPixmap titlePixmap(int id) const;
00165
00180 void setKeyboardShortcutsEnabled(bool enable);
00181
00187 void setKeyboardShortcutsExecute(bool enable);
00188
00194 TDEPopupMenu(const TQString &title, TQWidget *parent=0, const char *name=0) KDE_DEPRECATED;
00195
00201 void setTitle(const TQString &title) KDE_DEPRECATED;
00202
00207 TQPopupMenu* contextMenu();
00208
00213 const TQPopupMenu* contextMenu() const;
00214
00219 void hideContextMenu();
00220
00225 static TDEPopupMenu* contextMenuFocus();
00226
00231 static int contextMenuFocusItem();
00232
00237 virtual void activateItemAt(int index);
00243 TQt::ButtonState state() const;
00244
00245 signals:
00253 void aboutToShowContextMenu(TDEPopupMenu* menu, int menuItem, TQPopupMenu* ctxMenu);
00254
00255 protected:
00256 virtual void closeEvent(TQCloseEvent *);
00257 virtual void keyPressEvent(TQKeyEvent* e);
00259 virtual void mouseReleaseEvent(TQMouseEvent* e);
00260 virtual void mousePressEvent(TQMouseEvent* e);
00261 virtual bool focusNextPrevChild( bool next );
00262 virtual void contextMenuEvent(TQContextMenuEvent *e);
00263 virtual void hideEvent(TQHideEvent*);
00264
00265 virtual void virtual_hook( int id, void* data );
00266
00267 protected slots:
00269 TQString underlineText(const TQString& text, uint length);
00271 void resetKeyboardVars(bool noMatches = false);
00272 void itemHighlighted(int whichItem);
00273 void showCtxMenu(TQPoint pos);
00274 void ctxMenuHiding();
00275 void ctxMenuHideShowingMenu();
00276
00277 private:
00278 class TDEPopupMenuPrivate;
00279 TDEPopupMenuPrivate *d;
00280 };
00281
00282 #endif