TilePICoutix
git-svn-id: svn://db.shs.com.ru/pip@45 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -383,3 +383,40 @@ void TileProgress::drawEvent(PIScreenDrawer * d) {
|
||||
d->drawText(x + sx + fw, y, s.cutLeft(fw), Black, Transparent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TilePICout::TilePICout(const PIString & n): TileList(n) {
|
||||
max_lines = 1024;
|
||||
selection_mode = TileList::SingleSelection;
|
||||
PICout::setBufferActive(true);
|
||||
}
|
||||
|
||||
|
||||
void TilePICout::drawEvent(PIScreenDrawer * d) {
|
||||
PIString out = PICout::buffer(true);
|
||||
if (!out.isEmpty()) {
|
||||
PIStringList l = out.split("\n");
|
||||
bool scroll = (cur == content.size_s() - 1) || !has_focus;
|
||||
piForeachC (PIString & s, l)
|
||||
content << TileList::Row(s, format);
|
||||
if (content.size_s() > max_lines)
|
||||
content.remove(0, content.size_s() - max_lines);
|
||||
if (scroll) {
|
||||
offset = piMaxi(0, content.size_s() - lhei);
|
||||
cur = content.size_s() - 1;
|
||||
}
|
||||
}
|
||||
TileList::drawEvent(d);
|
||||
}
|
||||
|
||||
|
||||
bool TilePICout::keyEvent(PIKbdListener::KeyEvent key) {
|
||||
if (key.key == 'C') {
|
||||
content.clear();
|
||||
cur = offset = 0;
|
||||
return true;
|
||||
}
|
||||
return TileList::keyEvent(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user