summaryrefslogtreecommitdiffstats
path: root/kicker-applets/ktimemon/timemon.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /kicker-applets/ktimemon/timemon.h
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker-applets/ktimemon/timemon.h')
-rw-r--r--kicker-applets/ktimemon/timemon.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/kicker-applets/ktimemon/timemon.h b/kicker-applets/ktimemon/timemon.h
new file mode 100644
index 0000000..8f5664c
--- /dev/null
+++ b/kicker-applets/ktimemon/timemon.h
@@ -0,0 +1,107 @@
+/* -*- C++ -*- */
+
+/**********************************************************************/
+/* TimeMon (c) 1994 Helmut Maierhofer */
+/* KDE-ified M. Maierhofer 1998 */
+/* maintained by Dirk A. Mueller <mueller@kde.org */
+/**********************************************************************/
+
+/*
+ * timemon.h
+ *
+ * Definitions for the timemon widget.
+ */
+
+#ifndef TIMEMON_H
+#define TIMEMON_H
+
+#include <qtooltip.h>
+#include <kiconloader.h>
+#include <kpanelapplet.h>
+
+// -- global constants ---------------------------------------------------
+
+const int MAX_MOUSE_ACTIONS = 3; // event handlers for the three buttons only
+
+// -- forward declaration ------------------------------------------------
+class KSample;
+class KConfDialog;
+class QPaintEvent;
+class QMouseEvent;
+class QPainter;
+class KProcess;
+class KShellProcess;
+class KHelpMenu;
+class KPopupMenu;
+
+// -- KTimeMon declaration -----------------------------------------------
+
+/*
+ * KTimeMon
+ *
+ * This is the main widget of the application. It handles the configuration
+ * dialog and may have an associated KTimeMonWidget in the panel (in which
+ * case it hides itself).
+ */
+
+class KTimeMon : public KPanelApplet, QToolTip {
+ Q_OBJECT
+public:
+ enum MouseAction { NOTHING, SWITCH, MENU, COMMAND };
+
+ KTimeMon(const QString& configFile, Type t = Normal, int actions = 0,
+ QWidget *parent = 0, const char *name = 0);
+ virtual ~KTimeMon();
+
+ void writeConfiguration(); // write back the configuration data
+
+ // reimplemented from KPanelApplet
+ virtual int widthForHeight(int height) const;
+ virtual int heightForWidth(int width) const;
+
+ virtual void preferences();
+
+ void stop();
+ void cont();
+
+public slots:
+ void timeout(); // timer expired
+ void save(); // session management callback
+ void apply(); // apply configuration information
+
+protected:
+ virtual void maybeTip(const QPoint&);
+ virtual void mousePressEvent(QMouseEvent *event);
+ virtual void updateConfig(KConfDialog *d);
+ virtual void paintEvent(QPaintEvent *event);
+
+private slots: // called from the menu
+ void configure(); // show the configuration dialog
+ void orientation(); // switch vertical/horizontal orientation
+ void commandStderr(KProcess *proc, char *buffer, int length);
+
+private:
+ void runCommand(int index);
+ void paintRect(int x, int y, int w, int h, QColor c, QPainter *p);
+
+ unsigned interval;
+ bool autoScale;
+ unsigned pageScale, swapScale, ctxScale;
+ KPopupMenu* menu;
+ KHelpMenu* hmenu;
+ QTimer* timer;
+ KConfDialog *configDialog;
+ MouseAction mouseAction[MAX_MOUSE_ACTIONS];
+ QString mouseActionCommand[MAX_MOUSE_ACTIONS];
+ KShellProcess *bgProcess;
+
+ KSample *sample;
+ QColor kernelColour, userColour, niceColour, iowaitColour;
+ QColor usedColour, buffersColour, cachedColour, mkernelColour;
+ QColor swapColour, bgColour;
+ bool vertical, tooltip;
+
+ friend class KConfDialog;
+};
+
+#endif // TIMEMON_H