diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-28 18:52:03 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-28 18:52:03 +0100 |
commit | f939fb7eb7207f62d3e82f14e5532bb5af381cda (patch) | |
tree | 4de6807b0f09fd02a28a46351f8dd9e2bac72b8e /LibGUI | |
parent | 6edcf2f16ec0c03e517533a9ad8d9e0ebd5ea9d2 (diff) | |
download | serenity-f939fb7eb7207f62d3e82f14e5532bb5af381cda.zip |
Userland: Add a simple GFrame testing window to guitest2.
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GFrame.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/LibGUI/GFrame.cpp b/LibGUI/GFrame.cpp index 0426b519ce..bc18c44295 100644 --- a/LibGUI/GFrame.cpp +++ b/LibGUI/GFrame.cpp @@ -19,18 +19,11 @@ void GFrame::paint_event(GPaintEvent& event) GPainter painter(*this); painter.set_clip_rect(event.rect()); - auto rect = this->rect(); - Color top_left_color; Color bottom_right_color; - - Color dark_shade = Color::from_rgb(0x808080); + Color dark_shade = m_shape == Shape::Container ? Color::from_rgb(0x404040) : Color::from_rgb(0x808080); Color light_shade = Color::from_rgb(0xffffff); - if (m_shape == Shape::Container) { - dark_shade = Color::from_rgb(0x404040); - } - if (m_shadow == Shadow::Raised) { top_left_color = light_shade; bottom_right_color = dark_shade; @@ -42,9 +35,8 @@ void GFrame::paint_event(GPaintEvent& event) bottom_right_color = dark_shade; } - painter.draw_line(rect.top_left(), rect.top_right(), top_left_color); - painter.draw_line(rect.bottom_left(), rect.bottom_right(), bottom_right_color); - - painter.draw_line(rect.top_left().translated(0, 1), rect.bottom_left().translated(0, -1), top_left_color); - painter.draw_line(rect.top_right(), rect.bottom_right().translated(0, -1), bottom_right_color); + painter.draw_line(rect().top_left(), rect().top_right(), top_left_color); + painter.draw_line(rect().bottom_left(), rect().bottom_right(), bottom_right_color); + painter.draw_line(rect().top_left().translated(0, 1), rect().bottom_left().translated(0, -1), top_left_color); + painter.draw_line(rect().top_right(), rect().bottom_right().translated(0, -1), bottom_right_color); } |