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 __applethandle_h__
00025 #define __applethandle_h__
00026
00027 #include <tqwidget.h>
00028 #include <tqpushbutton.h>
00029
00030 #include "container_applet.h"
00031 #include "simplebutton.h"
00032
00033 class TQBoxLayout;
00034 class TQTimer;
00035 class AppletHandleDrag;
00036 class AppletHandleButton;
00037
00038 class AppletHandle : public QWidget
00039 {
00040 Q_OBJECT
00041
00042 public:
00043 AppletHandle(AppletContainer* parent);
00044
00045 void resetLayout();
00046 void setFadeOutHandle(bool);
00047
00048 bool eventFilter (TQObject *, TQEvent *);
00049
00050 int widthForHeight( int h ) const;
00051 int heightForWidth( int w ) const;
00052
00053 void setPopupDirection(KPanelApplet::Direction);
00054 KPanelApplet::Direction popupDirection() const
00055 {
00056 return m_popupDirection;
00057 }
00058
00059 KPanelApplet::Orientation orientation() const
00060 {
00061 return m_applet->orientation();
00062 }
00063
00064 bool onMenuButton(const TQPoint& point) const;
00065
00066 signals:
00067 void moveApplet( const TQPoint& moveOffset );
00068 void showAppletMenu();
00069
00070 public slots:
00071 void toggleMenuButtonOff();
00072
00073 protected slots:
00074 void menuButtonPressed();
00075 void checkHandleHover();
00076
00077 private:
00078 AppletContainer* m_applet;
00079 TQBoxLayout* m_layout;
00080 AppletHandleDrag* m_dragBar;
00081 AppletHandleButton* m_menuButton;
00082 bool m_drawHandle;
00083 KPanelApplet::Direction m_popupDirection;
00084 TQTimer* m_handleHoverTimer;
00085 bool m_inside;
00086 };
00087
00088 class AppletHandleDrag : public QWidget
00089 {
00090 Q_OBJECT
00091
00092 public:
00093 AppletHandleDrag(AppletHandle* parent);
00094
00095 TQSize minimumSizeHint() const;
00096 TQSize minimumSize() const { return minimumSizeHint(); }
00097 TQSize sizeHint() const { return minimumSize(); }
00098 TQSizePolicy sizePolicy() const;
00099
00100 protected:
00101 void paintEvent( TQPaintEvent* );
00102 void enterEvent( TQEvent* );
00103 void leaveEvent( TQEvent* );
00104 const AppletHandle* m_parent;
00105
00106 private:
00107 bool m_inside;
00108 };
00109
00110 class AppletHandleButton : public SimpleArrowButton
00111 {
00112 Q_OBJECT
00113
00114 public:
00115 AppletHandleButton(AppletHandle *parent);
00116 TQSize minimumSizeHint() const;
00117 TQSize minimumSize() const { return minimumSizeHint(); }
00118 TQSize sizeHint() const { return minimumSize(); }
00119 TQSizePolicy sizePolicy() const;
00120
00121 private:
00122 bool m_moveMouse;
00123 const AppletHandle* m_parent;
00124 };
00125
00126 #endif