00001
00002
00003 #ifndef KSYSTRAYCMD_H
00004 #define KSYSTRAYCMD_H
00005
00006 #include <tqlabel.h>
00007 #include <kwin.h>
00008
00009 class KShellProcess;
00010 class KWinModule;
00011
00017 class KSysTrayCmd : public QLabel
00018 {
00019 Q_OBJECT
00020 public:
00021 KSysTrayCmd();
00022 ~KSysTrayCmd();
00023
00024 void setWindow( WId w ) { win = w; }
00025 void setCommand( const TQString &cmd ) { command = cmd; }
00026 void setPattern( const TQString ®exp ) { window = regexp; }
00027 void setStartOnShow( bool enable ) { lazyStart = enable; isVisible = !enable; }
00028 void setNoQuit( bool enable ) { noquit = enable; }
00029 void setQuitOnHide( bool enable ) { quitOnHide = enable; }
00030 void setOnTop( bool enable ) { onTop = enable; }
00031 void setOwnIcon( bool enable ) { ownIcon = enable; }
00032 void setDefaultTip( const TQString &tip ) { tooltip = tip; }
00033 bool hasTargetWindow() const { return (win != 0); }
00034 bool hasRunningClient() const { return (client != 0); }
00035 const TQString &errorMsg() const { return errStr; }
00036
00037 bool start();
00038
00039 static WId findRealWindow( WId w, int depth = 0 );
00040
00041 public slots:
00042 void refresh();
00043
00044 void showWindow();
00045 void hideWindow();
00046 void toggleWindow() { if ( isVisible ) hideWindow(); else showWindow(); }
00047
00048 void setTargetWindow( WId w );
00049 void execContextMenu( const TQPoint &pos );
00050
00051 void quit();
00052 void quitClient();
00053
00054 protected slots:
00055 void clientExited();
00056
00057 void windowAdded(WId w);
00058 void windowChanged(WId w);
00059
00060 protected:
00061 bool startClient();
00062 void checkExistingWindows();
00063 void setTargetWindow( const KWin::WindowInfo &info );
00064
00065 void mousePressEvent( TQMouseEvent *e );
00066
00067 private:
00068 TQString command;
00069 TQString window;
00070 TQString tooltip;
00071 bool isVisible;
00072 bool lazyStart;
00073 bool noquit;
00074 bool quitOnHide;
00075 bool onTop;
00076 bool ownIcon;
00077
00078 WId win;
00079 KShellProcess *client;
00080 KWinModule *kwinmodule;
00081 TQString errStr;
00082
00084 int top;
00086 int left;
00087 };
00088
00089 #endif // KSYSTRAYCMD_H