00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __quickbutton_h__
00025 #define __quickbutton_h__
00026
00027 #include <tqbutton.h>
00028 #include <tqpoint.h>
00029 #include <tqstring.h>
00030 #include <tqpixmap.h>
00031 #include <tqcursor.h>
00032
00033 #include <kickertip.h>
00034 #include <kicontheme.h>
00035 #include <kmimetype.h>
00036 #include <kpanelapplet.h>
00037 #include <kservice.h>
00038 #include <kurl.h>
00039
00040 #include "simplebutton.h"
00041
00042 class TQPopupMenu;
00043 class KAction;
00044 class KToggleAction;
00045
00046 class QuickURL {
00047 public:
00048 QuickURL(const TQString &u);
00049 KURL kurl() const {return _kurl;};
00050 TQString url() const {return _kurl.url();};
00051 TQString menuId() const {return _menuId;};
00052 TQString genericName() const { return m_genericName; }
00053 TQString name() const { return m_name; }
00054 KService::Ptr service() const {return _service;};
00055 void run() const;
00056 TQPixmap pixmap(mode_t _mode = 0, KIcon::Group _group = KIcon::Desktop,
00057 int _force_size = 0, int _state = 0, TQString * _path = 0L) const;
00058
00059 private:
00060 KURL _kurl;
00061 TQString _menuId;
00062 TQString m_genericName;
00063 TQString m_name;
00064 KService::Ptr _service;
00065 };
00066
00067
00068 class QuickButton: public SimpleButton, public KickerTip::Client {
00069 Q_OBJECT
00070
00071 public:
00072 enum { DEFAULT_ICON_DIM = 16 };
00073 enum { ICON_MARGIN = 1 };
00074 QuickButton(const TQString &u, KAction* configAction,
00075 TQWidget *parent=0, const char *name=0);
00076 ~QuickButton();
00077 TQString url() const;
00078 TQString menuId() const;
00079 TQPixmap icon() const{ return _icon;}
00080 bool sticky() { return m_sticky; }
00081 void setSticky(bool bSticky);
00082 void setPopupDirection(KPanelApplet::Direction d);
00083
00084 void setDragging(bool drag);
00085 void setEnableDrag(bool enable);
00086 void setDynamicModeEnabled(bool enabled);
00087 void flash();
00088
00089 signals:
00090 void removeApp(QuickButton *);
00091 void executed(TQString serviceStorageID);
00092 void stickyToggled(bool isSticky);
00093
00094 protected:
00095 void mousePressEvent(TQMouseEvent *e);
00096 void mouseMoveEvent(TQMouseEvent *e);
00097 void resizeEvent(TQResizeEvent *rsevent);
00098 void loadIcon();
00099 void updateKickerTip(KickerTip::Data &data);
00100
00101 protected slots:
00102 void slotIconChanged(int);
00103 void launch();
00104 void removeApp();
00105 void slotFlash();
00106 void slotStickyToggled(bool isSticky);
00107
00108 private:
00109 int m_flashCounter;
00110 QuickURL *_qurl;
00111 TQPoint _dragPos;
00112 TQPopupMenu *_popup;
00113 TQPixmap _icon, _iconh;
00114 TQCursor _oldCursor;
00115 bool _highlight, _changeCursorOverItem, _dragEnabled;
00116 int _iconDim;
00117 bool m_sticky;
00118 KToggleAction *m_stickyAction;
00119 int m_stickyId;
00120 KPanelApplet::Direction m_popupDirection;
00121 };
00122
00123 #endif
00124