Files
pip/utils/system_daemon/terminal_tile.cpp

45 lines
1.1 KiB
C++

#include "terminal_tile.h"
#include "piscreendrawer.h"
TileTerminal::TileTerminal(const PIString & n): PIScreenTile(n) {
focus_flags = PIScreenTypes::CanHasFocus;
size_policy = PIScreenTypes::Expanding;
lastp[0] = lastp[1] = lastp[2] = 0;
}
void TileTerminal::drawEvent(PIScreenDrawer * d) {
//piCout << "draw" << visible;
//PIVector<PIVector<PIScreenTypes::Cell> > c = term->content();
d->fillRect(x_, y_, x_ + width_, y_ + height_, cells);
}
bool TileTerminal::keyEvent(PIKbdListener::KeyEvent key) {
lastp[0] = lastp[1];
lastp[1] = lastp[2];
lastp[2] = char(key.key);
if (lastp[0] == '\e' && lastp[1] == '~' && lastp[2] == '.') {
closeRequest();
return true;
}
//piCout << "key";
/*if (!term) return false;
if (PITerminal::isSpecialKey(key.key)) term->write((PIKbdListener::SpecialKey)key.key, key.modifiers);
else {
PIByteArray ba;
ba << PIChar(key.key).toConcole1Byte();
term->write(ba);
}*/
keyPressed(key);
return true;
}
void TileTerminal::resizeEvent(int w, int h) {
/*if (!term) return;
term->resize(w, h);*/
resizeRequest();
}