소스 검색

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.
thankyouverycool 3 년 전
부모
커밋
bb4963a697
3개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      Userland/Libraries/LibGUI/Frame.cpp
  2. 5 0
      Userland/Libraries/LibGfx/ClassicStylePainter.cpp
  3. 1 0
      Userland/Libraries/LibGfx/StylePainter.h

+ 2 - 1
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()

+ 5 - 0
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();

+ 1 - 0
Userland/Libraries/LibGfx/StylePainter.h

@@ -28,6 +28,7 @@ enum class FrameShape {
     Box,
     Container,
     Panel,
+    Window,
 };
 
 // FIXME: should this be in its own header?