mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
WindowServer: Start implementing a menu system.
I'm going with a global top-of-the-screen menu instead of per-window menus. The basic idea is that menus will live in the WindowServer and clients can create menus via WindowServer requests.
This commit is contained in:
parent
7abef6ba9e
commit
443b043b49
14 changed files with 487 additions and 6 deletions
|
@ -10,13 +10,16 @@
|
|||
#include "WSMessageReceiver.h"
|
||||
|
||||
class Process;
|
||||
class WSMenu;
|
||||
|
||||
class WSWindow final : public WSMessageReceiver, public InlineLinkedListNode<WSWindow> {
|
||||
friend class WSWindowLocker;
|
||||
public:
|
||||
WSWindow(Process&, int window_id);
|
||||
explicit WSWindow(WSMenu&);
|
||||
virtual ~WSWindow() override;
|
||||
|
||||
bool is_menu() const { return m_menu; }
|
||||
int window_id() const { return m_window_id; }
|
||||
|
||||
String title() const { return m_title; }
|
||||
|
@ -27,14 +30,25 @@ public:
|
|||
int width() const { return m_rect.width(); }
|
||||
int height() const { return m_rect.height(); }
|
||||
|
||||
const Rect& rect() const { return m_rect; }
|
||||
bool is_visible() const { return m_visible; }
|
||||
void set_visible(bool);
|
||||
|
||||
Rect rect() const { return m_rect; }
|
||||
void set_rect(const Rect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
void set_rect_without_repaint(const Rect& rect) { m_rect = rect; }
|
||||
|
||||
void move_to(const Point& position) { set_rect({ position, size() }); }
|
||||
void move_to(int x, int y) { move_to({ x, y }); }
|
||||
|
||||
Point position() const { return m_rect.location(); }
|
||||
void set_position(const Point& position) { set_rect({ position.x(), position.y(), width(), height() }); }
|
||||
void set_position_without_repaint(const Point& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
|
||||
|
||||
Size size() const { return m_rect.size(); }
|
||||
|
||||
void invalidate();
|
||||
|
||||
virtual void on_message(WSMessage&) override;
|
||||
|
||||
bool is_being_dragged() const { return m_is_being_dragged; }
|
||||
|
@ -60,6 +74,9 @@ private:
|
|||
Rect m_rect;
|
||||
bool m_is_being_dragged { false };
|
||||
bool m_global_cursor_tracking_enabled { false };
|
||||
bool m_visible { true };
|
||||
|
||||
WSMenu* m_menu { nullptr };
|
||||
|
||||
RetainPtr<GraphicsBitmap> m_backing;
|
||||
Process* m_process { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue