00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __knewbutton_h__
00027 #define __knewbutton_h__
00028
00029 #include "kbutton.h"
00030
00031 #include <tqmovie.h>
00032 #include <tqpoint.h>
00033
00037 class KNewButton : public KButton
00038 {
00039 Q_OBJECT
00040
00041 public:
00042 KNewButton( TQWidget *parent );
00043 ~KNewButton();
00044
00045 static KNewButton *self() { return m_self; }
00046
00047 void loadConfig( const KConfigGroup& config );
00048
00049 virtual const TQPixmap& labelIcon() const;
00050
00051 virtual int widthForHeight(int height) const;
00052 virtual int preferredDimension(int panelDim) const;
00053 virtual int heightForWidth(int width) const;
00054
00055 TQColor borderColor() const;
00056
00057 virtual void setPopupDirection(KPanelApplet::Direction d);
00058
00059 private slots:
00060 void slotStatus(int);
00061 void slotSetSize(const TQSize&);
00062 void slotStopAnimation();
00063 void rewindMovie();
00064 void updateMovie();
00065
00066 protected:
00067 virtual void show();
00068 virtual void slotExecMenu();
00069 virtual TQString tileName() { return "KMenu"; }
00070 virtual TQString defaultIcon() const { return "go"; }
00071
00072 virtual void enterEvent(TQEvent* e);
00073 virtual void leaveEvent(TQEvent* e);
00074 virtual void mouseMoveEvent(TQMouseEvent* e);
00075 virtual void dragEnterEvent(TQDragEnterEvent*);
00076 virtual void dragLeaveEvent(TQDragLeaveEvent*);
00077 virtual bool eventFilter(TQObject *, TQEvent *);
00078 void timerEvent(TQTimerEvent*);
00079
00080 private:
00081 void drawEye();
00082 double buttonScaleFactor(const TQSize& s) const;
00083
00084 TQMovie* m_movie;
00085 TQPixmap m_active_pixmap;
00086 TQPoint m_oldPos;
00087 TQSize m_iconSize;
00088 TQRect m_sloppyRegion;
00089 int m_hoverTimer;
00090 int m_openTimer;
00091 bool m_active;
00092 bool m_mouseInside;
00093 bool m_drag;
00094
00095 static KNewButton *m_self;
00096 };
00097
00098 #endif