Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / ksystraycmd / ksystraycmd.h
blob6ae124ecffb8646189e650ace639740cc4142aaa
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);
58 protected:
59 bool startClient();
60 void checkExistingWindows();
62 void mousePressEvent( QMouseEvent *e );
64 private:
65 QString command;
66 QString window;
67 QString tooltip;
68 bool isVisible;
69 bool lazyStart;
70 bool noquit;
71 bool quitOnHide;
72 bool onTop; ///< tells if window must stay on top or not
73 bool ownIcon; ///< tells if the ksystraycmd icon must be used in systray
75 WId win;
76 K3ShellProcess *client;
77 QString errStr;
79 /** Memorized 'top' position of the window*/
80 int top;
81 /** Memorized 'left' position of the window*/
82 int left;
85 #endif // KSYSTRAYCMD_H