mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:27:34 +00:00
LibGUI: Add content margins
Introduce the basic interface through which widgets can define a rect relative to which Layout margins are now applied.
This commit is contained in:
parent
8249ea792e
commit
72139e1262
2 changed files with 11 additions and 5 deletions
|
@ -134,8 +134,12 @@ public:
|
|||
int height() const { return m_relative_rect.height(); }
|
||||
int length(Orientation orientation) const { return orientation == Orientation::Vertical ? height() : width(); }
|
||||
|
||||
virtual Margins content_margins() const { return { 0 }; }
|
||||
|
||||
Gfx::IntRect rect() const { return { 0, 0, width(), height() }; }
|
||||
Gfx::IntSize size() const { return m_relative_rect.size(); }
|
||||
Gfx::IntRect content_rect() const { return this->content_margins().applied_to(rect()); };
|
||||
Gfx::IntSize content_size() const { return this->content_rect().size(); };
|
||||
|
||||
// Invalidate the widget (or an area thereof), causing a repaint to happen soon.
|
||||
void update();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue