Draw scrollbars, I like where this is going

This commit is contained in:
Miguel de Icaza
2018-01-25 23:09:17 -05:00
parent 8ef6c140c5
commit 06e8c5c540
4 changed files with 121 additions and 7 deletions

View File

@@ -98,10 +98,48 @@ namespace Terminal.Gui {
{
var oldClip = ClipToBounds ();
base.Redraw(region);
Driver.SetAttribute (ColorScheme.Normal);
Attribute last = ColorScheme.Normal;
Driver.SetAttribute (last);
void SetColor (Attribute a)
{
if (a != last)
Driver.SetAttribute (a);
last = a;
}
DrawFrame (Bounds);
Driver.Clip = oldClip;
if (true || ShowVerticalScrollIndicator) {
var bh = Bounds.Height;
var by1 = contentOffset.Y * bh/ contentSize.Height;
var by2 = (contentOffset.Y+bh) * bh/ contentSize.Height;
for (int y = 0; y < bh; y++) {
Move (Bounds.Width - 1, y);
if (y < by1 || y > by2)
Driver.AddSpecial (SpecialChar.Stipple);
else
Driver.AddSpecial (SpecialChar.Diamond);
}
}
if (true || ShowHorizontalScrollIndicator){
var bw = Bounds.Width;
var bx1 = contentOffset.X * bw / contentSize.Width;
var bx2 = (contentOffset.X + bw) * bw / contentSize.Width;
Move (0, Bounds.Height - 1);
for (int x = 0; x < bw; x++) {
if (x < bx1 || x > bx2){
SetColor (ColorScheme.Normal);
Driver.AddSpecial (SpecialChar.Stipple);
} else {
// Driver.AddSpecial (SpecialChar.Diamond);
SetColor (ColorScheme.Focus);
Driver.AddSpecial (SpecialChar.Stipple);
}
}
}
}
}
}