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:
parent
5d6bf83374
commit
84ee95c346
2 changed files with 76 additions and 10 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue