summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Frame.h
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2023-04-29 16:47:52 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-30 05:49:46 +0200
commitf7e034d4b257a22b898252d62652587601fa7f99 (patch)
treea69511f055f54e0215a63d6082637d38293e97f6 /Userland/Libraries/LibGUI/Frame.h
parent4c9933bfb701c43a2f9aeadf8d06398fd6327749 (diff)
downloadserenity-f7e034d4b257a22b898252d62652587601fa7f99.zip
LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStyle
Previously, Frames could set both these properties along with a thickness to confusing effect: Most shapes of the same shadowing only differentiated at a thickness >= 2, and some not at all. This led to a lot of creative but ultimately superfluous choices in the code. Instead let's streamline our options, automate thickness, and get the right look without so much guesswork. Plain shadowing has been consolidated into a single Plain style, and 0 thickness can be had by setting style to NoFrame.
Diffstat (limited to 'Userland/Libraries/LibGUI/Frame.h')
-rw-r--r--Userland/Libraries/LibGUI/Frame.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/Userland/Libraries/LibGUI/Frame.h b/Userland/Libraries/LibGUI/Frame.h
index e1be22501b..c0dd9ef6f6 100644
--- a/Userland/Libraries/LibGUI/Frame.h
+++ b/Userland/Libraries/LibGUI/Frame.h
@@ -17,18 +17,14 @@ class Frame : public Widget {
public:
virtual ~Frame() override = default;
- int frame_thickness() const { return m_thickness; }
- void set_frame_thickness(int thickness);
+ int frame_thickness() const;
virtual Margins content_margins() const override { return { frame_thickness() }; }
- Gfx::FrameShadow frame_shadow() const { return m_shadow; }
- void set_frame_shadow(Gfx::FrameShadow shadow) { m_shadow = shadow; }
+ Gfx::FrameStyle frame_style() const { return m_style; }
+ void set_frame_style(Gfx::FrameStyle);
- Gfx::FrameShape frame_shape() const { return m_shape; }
- void set_frame_shape(Gfx::FrameShape shape) { m_shape = shape; }
-
- Gfx::IntRect frame_inner_rect_for_size(Gfx::IntSize size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
+ Gfx::IntRect frame_inner_rect_for_size(Gfx::IntSize size) const { return { frame_thickness(), frame_thickness(), size.width() - frame_thickness() * 2, size.height() - frame_thickness() * 2 }; }
Gfx::IntRect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
virtual Gfx::IntRect children_clip_rect() const override;
@@ -38,9 +34,7 @@ protected:
void paint_event(PaintEvent&) override;
private:
- int m_thickness { 0 };
- Gfx::FrameShadow m_shadow { Gfx::FrameShadow::Plain };
- Gfx::FrameShape m_shape { Gfx::FrameShape::NoFrame };
+ Gfx::FrameStyle m_style { Gfx::FrameStyle::NoFrame };
};
}