blob: e494078d30f15b23c8105739b4c95eed0bda1cee (
plain)
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
|
#include <errno.h>
#include <lib/gui/multipage.h>
#include <lib/gui/ewidget.h>
eMultipage::eMultipage()
{
}
int eMultipage::prev()
{
if (list.current() == list.begin())
return -ENOENT;
if (list.current() != list.end())
list.current()->hide();
list.prev();
list.current()->show();
return 0;
}
int eMultipage::next()
{
if (list.current() == *--list.end())
return -ENOENT;
list.current()->hide();
list.next();
if (list.current() == list.end())
return 0;
list.current()->show();
return 0;
}
void eMultipage::set(eWidget *widget)
{
if (list.current() == widget)
return;
if (list.current() != list.end())
list.current()->hide();
list.setCurrent(widget);
if (list.current() != list.end())
list.current()->show();
}
void eMultipage::first()
{
if (list.current() == list.begin())
return;
if (list.current() != list.end())
list.current()->hide();
list.first();
if (list.current() != list.end())
list.current()->show();
}
int eMultipage::at()
{
int num=0;
for (ePtrList<eWidget>::iterator i(list.begin()); (i != list.end()) && (i != list.current()); ++i, ++num) ;
return num;
}
void eMultipage::addPage(eWidget *page)
{
list.push_back(page);
}
|