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
|
/* Do not edit this file. It was automatically genarated. */
#ifndef HEADER_Meter
#define HEADER_Meter
/*
htop
(C) 2004 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Object.h"
#include "CRT.h"
#include "ListItem.h"
#include "String.h"
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include "debug.h"
#include <assert.h>
#define METER_BARBUFFER_LEN 128
#define METER_GRAPHBUFFER_LEN 128
typedef struct Meter_ Meter;
typedef void(*Method_Meter_setValues)(Meter*);
typedef void(*Method_Meter_draw)(Meter*, int, int, int);
typedef enum MeterMode_ {
UNSET,
BAR,
TEXT,
GRAPH,
LED,
LAST_METERMODE
} MeterMode;
struct Meter_ {
Object super;
int h;
int w;
Method_Meter_draw draw;
Method_Meter_setValues setValues;
int items;
int* attributes;
double* values;
double total;
char* caption;
char* name;
union {
RichString* rs;
char* c;
double* graph;
} displayBuffer;
MeterMode mode;
};
extern char* METER_CLASS;
Meter* Meter_new(char* name, char* caption, int items);
void Meter_init(Meter* this, char* name, char* caption, int items);
void Meter_delete(Object* cast);
void Meter_done(Meter* this);
#define DrawDot(a,y,c) do { \
attrset(a); \
mvaddstr(y, x+k, c); \
} while(0)
void Meter_setMode(Meter* this, MeterMode mode);
ListItem* Meter_toListItem(Meter* this);
#endif
|