1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

LibGUI: Allow to specify position on screen for Dialog window

This change allows us to specify where on screen we'd like the Dialog
window to be drawn. By default it's set to CenterWithinParent which
may fall back to Center if parent window is unset or not visible on
screen.
This commit is contained in:
LuK1337 2021-07-14 12:01:31 +02:00 committed by Gunnar Beutner
parent 5d6bf83374
commit 84ee95c346
2 changed files with 76 additions and 10 deletions

View file

@ -20,6 +20,21 @@ public:
ExecYes = 3,
ExecNo = 4,
};
enum ScreenPosition {
CenterWithinParent = 0,
Center = 1,
CenterLeft = 2,
CenterRight = 3,
TopLeft = 4,
TopCenter = 5,
TopRight = 6,
BottomLeft = 7,
BottomCenter = 8,
BottomRight = 9,
};
virtual ~Dialog() override;
@ -33,11 +48,12 @@ public:
virtual void close() override;
protected:
explicit Dialog(Window* parent_window);
explicit Dialog(Window* parent_window, ScreenPosition screen_position = CenterWithinParent);
private:
OwnPtr<Core::EventLoop> m_event_loop;
int m_result { ExecAborted };
int m_screen_position { CenterWithinParent };
};
}