mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 02:26:10 +00:00
LibGUI: Add direction totals to Margins
This commit is contained in:
parent
c9ed88309b
commit
e08508dcc1
Notes:
sideshowbarker
2024-07-17 09:55:47 +09:00
Author: https://github.com/frhun
Commit: e08508dcc1
Pull-request: https://github.com/SerenityOS/serenity/pull/14261
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/MacDue
Reviewed-by: https://github.com/mjz19910
1 changed files with 17 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibGfx/Orientation.h>
|
||||||
#include <LibGfx/Rect.h>
|
#include <LibGfx/Rect.h>
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
@ -78,6 +79,22 @@ public:
|
||||||
return Margins { top() + other.top(), right() + other.right(), bottom() + other.bottom(), left() + other.left() };
|
return Margins { top() + other.top(), right() + other.right(), bottom() + other.bottom(), left() + other.left() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] int primary_total_for_orientation(Gfx::Orientation const orientation) const
|
||||||
|
{
|
||||||
|
if (orientation == Gfx::Orientation::Horizontal)
|
||||||
|
return m_left + m_right;
|
||||||
|
else
|
||||||
|
return m_top + m_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] int secondary_total_for_orientation(Gfx::Orientation const orientation) const
|
||||||
|
{
|
||||||
|
if (orientation == Gfx::Orientation::Vertical)
|
||||||
|
return m_left + m_right;
|
||||||
|
else
|
||||||
|
return m_top + m_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_top { 0 };
|
int m_top { 0 };
|
||||||
int m_right { 0 };
|
int m_right { 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue