From bb4963a6972ffe96f3aedafcc129ac4833e9ff9b Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Fri, 25 Feb 2022 11:39:17 -0500 Subject: [PATCH] LibGfx+LibGUI: Add FrameShape::Window This shape is for use by the main widget of a frameless window that still wishes to have proper borders but no title. Raised Containers were used previously for this pattern but did not always represent perspective and shadow correctly depending on thread highlighting and the immediate background color. Containers are really meant to be used inside other widgets where the background color can be controlled. --- Userland/Libraries/LibGUI/Frame.cpp | 3 ++- Userland/Libraries/LibGfx/ClassicStylePainter.cpp | 5 +++++ Userland/Libraries/LibGfx/StylePainter.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/Frame.cpp b/Userland/Libraries/LibGUI/Frame.cpp index eb95debf74..d82bf4d7fe 100644 --- a/Userland/Libraries/LibGUI/Frame.cpp +++ b/Userland/Libraries/LibGUI/Frame.cpp @@ -28,7 +28,8 @@ Frame::Frame() { Gfx::FrameShape::NoFrame, "NoFrame" }, { Gfx::FrameShape::Box, "Box" }, { Gfx::FrameShape::Container, "Container" }, - { Gfx::FrameShape::Panel, "Panel" }); + { Gfx::FrameShape::Panel, "Panel" }, + { Gfx::FrameShape::Window, "Window" }); } Frame::~Frame() diff --git a/Userland/Libraries/LibGfx/ClassicStylePainter.cpp b/Userland/Libraries/LibGfx/ClassicStylePainter.cpp index 738b39b6f1..a6ec1c3c35 100644 --- a/Userland/Libraries/LibGfx/ClassicStylePainter.cpp +++ b/Userland/Libraries/LibGfx/ClassicStylePainter.cpp @@ -219,6 +219,11 @@ void ClassicStylePainter::paint_frame(Painter& painter, IntRect const& rect, Pal if (shape == Gfx::FrameShape::NoFrame) return; + if (shape == FrameShape::Window) { + StylePainter::paint_window_frame(painter, rect, palette); + return; + } + Color top_left_color; Color bottom_right_color; Color dark_shade = palette.threed_shadow1(); diff --git a/Userland/Libraries/LibGfx/StylePainter.h b/Userland/Libraries/LibGfx/StylePainter.h index 7cbec2f27b..c3f876b89f 100644 --- a/Userland/Libraries/LibGfx/StylePainter.h +++ b/Userland/Libraries/LibGfx/StylePainter.h @@ -28,6 +28,7 @@ enum class FrameShape { Box, Container, Panel, + Window, }; // FIXME: should this be in its own header?