Ide: AppPreview header now supports dark theme and fix minor rendering problem related to this class.

git-svn-id: svn://ultimatepp.org/upp/trunk@13080 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
klugier 2019-05-03 20:45:32 +00:00
parent e4e2759a5a
commit 452a60e97b

View file

@ -107,15 +107,17 @@ void AppPreview::Layout()
void AppPreview::Paint(Draw& w)
{
Size sz = GetSize();
Font fnt = CourierZ(12);
int y = 0;
int i = sb;
while(y < sz.cy) {
bool hdr = i < line.GetCount() && line[i].header;
w.DrawRect(0, y, sz.cx, fnt.GetCy(), hdr ? LtCyan : SColorPaper);
auto is_header = i < line.GetCount() && line[i].header;
auto font = is_header ? ArialZ(12).Bold().Italic() : CourierZ(12);
auto rect_color = is_header ? (IsDarkTheme() ? DarkTheme(LtCyan) : LtCyan) : SColorPaper;
w.DrawRect(0, y, sz.cx, font.GetCy(), rect_color);
if(i < line.GetCount())
w.DrawText(0, y, line[i].text, hdr ? ArialZ(12).Bold().Italic() : fnt, SColorText);
y += fnt.GetCy();
w.DrawText(0, y, line[i].text, font, SColorText);
y += font.GetCy();
i++;
}
}