1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:25:08 +00:00
serenity/LibGUI/GFrame.h
Andreas Kling cb296ffede LibGUI: Add a GFrame class that can be inherited by framey widgets.
This will gather the code for painting sunken/raised frames etc in a single
place and make it easier add a bit of pleasant shading to UI's. :^)
2019-03-28 15:30:29 +01:00

33 lines
955 B
C++

#pragma once
#include <LibGUI/GWidget.h>
class GFrame : public GWidget {
public:
explicit GFrame(GWidget* parent);
virtual ~GFrame() override;
enum Shadow { Plain, Raised, Sunken };
enum Shape { NoFrame, Box, Panel, VerticalLine, HorizontalLine };
int frame_thickness() const { return m_thickness; }
void set_frame_thickness(int thickness) { m_thickness = thickness; }
Shadow frame_shadow() const { return m_shadow; }
void set_frame_shadow(Shadow shadow) { m_shadow = shadow; }
Shape frame_shape() const { return m_shape; }
void set_frame_shape(Shape shape) { m_shape = shape; }
Rect frame_inner_rect() const { return rect().shrunken(m_thickness * 2, m_thickness * 2); }
virtual const char* class_name() const override { return "GFrame"; }
protected:
void paint_event(GPaintEvent&) override;
private:
int m_thickness { 0 };
Shadow m_shadow { Plain };
Shape m_shape { NoFrame };
};