6 using namespace widgets
;
8 void textbox::feed(set
<InterfaceKey
> &input
) {
10 if (input
.count(INTERFACEKEY_STRING_A000
) && text
.size())
11 text
.resize(text
.size() - 1);
12 // Hopefully we'll never get multiple characters in one input set,
13 // but it's possible. We deal with this by inserting them in
14 // alphabetical order.
15 for (set
<InterfaceKey
>::iterator it
= input
.lower_bound(INTERFACEKEY_STRING_A001
);
16 it
!= input
.end() && *it
<= INTERFACEKEY_STRING_A255
;
22 char c
= *it
- INTERFACEKEY_STRING_A000
;
27 void textbox::render(int x1
, int x2
, int y1
, int y2
) {
28 // We need to do some kind of line-breaking for multi-line text
29 // entry boxes. This shall be implemented at need, and there is none
32 gps
.erasescreen_rect(x1
,x2
,y1
,y2
);
34 gps
.changecolor(7,0,keep
);
35 int width
= x2
- x1
+ 1;
36 int start
= text
.length() - width
;
37 gps
.addst(text
.substr(MAX(start
,0)));