git-svn-id: svn://db.shs.com.ru/pip@266 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-09-17 22:05:54 +00:00
parent 362c6bf505
commit be6aaf26a4
7 changed files with 54 additions and 12 deletions

View File

@@ -105,8 +105,15 @@ void TileScrollBar::sizeHint(int & w, int & h) const {
void TileScrollBar::drawEvent(PIScreenDrawer * d) {
line_char = d->artChar(direction == Vertical ? PIScreenDrawer::LineVertical : PIScreenDrawer::LineHorizontal);
d->fillRect(x_, y_, x_ + width_, y_ + height_, line_char, Green);
if ()
d->drawPixel(cx, y_ + piRound(float(cur) / (content.size_s() - 1) * (lhei - 1)) + 1, ' ', Green, Green);
if (value_ >= minimum_ && value_ <= maximum_) {
if (direction == Vertical) {
int c = piRoundf((float(value_ - minimum_) / (maximum_ - minimum_)) * (height_ - 1));
d->drawLine(x_, y_ + c, x_ + width_ - 1, y_ + c, ' ', Green, Green);
} else {
int c = piRoundf((float(value_ - minimum_) / (maximum_ - minimum_)) * (width_ - 1));
d->drawLine(x_ + c, y_, x_ + c, y_ + height_ - 1, ' ', Green, Green);
}
}
}
@@ -117,6 +124,14 @@ TileList::TileList(const PIString & n): PIScreenTile(n) {
focus_flags = CanHasFocus | NextByArrowsHorizontal | NextByTab;
lhei = offset = cur = 0;
selection_mode = NoSelection;
scroll = new TileScrollBar();
scroll->size_policy = Ignore;
addTile(scroll);
}
TileList::~TileList() {
delete scroll;
}
@@ -128,6 +143,14 @@ void TileList::sizeHint(int & w, int & h) const {
}
void TileList::resizeEvent(int w, int h) {
scroll->x_ = x_ + width_ - 1;
scroll->y_ = y_;
scroll->width_ = 1;
scroll->height_ = height_;
}
void TileList::drawEvent(PIScreenDrawer * d) {
lhei = height_ - 2;
//int osp = piMini(3, lhei / 4);
@@ -155,11 +178,13 @@ void TileList::drawEvent(PIScreenDrawer * d) {
}
d->drawText(rx, y_ + i - is + 1, r.first, cc, sel ? Blue : Default, cf);
}
int cx = x_ + width_ - 1;
scroll->setMaximum(piMaxi(0, content.size_s() - 1));
scroll->setValue(cur);
/*int cx = x_ + width_ - 1;
d->drawLine(cx, y_ + 1, cx, y_ + height_ - 2, vert_line, Green);
if (content.size_s() > 1)
d->drawPixel(cx, y_ + piRound(float(cur) / (content.size_s() - 1) * (lhei - 1)) + 1, ' ', Green, Green);
if (ie < content.size_s()) d->drawText(x_, y_ + height_ - 1, PIString(" \\/ ").repeat(width_ / 4), Green, Default, Bold);
if (ie < content.size_s()) d->drawText(x_, y_ + height_ - 1, PIString(" \\/ ").repeat(width_ / 4), Green, Default, Bold);*/
}