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
|
/*
knrangefilter.h
KNode, the KDE newsreader
Copyright (c) 1999-2001 the KNode authors.
See file AUTHORS for details
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
*/
#ifndef KNRANGEFILTER_H
#define KNRANGEFILTER_H
#include <tqgroupbox.h>
class TQLabel;
class KIntSpinBox;
class TQComboBox;
class TQCheckBox;
class KSimpleConfig;
class KNRangeFilter {
friend class KNRangeFilterWidget;
public:
KNRangeFilter() { op1=eq; op2=dis; val1=0; val2=0; enabled=false; }
~KNRangeFilter() {}
KNRangeFilter& operator=(const KNRangeFilter &nr)
{ val1=nr.val1; val2=nr.val2;
op1=nr.op1; op2=nr.op2;
enabled=nr.enabled;
return (*this); }
void load(KSimpleConfig *conf);
void save(KSimpleConfig *conf);
bool doFilter(int a);
protected:
enum Op { gt=0, gtoeq=1, eq=2, ltoeq=3, lt=4, dis=5 };
bool matchesOp(int v1, Op o, int v2);
int val1, val2;
Op op1, op2;
bool enabled;
};
//==================================================================================
class KNRangeFilterWidget : public TQGroupBox {
Q_OBJECT
public:
KNRangeFilterWidget(const TQString& value, int min, int max, TQWidget* parent, const TQString &unit=TQString());
~KNRangeFilterWidget();
KNRangeFilter filter();
void setFilter(KNRangeFilter &f);
void clear();
protected:
TQCheckBox *enabled;
TQLabel *des;
KIntSpinBox *val1, *val2;
TQComboBox *op1, *op2;
protected slots:
void slotEnabled(bool e);
void slotOp1Changed(int id);
void slotOp2Changed(int id);
};
#endif
|