mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +00:00
Taskbar+LibGUI: More work on bringup.
This commit is contained in:
parent
a22774ee3f
commit
aa03a07e61
16 changed files with 105 additions and 250 deletions
|
@ -36,6 +36,9 @@ public:
|
|||
WindowCloseRequest,
|
||||
ChildAdded,
|
||||
ChildRemoved,
|
||||
WM_WindowAdded,
|
||||
WM_WindowRemoved,
|
||||
WM_WindowStateChanged,
|
||||
};
|
||||
|
||||
GEvent() { }
|
||||
|
@ -52,6 +55,65 @@ private:
|
|||
Type m_type { Invalid };
|
||||
};
|
||||
|
||||
class GWMEvent : public GEvent {
|
||||
public:
|
||||
GWMEvent(Type type, int client_id, int window_id)
|
||||
: GEvent(type)
|
||||
, m_client_id(client_id)
|
||||
, m_window_id(window_id)
|
||||
{
|
||||
}
|
||||
|
||||
int client_id() const { return m_client_id; }
|
||||
int window_id() const { return m_window_id; }
|
||||
|
||||
private:
|
||||
int m_client_id { -1 };
|
||||
int m_window_id { -1 };
|
||||
};
|
||||
|
||||
class GWMWindowAddedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowAddedEvent(int client_id, int window_id, const String& title, const Rect& rect)
|
||||
: GWMEvent(GEvent::Type::WM_WindowAdded, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
};
|
||||
|
||||
class GWMWindowRemovedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowRemovedEvent(int client_id, int window_id)
|
||||
: GWMEvent(GEvent::Type::WM_WindowRemoved, client_id, window_id)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class GWMWindowStateChangedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect)
|
||||
: GWMEvent(GEvent::Type::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
};
|
||||
|
||||
class QuitEvent final : public GEvent {
|
||||
public:
|
||||
QuitEvent()
|
||||
|
|
|
@ -258,6 +258,9 @@ void GWindow::event(GEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.type() == GEvent::WM_WindowAdded || event.type() == GEvent::WM_WindowRemoved || event.type() == GEvent::WM_WindowStateChanged)
|
||||
return wm_event(static_cast<GWMEvent&>(event));
|
||||
|
||||
GObject::event(event);
|
||||
}
|
||||
|
||||
|
@ -422,3 +425,7 @@ void GWindow::set_modal(bool modal)
|
|||
ASSERT(!m_window_id);
|
||||
m_modal = modal;
|
||||
}
|
||||
|
||||
void GWindow::wm_event(GWMEvent&)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <AK/WeakPtr.h>
|
||||
|
||||
class GWidget;
|
||||
class GWMEvent;
|
||||
|
||||
enum class GStandardCursor {
|
||||
None = 0,
|
||||
|
@ -103,6 +104,9 @@ public:
|
|||
|
||||
virtual const char* class_name() const override { return "GWindow"; }
|
||||
|
||||
protected:
|
||||
virtual void wm_event(GWMEvent&);
|
||||
|
||||
private:
|
||||
virtual bool is_window() const override final { return true; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue