1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/* -*- 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 <tqtooltip.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 TQPaintEvent;
class TQMouseEvent;
class TQPainter;
class TDEProcess;
class KShellProcess;
class KHelpMenu;
class TDEPopupMenu;
// -- 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, TQToolTip {
Q_OBJECT
public:
enum MouseAction { NOTHING, SWITCH, MENU, COMMAND };
KTimeMon(const TQString& configFile, Type t = Normal, int actions = 0,
TQWidget *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 TQPoint&);
virtual void mousePressEvent(TQMouseEvent *event);
virtual void updateConfig(KConfDialog *d);
virtual void paintEvent(TQPaintEvent *event);
private slots: // called from the menu
void configure(); // show the configuration dialog
void orientation(); // switch vertical/horizontal orientation
void commandStderr(TDEProcess *proc, char *buffer, int length);
private:
void runCommand(int index);
void paintRect(int x, int y, int w, int h, TQColor c, TQPainter *p);
unsigned interval;
bool autoScale;
unsigned pageScale, swapScale, ctxScale;
TDEPopupMenu* menu;
KHelpMenu* hmenu;
TQTimer* timer;
KConfDialog *configDialog;
MouseAction mouseAction[MAX_MOUSE_ACTIONS];
TQString mouseActionCommand[MAX_MOUSE_ACTIONS];
KShellProcess *bgProcess;
KSample *sample;
TQColor kernelColour, userColour, niceColour, iowaitColour;
TQColor usedColour, buffersColour, cachedColour, mkernelColour;
TQColor swapColour, bgColour;
bool vertical, tooltip;
friend class KConfDialog;
};
#endif // TIMEMON_H
|