add more spacing
[personal-kdebase.git] / workspace / ksystraycmd / ksystraycmd.h
blobaa30b6cae4620d6a82ece95fdf0cec234f1145f8
1 // -*- c++ -*-
3 #ifndef KSYSTRAYCMD_H
4 #define KSYSTRAYCMD_H
6 #include <KSystemTrayIcon>
8 class K3ShellProcess;
10 /**
11 * Provides a system tray icon for a normal window.
13 * @author Richard Moore, rich@kde.org
15 class KSysTrayCmd : public KSystemTrayIcon
17 Q_OBJECT
18 public:
19 KSysTrayCmd();
20 ~KSysTrayCmd();
22 void setWindow( WId w ) { win = w; }
23 void setCommand( const QString &cmd ) { command = cmd; }
24 void setPattern( const QString &regexp ) { window = regexp; }
25 void setStartOnShow( bool enable ) { lazyStart = enable; isVisible = !enable; }
26 void setNoQuit( bool enable ) { noquit = enable; }
27 void setQuitOnHide( bool enable ) { quitOnHide = enable; }
28 void setOnTop( bool enable ) { onTop = enable; }
29 void setOwnIcon( bool enable ) { ownIcon = enable; }
30 void setDefaultTip( const QString &tip ) { tooltip = tip; }
31 bool hasTargetWindow() const { return (win != 0); }
32 bool hasRunningClient() const { return (client != 0); }
33 const QString &errorMsg() const { return errStr; }
35 bool start();
37 static WId findRealWindow( WId w, int depth = 0 );
39 public Q_SLOTS:
40 void refresh();
42 void showWindow();
43 void hideWindow();
44 void toggleWindow() { if ( isVisible ) hideWindow(); else showWindow(); }
46 void setTargetWindow( WId w );
47 void execContextMenu( const QPoint &pos );
49 void quit();
50 void quitClient();
52 protected Q_SLOTS:
53 void clientExited();
55 void windowAdded(WId w);
56 void windowChanged(WId w);
57 void mousePressEvent(QSystemTrayIcon::ActivationReason reason);
59 protected:
60 bool startClient();
61 void checkExistingWindows();
63 private:
64 QString command;
65 QString window;
66 QString tooltip;
67 bool isVisible;
68 bool lazyStart;
69 bool noquit;
70 bool quitOnHide;
71 bool onTop; ///< tells if window must stay on top or not
72 bool ownIcon; ///< tells if the ksystraycmd icon must be used in systray
74 WId win;
75 K3ShellProcess *client;
76 QString errStr;
78 /** Memorized 'top' position of the window*/
79 int top;
80 /** Memorized 'left' position of the window*/
81 int left;
84 #endif // KSYSTRAYCMD_H