text_ival_box.h
633 Bytes
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
#include "ival_box.h"
#include <iostream>
using namespace std;
#include <QtGui>
class Text_ival_box : public Ival_box {
private:
int lastval = 0;
int val = 0;
public:
virtual int get_value()
{
cin >> val;
lastval = val;
return val;
};
virtual void set_value(int i)
{
val = i;
};
virtual void reset_value(int i)
{
val = i;
lastval = i;
};
virtual void prompt()
{
cout << "Current value=" << val << " Input new value:" << endl;
};
virtual bool was_changed() const
{
return val != lastval;
};
};