1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

LibGUI: Simplify Dialog::ScreenPosition and allow Dialogs to opt out

These options were created 2 years ago but the only use cases thus far
are for Center and CenterWithinParent, so let's chuck the rest for now.

Adds a new DoNotPosition option to opt out of automatic centering and
a ScreenPosition setter and getter for configuration before exec()
This commit is contained in:
thankyouverycool 2023-05-13 05:07:09 -04:00 committed by Andreas Kling
parent dfe06096c7
commit f76d24c2ec
2 changed files with 15 additions and 84 deletions

View file

@ -22,20 +22,11 @@ public:
Yes = 3,
No = 4,
};
enum class ScreenPosition {
CenterWithinParent = 0,
Center = 1,
CenterLeft = 2,
CenterRight = 3,
TopLeft = 4,
TopCenter = 5,
TopRight = 6,
BottomLeft = 7,
BottomCenter = 8,
BottomRight = 9,
DoNotPosition,
CenterWithinParent,
Center,
};
virtual ~Dialog() override = default;
@ -45,6 +36,9 @@ public:
ExecResult result() const { return m_result; }
void done(ExecResult);
ScreenPosition screen_position() const { return m_screen_position; }
void set_screen_position(ScreenPosition position) { m_screen_position = position; }
virtual void event(Core::Event&) override;
virtual void close() override;