1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:18:12 +00:00

Some work on window decorations.

This commit is contained in:
Andreas Kling 2018-10-11 23:14:51 +02:00
parent a4491e9630
commit a6e0577f30
4 changed files with 41 additions and 8 deletions

View file

@ -31,7 +31,7 @@ void WindowManager::paintWindowFrame(Widget& widget)
printf("WM: paintWindowFrame %s{%p}, rect: %d,%d %dx%d\n", widget.className(), &widget, widget.rect().x(), widget.rect().y(), widget.rect().width(), widget.rect().height());
static const int windowFrameWidth = 2;
static const int windowTitleBarHeight = 14;
static const int windowTitleBarHeight = 16;
Rect topRect {
widget.x() - windowFrameWidth,
@ -59,12 +59,25 @@ void WindowManager::paintWindowFrame(Widget& widget)
widget.height()
};
p.fillRect(topRect, Color(0x40, 0x40, 0xc0));
p.fillRect(bottomRect, Color(0x40, 0x40, 0xc0));
p.fillRect(leftRect, Color(0x40, 0x40, 0xc0));
p.fillRect(rightRect, Color(0x40, 0x40, 0xc0));
static const Color windowBorderColor(0x00, 0x00, 0x80);
static const Color windowTitleColor(0xff, 0xff, 0xff);
p.drawText(topRect, widget.windowTitle(), Painter::TextAlignment::Center, Color(255, 255, 255));
Rect borderRect {
topRect.x() - 1,
topRect.y() - 1,
topRect.width() + 2,
windowFrameWidth + windowTitleBarHeight + widget.height() + 4
};
p.drawRect(borderRect, Color(255, 255, 255));
borderRect.inflate(2, 2);
p.drawRect(borderRect, windowBorderColor);
p.fillRect(topRect, windowBorderColor);
p.fillRect(bottomRect, windowBorderColor);
p.fillRect(leftRect, windowBorderColor);
p.fillRect(rightRect, windowBorderColor);
p.drawText(topRect, widget.windowTitle(), Painter::TextAlignment::Center, windowTitleColor);
}
void WindowManager::addWindow(Widget& widget)