mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
LibCore: Introduce a C_OBJECT macro.
This macro goes at the top of every CObject-derived class like so: class SomeClass : public CObject { C_OBJECT(SomeClass) public: ... At the moment, all it does is create an override for the class_name() getter but in the future this will be used to automatically insert member functions into these classes.
This commit is contained in:
parent
d21a4f7518
commit
a599317624
56 changed files with 70 additions and 105 deletions
|
@ -15,9 +15,9 @@ class IRCWindowListModel;
|
||||||
class CNotifier;
|
class CNotifier;
|
||||||
|
|
||||||
class IRCClient final : public CObject {
|
class IRCClient final : public CObject {
|
||||||
|
C_OBJECT(IRCClient)
|
||||||
friend class IRCChannel;
|
friend class IRCChannel;
|
||||||
friend class IRCQuery;
|
friend class IRCQuery;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IRCClient();
|
IRCClient();
|
||||||
virtual ~IRCClient() override;
|
virtual ~IRCClient() override;
|
||||||
|
@ -87,8 +87,6 @@ public:
|
||||||
|
|
||||||
void add_server_message(const String&);
|
void add_server_message(const String&);
|
||||||
|
|
||||||
const char* class_name() const override { return "IRCClient"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Message {
|
struct Message {
|
||||||
String prefix;
|
String prefix;
|
||||||
|
|
|
@ -10,6 +10,7 @@ class GTableView;
|
||||||
class GTextEditor;
|
class GTextEditor;
|
||||||
|
|
||||||
class IRCWindow : public GWidget {
|
class IRCWindow : public GWidget {
|
||||||
|
C_OBJECT(IRCWindow)
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
Server,
|
Server,
|
||||||
|
@ -41,8 +42,6 @@ public:
|
||||||
const IRCQuery& query() const { return *(const IRCQuery*)m_owner; }
|
const IRCQuery& query() const { return *(const IRCQuery*)m_owner; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* class_name() const override { return "IRCWindow"; }
|
|
||||||
|
|
||||||
IRCClient& m_client;
|
IRCClient& m_client;
|
||||||
void* m_owner { nullptr };
|
void* m_owner { nullptr };
|
||||||
Type m_type;
|
Type m_type;
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
#include <LibGUI/GDialog.h>
|
#include <LibGUI/GDialog.h>
|
||||||
|
|
||||||
class ColorDialog final : public GDialog {
|
class ColorDialog final : public GDialog {
|
||||||
|
C_OBJECT(ColorDialog)
|
||||||
public:
|
public:
|
||||||
explicit ColorDialog(Color, CObject* parent = nullptr);
|
explicit ColorDialog(Color, CObject* parent = nullptr);
|
||||||
virtual ~ColorDialog() override;
|
virtual ~ColorDialog() override;
|
||||||
virtual const char* class_name() const override { return "ColorDialog"; }
|
|
||||||
|
|
||||||
Color color() const { return m_color; }
|
Color color() const { return m_color; }
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,13 @@
|
||||||
class Tool;
|
class Tool;
|
||||||
|
|
||||||
class PaintableWidget final : public GWidget {
|
class PaintableWidget final : public GWidget {
|
||||||
|
C_OBJECT(PaintableWidget)
|
||||||
public:
|
public:
|
||||||
static PaintableWidget& the();
|
static PaintableWidget& the();
|
||||||
|
|
||||||
explicit PaintableWidget(GWidget* parent);
|
explicit PaintableWidget(GWidget* parent);
|
||||||
virtual ~PaintableWidget() override;
|
virtual ~PaintableWidget() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "PaintableWidget"; }
|
|
||||||
|
|
||||||
Color primary_color() const { return m_primary_color; }
|
Color primary_color() const { return m_primary_color; }
|
||||||
Color secondary_color() const { return m_secondary_color; }
|
Color secondary_color() const { return m_secondary_color; }
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
class PaintableWidget;
|
class PaintableWidget;
|
||||||
|
|
||||||
class PaletteWidget final : public GFrame {
|
class PaletteWidget final : public GFrame {
|
||||||
|
C_OBJECT(PaletteWidget)
|
||||||
public:
|
public:
|
||||||
explicit PaletteWidget(PaintableWidget&, GWidget* parent);
|
explicit PaletteWidget(PaintableWidget&, GWidget* parent);
|
||||||
virtual ~PaletteWidget() override;
|
virtual ~PaletteWidget() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "PaletteWidget"; }
|
|
||||||
|
|
||||||
void set_primary_color(Color);
|
void set_primary_color(Color);
|
||||||
void set_secondary_color(Color);
|
void set_secondary_color(Color);
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,8 @@
|
||||||
#include <LibGUI/GFrame.h>
|
#include <LibGUI/GFrame.h>
|
||||||
|
|
||||||
class ToolboxWidget final : public GFrame {
|
class ToolboxWidget final : public GFrame {
|
||||||
|
C_OBJECT(ToolboxWidget)
|
||||||
public:
|
public:
|
||||||
explicit ToolboxWidget(GWidget* parent);
|
explicit ToolboxWidget(GWidget* parent);
|
||||||
virtual ~ToolboxWidget() override;
|
virtual ~ToolboxWidget() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "ToolboxWidget"; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
#include <LibGUI/GWindow.h>
|
#include <LibGUI/GWindow.h>
|
||||||
|
|
||||||
class TaskbarWindow final : public GWindow {
|
class TaskbarWindow final : public GWindow {
|
||||||
|
C_OBJECT(TaskbarWindow)
|
||||||
public:
|
public:
|
||||||
TaskbarWindow();
|
TaskbarWindow();
|
||||||
virtual ~TaskbarWindow() override;
|
virtual ~TaskbarWindow() override;
|
||||||
|
|
||||||
int taskbar_height() const { return 28; }
|
int taskbar_height() const { return 28; }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "TaskbarWindow"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void on_screen_rect_change(const Rect&);
|
void on_screen_rect_change(const Rect&);
|
||||||
GButton* create_button(const WindowIdentifier&);
|
GButton* create_button(const WindowIdentifier&);
|
||||||
|
|
|
@ -56,6 +56,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
class Terminal final : public GFrame {
|
class Terminal final : public GFrame {
|
||||||
|
C_OBJECT(Terminal)
|
||||||
public:
|
public:
|
||||||
explicit Terminal(int ptm_fd, RefPtr<CConfigFile> config);
|
explicit Terminal(int ptm_fd, RefPtr<CConfigFile> config);
|
||||||
virtual ~Terminal() override;
|
virtual ~Terminal() override;
|
||||||
|
@ -92,7 +93,6 @@ private:
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
virtual void mousemove_event(GMouseEvent&) override;
|
virtual void mousemove_event(GMouseEvent&) override;
|
||||||
virtual void mouseup_event(GMouseEvent&) override;
|
virtual void mouseup_event(GMouseEvent&) override;
|
||||||
virtual const char* class_name() const override { return "Terminal"; }
|
|
||||||
|
|
||||||
void scroll_up();
|
void scroll_up();
|
||||||
void scroll_down();
|
void scroll_down();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <LibCore/CIODevice.h>
|
#include <LibCore/CIODevice.h>
|
||||||
|
|
||||||
class CFile final : public CIODevice {
|
class CFile final : public CIODevice {
|
||||||
|
C_OBJECT(CFile)
|
||||||
public:
|
public:
|
||||||
CFile() {}
|
CFile() {}
|
||||||
explicit CFile(const StringView&);
|
explicit CFile(const StringView&);
|
||||||
|
@ -20,8 +21,6 @@ public:
|
||||||
};
|
};
|
||||||
bool open(int fd, CIODevice::OpenMode, ShouldCloseFileDescription);
|
bool open(int fd, CIODevice::OpenMode, ShouldCloseFileDescription);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "CFile"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_filename;
|
String m_filename;
|
||||||
ShouldCloseFileDescription m_should_close_file_descriptor { ShouldCloseFileDescription::Yes };
|
ShouldCloseFileDescription m_should_close_file_descriptor { ShouldCloseFileDescription::Yes };
|
||||||
|
|
|
@ -7,14 +7,13 @@
|
||||||
class CTCPSocket;
|
class CTCPSocket;
|
||||||
|
|
||||||
class CHttpJob final : public CNetworkJob {
|
class CHttpJob final : public CNetworkJob {
|
||||||
|
C_OBJECT(CHttpJob)
|
||||||
public:
|
public:
|
||||||
explicit CHttpJob(const CHttpRequest&);
|
explicit CHttpJob(const CHttpRequest&);
|
||||||
virtual ~CHttpJob() override;
|
virtual ~CHttpJob() override;
|
||||||
|
|
||||||
virtual void start() override;
|
virtual void start() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "CHttpJob"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void on_socket_connected();
|
void on_socket_connected();
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <LibCore/CObject.h>
|
#include <LibCore/CObject.h>
|
||||||
|
|
||||||
class CIODevice : public CObject {
|
class CIODevice : public CObject {
|
||||||
|
C_OBJECT(CIODevice)
|
||||||
public:
|
public:
|
||||||
enum OpenMode {
|
enum OpenMode {
|
||||||
NotOpen = 0,
|
NotOpen = 0,
|
||||||
|
@ -52,8 +53,6 @@ public:
|
||||||
|
|
||||||
int printf(const char*, ...);
|
int printf(const char*, ...);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "CIODevice"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit CIODevice(CObject* parent = nullptr);
|
explicit CIODevice(CObject* parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <LibCore/CSocket.h>
|
#include <LibCore/CSocket.h>
|
||||||
|
|
||||||
class CLocalSocket final : public CSocket {
|
class CLocalSocket final : public CSocket {
|
||||||
|
C_OBJECT(CLocalSocket)
|
||||||
public:
|
public:
|
||||||
explicit CLocalSocket(CObject* parent = nullptr);
|
explicit CLocalSocket(CObject* parent = nullptr);
|
||||||
virtual ~CLocalSocket() override;
|
virtual ~CLocalSocket() override;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
class CNetworkResponse;
|
class CNetworkResponse;
|
||||||
|
|
||||||
class CNetworkJob : public CObject {
|
class CNetworkJob : public CObject {
|
||||||
|
C_OBJECT(CNetworkJob)
|
||||||
public:
|
public:
|
||||||
enum class Error {
|
enum class Error {
|
||||||
None,
|
None,
|
||||||
|
@ -24,8 +25,6 @@ public:
|
||||||
|
|
||||||
virtual void start() = 0;
|
virtual void start() = 0;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "CNetworkJob"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CNetworkJob();
|
CNetworkJob();
|
||||||
void did_finish(NonnullRefPtr<CNetworkResponse>&&);
|
void did_finish(NonnullRefPtr<CNetworkResponse>&&);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "CObject.h"
|
#include "CObject.h"
|
||||||
|
|
||||||
class CNotifier : public CObject {
|
class CNotifier : public CObject {
|
||||||
|
C_OBJECT(CNotifier)
|
||||||
public:
|
public:
|
||||||
enum Event {
|
enum Event {
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@ -12,7 +13,7 @@ public:
|
||||||
Exceptional = 4,
|
Exceptional = 4,
|
||||||
};
|
};
|
||||||
CNotifier(int fd, unsigned event_mask);
|
CNotifier(int fd, unsigned event_mask);
|
||||||
~CNotifier();
|
virtual ~CNotifier() override;
|
||||||
|
|
||||||
void set_enabled(bool);
|
void set_enabled(bool);
|
||||||
|
|
||||||
|
@ -23,8 +24,7 @@ public:
|
||||||
unsigned event_mask() const { return m_event_mask; }
|
unsigned event_mask() const { return m_event_mask; }
|
||||||
void set_event_mask(unsigned event_mask) { m_event_mask = event_mask; }
|
void set_event_mask(unsigned event_mask) { m_event_mask = event_mask; }
|
||||||
|
|
||||||
const char* class_name() const override { return "CNotifier"; }
|
void event(CEvent&) override;
|
||||||
void event(CEvent& event) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_fd { -1 };
|
int m_fd { -1 };
|
||||||
|
|
|
@ -11,13 +11,16 @@ class CChildEvent;
|
||||||
class CCustomEvent;
|
class CCustomEvent;
|
||||||
class CTimerEvent;
|
class CTimerEvent;
|
||||||
|
|
||||||
|
#define C_OBJECT(klass) \
|
||||||
|
public: \
|
||||||
|
virtual const char* class_name() const override { return #klass; }
|
||||||
|
|
||||||
class CObject : public Weakable<CObject> {
|
class CObject : public Weakable<CObject> {
|
||||||
|
// NOTE: No C_OBJECT macro for CObject itself.
|
||||||
public:
|
public:
|
||||||
CObject(CObject* parent = nullptr, bool is_widget = false);
|
|
||||||
virtual ~CObject();
|
virtual ~CObject();
|
||||||
|
|
||||||
virtual const char* class_name() const { return "CObject"; }
|
virtual const char* class_name() const = 0;
|
||||||
|
|
||||||
virtual void event(CEvent&);
|
virtual void event(CEvent&);
|
||||||
|
|
||||||
const String& name() const { return m_name; }
|
const String& name() const { return m_name; }
|
||||||
|
@ -58,6 +61,8 @@ public:
|
||||||
virtual bool is_window() const { return false; }
|
virtual bool is_window() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CObject(CObject* parent = nullptr, bool is_widget = false);
|
||||||
|
|
||||||
virtual void timer_event(CTimerEvent&);
|
virtual void timer_event(CTimerEvent&);
|
||||||
virtual void child_event(CChildEvent&);
|
virtual void child_event(CChildEvent&);
|
||||||
virtual void custom_event(CCustomEvent&);
|
virtual void custom_event(CCustomEvent&);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
class CNotifier;
|
class CNotifier;
|
||||||
|
|
||||||
class CSocket : public CIODevice {
|
class CSocket : public CIODevice {
|
||||||
|
C_OBJECT(CSocket)
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
Invalid,
|
Invalid,
|
||||||
|
@ -35,8 +36,6 @@ public:
|
||||||
|
|
||||||
Function<void()> on_connected;
|
Function<void()> on_connected;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "CSocket"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CSocket(Type, CObject* parent);
|
CSocket(Type, CObject* parent);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <LibCore/CSocket.h>
|
#include <LibCore/CSocket.h>
|
||||||
|
|
||||||
class CTCPSocket final : public CSocket {
|
class CTCPSocket final : public CSocket {
|
||||||
|
C_OBJECT(CTCPSocket)
|
||||||
public:
|
public:
|
||||||
explicit CTCPSocket(CObject* parent = nullptr);
|
explicit CTCPSocket(CObject* parent = nullptr);
|
||||||
virtual ~CTCPSocket() override;
|
virtual ~CTCPSocket() override;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <LibCore/CObject.h>
|
#include <LibCore/CObject.h>
|
||||||
|
|
||||||
class CTimer final : public CObject {
|
class CTimer final : public CObject {
|
||||||
|
C_OBJECT(CTimer)
|
||||||
public:
|
public:
|
||||||
explicit CTimer(CObject* parent = nullptr);
|
explicit CTimer(CObject* parent = nullptr);
|
||||||
CTimer(int interval, Function<void()>&& timeout_handler, CObject* parent = nullptr);
|
CTimer(int interval, Function<void()>&& timeout_handler, CObject* parent = nullptr);
|
||||||
|
@ -29,8 +30,6 @@ public:
|
||||||
|
|
||||||
Function<void()> on_timeout;
|
Function<void()> on_timeout;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "CTimer"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void timer_event(CTimerEvent&) override;
|
virtual void timer_event(CTimerEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ private:
|
||||||
|
|
||||||
template <typename ServerMessage, typename ClientMessage>
|
template <typename ServerMessage, typename ClientMessage>
|
||||||
class Connection : public CObject {
|
class Connection : public CObject {
|
||||||
|
C_OBJECT(Connection)
|
||||||
public:
|
public:
|
||||||
Connection(const StringView& address)
|
Connection(const StringView& address)
|
||||||
: m_notifier(CNotifier(m_connection.fd(), CNotifier::Read))
|
: m_notifier(CNotifier(m_connection.fd(), CNotifier::Read))
|
||||||
|
|
|
@ -55,8 +55,8 @@ T* new_connection_for_client(Args&& ... args)
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename ServerMessage, typename ClientMessage>
|
template <typename ServerMessage, typename ClientMessage>
|
||||||
class Connection : public CObject
|
class Connection : public CObject {
|
||||||
{
|
C_OBJECT(Connection)
|
||||||
public:
|
public:
|
||||||
Connection(int fd, int client_id)
|
Connection(int fd, int client_id)
|
||||||
: m_socket(fd)
|
: m_socket(fd)
|
||||||
|
@ -168,8 +168,6 @@ public:
|
||||||
m_notifier.set_enabled(false);
|
m_notifier.set_enabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* class_name() const override { return "Connection"; }
|
|
||||||
|
|
||||||
int client_id() const { return m_client_id; }
|
int client_id() const { return m_client_id; }
|
||||||
pid_t client_pid() const { return m_pid; }
|
pid_t client_pid() const { return m_pid; }
|
||||||
void set_client_pid(pid_t pid) { m_pid = pid; }
|
void set_client_pid(pid_t pid) { m_pid = pid; }
|
||||||
|
@ -194,10 +192,9 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO: A way to create some kind of CIODevice with an open FD would be nice.
|
// TODO: A way to create some kind of CIODevice with an open FD would be nice.
|
||||||
class COpenedSocket : public CIODevice
|
class COpenedSocket : public CIODevice {
|
||||||
{
|
C_OBJECT(COpenedSocket)
|
||||||
public:
|
public:
|
||||||
const char* class_name() const override { return "COpenedSocket"; }
|
|
||||||
COpenedSocket(int fd)
|
COpenedSocket(int fd)
|
||||||
{
|
{
|
||||||
set_fd(fd);
|
set_fd(fd);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
class GPainter;
|
class GPainter;
|
||||||
|
|
||||||
class GAbstractButton : public GWidget {
|
class GAbstractButton : public GWidget {
|
||||||
|
C_OBJECT(GAbstractButton)
|
||||||
public:
|
public:
|
||||||
virtual ~GAbstractButton() override;
|
virtual ~GAbstractButton() override;
|
||||||
|
|
||||||
|
@ -28,7 +29,6 @@ public:
|
||||||
bool is_being_pressed() const { return m_being_pressed; }
|
bool is_being_pressed() const { return m_being_pressed; }
|
||||||
|
|
||||||
virtual void click() = 0;
|
virtual void click() = 0;
|
||||||
virtual const char* class_name() const override { return "GAbstractButton"; }
|
|
||||||
virtual bool accepts_focus() const override { return true; }
|
virtual bool accepts_focus() const override { return true; }
|
||||||
virtual bool supports_keyboard_activation() const override { return true; }
|
virtual bool supports_keyboard_activation() const override { return true; }
|
||||||
virtual bool is_uncheckable() const { return true; }
|
virtual bool is_uncheckable() const { return true; }
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
class GModelEditingDelegate;
|
class GModelEditingDelegate;
|
||||||
|
|
||||||
class GAbstractView : public GScrollableWidget {
|
class GAbstractView : public GScrollableWidget {
|
||||||
|
C_OBJECT(GAbstractView)
|
||||||
friend class GModel;
|
friend class GModel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GAbstractView(GWidget* parent);
|
explicit GAbstractView(GWidget* parent);
|
||||||
virtual ~GAbstractView() override;
|
virtual ~GAbstractView() override;
|
||||||
|
@ -38,8 +38,6 @@ public:
|
||||||
|
|
||||||
Function<OwnPtr<GModelEditingDelegate>(const GModelIndex&)> aid_create_editing_delegate;
|
Function<OwnPtr<GModelEditingDelegate>(const GModelIndex&)> aid_create_editing_delegate;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GAbstractView"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void model_notification(const GModelNotification&);
|
virtual void model_notification(const GModelNotification&);
|
||||||
virtual void did_scroll() override;
|
virtual void did_scroll() override;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
class GAction;
|
class GAction;
|
||||||
|
|
||||||
class GButton : public GAbstractButton {
|
class GButton : public GAbstractButton {
|
||||||
|
C_OBJECT(GButton)
|
||||||
public:
|
public:
|
||||||
GButton(const StringView& text, GWidget* parent);
|
GButton(const StringView& text, GWidget* parent);
|
||||||
explicit GButton(GWidget* parent);
|
explicit GButton(GWidget* parent);
|
||||||
|
@ -31,7 +32,6 @@ public:
|
||||||
|
|
||||||
void set_action(GAction&);
|
void set_action(GAction&);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GButton"; }
|
|
||||||
virtual bool accepts_focus() const override { return m_focusable; }
|
virtual bool accepts_focus() const override { return m_focusable; }
|
||||||
virtual bool supports_keyboard_activation() const override;
|
virtual bool supports_keyboard_activation() const override;
|
||||||
virtual bool is_uncheckable() const override;
|
virtual bool is_uncheckable() const override;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <LibGUI/GAbstractButton.h>
|
#include <LibGUI/GAbstractButton.h>
|
||||||
|
|
||||||
class GCheckBox : public GAbstractButton {
|
class GCheckBox : public GAbstractButton {
|
||||||
|
C_OBJECT(GCheckBox)
|
||||||
public:
|
public:
|
||||||
GCheckBox(const StringView&, GWidget* parent);
|
GCheckBox(const StringView&, GWidget* parent);
|
||||||
explicit GCheckBox(GWidget* parent);
|
explicit GCheckBox(GWidget* parent);
|
||||||
|
@ -12,8 +13,6 @@ public:
|
||||||
|
|
||||||
virtual void click() override;
|
virtual void click() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GCheckBox"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// These don't make sense for a check box, so hide them.
|
// These don't make sense for a check box, so hide them.
|
||||||
using GAbstractButton::auto_repeat_interval;
|
using GAbstractButton::auto_repeat_interval;
|
||||||
|
|
|
@ -7,6 +7,7 @@ class GButton;
|
||||||
class GTextEditor;
|
class GTextEditor;
|
||||||
|
|
||||||
class GComboBox : public GWidget {
|
class GComboBox : public GWidget {
|
||||||
|
C_OBJECT(GComboBox)
|
||||||
public:
|
public:
|
||||||
explicit GComboBox(GWidget* parent = nullptr);
|
explicit GComboBox(GWidget* parent = nullptr);
|
||||||
virtual ~GComboBox() override;
|
virtual ~GComboBox() override;
|
||||||
|
@ -28,8 +29,6 @@ public:
|
||||||
Function<void(const String&)> on_change;
|
Function<void(const String&)> on_change;
|
||||||
Function<void()> on_return_pressed;
|
Function<void()> on_return_pressed;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GComboBox"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <LibGUI/GWindow.h>
|
#include <LibGUI/GWindow.h>
|
||||||
|
|
||||||
class GDialog : public GWindow {
|
class GDialog : public GWindow {
|
||||||
|
C_OBJECT(GDialog)
|
||||||
public:
|
public:
|
||||||
enum ExecResult {
|
enum ExecResult {
|
||||||
ExecOK = 0,
|
ExecOK = 0,
|
||||||
|
@ -18,8 +19,6 @@ public:
|
||||||
int result() const { return m_result; }
|
int result() const { return m_result; }
|
||||||
void done(int result);
|
void done(int result);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GDialog"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit GDialog(CObject* parent);
|
explicit GDialog(CObject* parent);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class GDirectoryModel;
|
||||||
class GLabel;
|
class GLabel;
|
||||||
|
|
||||||
class GFilePicker final : public GDialog {
|
class GFilePicker final : public GDialog {
|
||||||
|
C_OBJECT(GFilePicker)
|
||||||
public:
|
public:
|
||||||
enum class Mode {
|
enum class Mode {
|
||||||
Open,
|
Open,
|
||||||
|
@ -22,8 +23,6 @@ public:
|
||||||
|
|
||||||
FileSystemPath selected_file() const { return m_selected_file; }
|
FileSystemPath selected_file() const { return m_selected_file; }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GFilePicker"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void set_preview(const FileSystemPath&);
|
void set_preview(const FileSystemPath&);
|
||||||
void clear_preview();
|
void clear_preview();
|
||||||
|
@ -48,4 +47,4 @@ private:
|
||||||
GLabel* m_preview_name_label { nullptr };
|
GLabel* m_preview_name_label { nullptr };
|
||||||
GLabel* m_preview_geometry_label { nullptr };
|
GLabel* m_preview_geometry_label { nullptr };
|
||||||
Mode m_mode { Mode::Open };
|
Mode m_mode { Mode::Open };
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <LibDraw/StylePainter.h>
|
#include <LibDraw/StylePainter.h>
|
||||||
|
|
||||||
class GFrame : public GWidget {
|
class GFrame : public GWidget {
|
||||||
|
C_OBJECT(GFrame)
|
||||||
public:
|
public:
|
||||||
explicit GFrame(GWidget* parent = nullptr);
|
explicit GFrame(GWidget* parent = nullptr);
|
||||||
virtual ~GFrame() override;
|
virtual ~GFrame() override;
|
||||||
|
@ -20,8 +21,6 @@ public:
|
||||||
Rect frame_inner_rect_for_size(const Size& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
Rect frame_inner_rect_for_size(const Size& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
||||||
Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
|
Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GFrame"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paint_event(GPaintEvent&) override;
|
void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
|
|
||||||
class GGroupBox : public GWidget {
|
class GGroupBox : public GWidget {
|
||||||
|
C_OBJECT(GGroupBox)
|
||||||
public:
|
public:
|
||||||
explicit GGroupBox(GWidget* parent);
|
explicit GGroupBox(GWidget* parent);
|
||||||
GGroupBox(const StringView& title, GWidget* parent);
|
GGroupBox(const StringView& title, GWidget* parent);
|
||||||
|
@ -11,8 +12,6 @@ public:
|
||||||
String title() const { return m_title; }
|
String title() const { return m_title; }
|
||||||
void set_title(const StringView&);
|
void set_title(const StringView&);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GGroupBox"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,13 @@ class GButton;
|
||||||
class GTextEditor;
|
class GTextEditor;
|
||||||
|
|
||||||
class GInputBox : public GDialog {
|
class GInputBox : public GDialog {
|
||||||
|
C_OBJECT(GInputBox)
|
||||||
public:
|
public:
|
||||||
explicit GInputBox(const StringView& prompt, const StringView& title, CObject* parent = nullptr);
|
explicit GInputBox(const StringView& prompt, const StringView& title, CObject* parent = nullptr);
|
||||||
virtual ~GInputBox() override;
|
virtual ~GInputBox() override;
|
||||||
|
|
||||||
String text_value() const { return m_text_value; }
|
String text_value() const { return m_text_value; }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GInputBox"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void build();
|
void build();
|
||||||
String m_prompt;
|
String m_prompt;
|
||||||
|
|
|
@ -9,6 +9,7 @@ class GScrollBar;
|
||||||
class Painter;
|
class Painter;
|
||||||
|
|
||||||
class GItemView : public GAbstractView {
|
class GItemView : public GAbstractView {
|
||||||
|
C_OBJECT(GItemView)
|
||||||
public:
|
public:
|
||||||
explicit GItemView(GWidget* parent);
|
explicit GItemView(GWidget* parent);
|
||||||
virtual ~GItemView() override;
|
virtual ~GItemView() override;
|
||||||
|
@ -22,8 +23,6 @@ public:
|
||||||
int model_column() const { return m_model_column; }
|
int model_column() const { return m_model_column; }
|
||||||
void set_model_column(int column) { m_model_column = column; }
|
void set_model_column(int column) { m_model_column = column; }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GItemView"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void did_update_model() override;
|
virtual void did_update_model() override;
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
class GraphicsBitmap;
|
class GraphicsBitmap;
|
||||||
|
|
||||||
class GLabel : public GFrame {
|
class GLabel : public GFrame {
|
||||||
|
C_OBJECT(GLabel)
|
||||||
public:
|
public:
|
||||||
explicit GLabel(GWidget* parent = nullptr);
|
explicit GLabel(GWidget* parent = nullptr);
|
||||||
GLabel(const StringView& text, GWidget* parent = nullptr);
|
GLabel(const StringView& text, GWidget* parent = nullptr);
|
||||||
|
@ -26,8 +27,6 @@ public:
|
||||||
|
|
||||||
void size_to_fit();
|
void size_to_fit();
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GLabel"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ class GScrollBar;
|
||||||
class Painter;
|
class Painter;
|
||||||
|
|
||||||
class GListView : public GAbstractView {
|
class GListView : public GAbstractView {
|
||||||
|
C_OBJECT(GListView)
|
||||||
public:
|
public:
|
||||||
explicit GListView(GWidget* parent);
|
explicit GListView(GWidget* parent);
|
||||||
virtual ~GListView() override;
|
virtual ~GListView() override;
|
||||||
|
@ -26,8 +27,6 @@ public:
|
||||||
|
|
||||||
virtual Rect content_rect(const GModelIndex&) const override;
|
virtual Rect content_rect(const GModelIndex&) const override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GListView"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void did_update_model() override;
|
virtual void did_update_model() override;
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <LibGUI/GDialog.h>
|
#include <LibGUI/GDialog.h>
|
||||||
|
|
||||||
class GMessageBox : public GDialog {
|
class GMessageBox : public GDialog {
|
||||||
|
C_OBJECT(GMessageBox)
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
None,
|
None,
|
||||||
|
@ -21,8 +22,6 @@ public:
|
||||||
|
|
||||||
static void show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
|
static void show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GMessageBox"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool should_include_ok_button() const;
|
bool should_include_ok_button() const;
|
||||||
bool should_include_cancel_button() const;
|
bool should_include_cancel_button() const;
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
#include <LibGUI/GAbstractButton.h>
|
#include <LibGUI/GAbstractButton.h>
|
||||||
|
|
||||||
class GRadioButton : public GAbstractButton {
|
class GRadioButton : public GAbstractButton {
|
||||||
|
C_OBJECT(GRadioButton)
|
||||||
public:
|
public:
|
||||||
GRadioButton(const StringView& text, GWidget* parent);
|
GRadioButton(const StringView& text, GWidget* parent);
|
||||||
virtual ~GRadioButton() override;
|
virtual ~GRadioButton() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GRadioButton"; }
|
|
||||||
|
|
||||||
virtual void click() override;
|
virtual void click() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
|
|
||||||
class GResizeCorner : public GWidget {
|
class GResizeCorner : public GWidget {
|
||||||
|
C_OBJECT(GResizeCorner)
|
||||||
public:
|
public:
|
||||||
explicit GResizeCorner(GWidget* parent);
|
explicit GResizeCorner(GWidget* parent);
|
||||||
virtual ~GResizeCorner() override;
|
virtual ~GResizeCorner() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GResizeCorner"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
|
|
||||||
class GScrollBar final : public GWidget {
|
class GScrollBar final : public GWidget {
|
||||||
|
C_OBJECT(GScrollBar)
|
||||||
public:
|
public:
|
||||||
explicit GScrollBar(Orientation, GWidget* parent);
|
explicit GScrollBar(Orientation, GWidget* parent);
|
||||||
virtual ~GScrollBar() override;
|
virtual ~GScrollBar() override;
|
||||||
|
@ -27,8 +28,6 @@ public:
|
||||||
|
|
||||||
Function<void(int)> on_change;
|
Function<void(int)> on_change;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GScrollBar"; }
|
|
||||||
|
|
||||||
enum Component {
|
enum Component {
|
||||||
Invalid,
|
Invalid,
|
||||||
DecrementButton,
|
DecrementButton,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
class GScrollBar;
|
class GScrollBar;
|
||||||
|
|
||||||
class GScrollableWidget : public GFrame {
|
class GScrollableWidget : public GFrame {
|
||||||
|
C_OBJECT(GScrollableWidget)
|
||||||
public:
|
public:
|
||||||
virtual ~GScrollableWidget() override;
|
virtual ~GScrollableWidget() override;
|
||||||
|
|
||||||
|
@ -37,8 +38,6 @@ public:
|
||||||
int width_occupied_by_vertical_scrollbar() const;
|
int width_occupied_by_vertical_scrollbar() const;
|
||||||
int height_occupied_by_horizontal_scrollbar() const;
|
int height_occupied_by_horizontal_scrollbar() const;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GScrollableWidget"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit GScrollableWidget(GWidget* parent);
|
explicit GScrollableWidget(GWidget* parent);
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
|
@ -6,6 +6,7 @@ class GButton;
|
||||||
class GTextEditor;
|
class GTextEditor;
|
||||||
|
|
||||||
class GSpinBox : public GWidget {
|
class GSpinBox : public GWidget {
|
||||||
|
C_OBJECT(GSpinBox)
|
||||||
public:
|
public:
|
||||||
GSpinBox(GWidget* parent = nullptr);
|
GSpinBox(GWidget* parent = nullptr);
|
||||||
virtual ~GSpinBox() override;
|
virtual ~GSpinBox() override;
|
||||||
|
@ -21,8 +22,6 @@ public:
|
||||||
|
|
||||||
Function<void(int value)> on_change;
|
Function<void(int value)> on_change;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GSpinBox"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
|
|
||||||
class GStackWidget : public GWidget {
|
class GStackWidget : public GWidget {
|
||||||
|
C_OBJECT(GStackWidget)
|
||||||
public:
|
public:
|
||||||
explicit GStackWidget(GWidget* parent);
|
explicit GStackWidget(GWidget* parent);
|
||||||
virtual ~GStackWidget() override;
|
virtual ~GStackWidget() override;
|
||||||
|
@ -12,8 +13,6 @@ public:
|
||||||
|
|
||||||
Function<void(GWidget*)> on_active_widget_change;
|
Function<void(GWidget*)> on_active_widget_change;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GStackWidget"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void child_event(CChildEvent&) override;
|
virtual void child_event(CChildEvent&) override;
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
|
@ -6,6 +6,7 @@ class GLabel;
|
||||||
class GResizeCorner;
|
class GResizeCorner;
|
||||||
|
|
||||||
class GStatusBar : public GWidget {
|
class GStatusBar : public GWidget {
|
||||||
|
C_OBJECT(GStatusBar)
|
||||||
public:
|
public:
|
||||||
explicit GStatusBar(GWidget* parent);
|
explicit GStatusBar(GWidget* parent);
|
||||||
virtual ~GStatusBar() override;
|
virtual ~GStatusBar() override;
|
||||||
|
@ -13,8 +14,6 @@ public:
|
||||||
String text() const;
|
String text() const;
|
||||||
void set_text(const StringView&);
|
void set_text(const StringView&);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GStatusBar"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
|
|
||||||
class GTabWidget : public GWidget {
|
class GTabWidget : public GWidget {
|
||||||
|
C_OBJECT(GTabWidget)
|
||||||
public:
|
public:
|
||||||
explicit GTabWidget(GWidget* parent);
|
explicit GTabWidget(GWidget* parent);
|
||||||
virtual ~GTabWidget() override;
|
virtual ~GTabWidget() override;
|
||||||
|
@ -15,8 +16,6 @@ public:
|
||||||
|
|
||||||
void add_widget(const StringView&, GWidget*);
|
void add_widget(const StringView&, GWidget*);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GTabWidget"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void child_event(CChildEvent&) override;
|
virtual void child_event(CChildEvent&) override;
|
||||||
|
|
|
@ -9,6 +9,7 @@ class GScrollBar;
|
||||||
class Painter;
|
class Painter;
|
||||||
|
|
||||||
class GTableView : public GAbstractView {
|
class GTableView : public GAbstractView {
|
||||||
|
C_OBJECT(GTableView)
|
||||||
public:
|
public:
|
||||||
explicit GTableView(GWidget* parent);
|
explicit GTableView(GWidget* parent);
|
||||||
virtual ~GTableView() override;
|
virtual ~GTableView() override;
|
||||||
|
@ -34,8 +35,6 @@ public:
|
||||||
|
|
||||||
virtual Rect content_rect(const GModelIndex&) const override;
|
virtual Rect content_rect(const GModelIndex&) const override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GTableView"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void did_update_model() override;
|
virtual void did_update_model() override;
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
#include <LibGUI/GTextEditor.h>
|
#include <LibGUI/GTextEditor.h>
|
||||||
|
|
||||||
class GTextBox final : public GTextEditor {
|
class GTextBox final : public GTextEditor {
|
||||||
|
C_OBJECT(GTextBox)
|
||||||
public:
|
public:
|
||||||
explicit GTextBox(GWidget* parent);
|
explicit GTextBox(GWidget* parent);
|
||||||
virtual ~GTextBox() override;
|
virtual ~GTextBox() override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GTextBox"; }
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,6 +78,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
class GTextEditor : public GScrollableWidget {
|
class GTextEditor : public GScrollableWidget {
|
||||||
|
C_OBJECT(GTextEditor)
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
MultiLine,
|
MultiLine,
|
||||||
|
@ -134,8 +135,6 @@ public:
|
||||||
Function<void()> on_return_pressed;
|
Function<void()> on_return_pressed;
|
||||||
Function<void()> on_escape_pressed;
|
Function<void()> on_escape_pressed;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GTextEditor"; }
|
|
||||||
|
|
||||||
GAction& undo_action() { return *m_undo_action; }
|
GAction& undo_action() { return *m_undo_action; }
|
||||||
GAction& redo_action() { return *m_redo_action; }
|
GAction& redo_action() { return *m_redo_action; }
|
||||||
GAction& cut_action() { return *m_cut_action; }
|
GAction& cut_action() { return *m_cut_action; }
|
||||||
|
|
|
@ -45,6 +45,7 @@ void GToolBar::add_action(GAction& action)
|
||||||
}
|
}
|
||||||
|
|
||||||
class SeparatorWidget final : public GWidget {
|
class SeparatorWidget final : public GWidget {
|
||||||
|
C_OBJECT(SeparatorWidget)
|
||||||
public:
|
public:
|
||||||
SeparatorWidget(GWidget* parent)
|
SeparatorWidget(GWidget* parent)
|
||||||
: GWidget(parent)
|
: GWidget(parent)
|
||||||
|
@ -63,9 +64,6 @@ public:
|
||||||
painter.draw_line({ 0, 0 }, { 0, rect().bottom() }, Color::MidGray);
|
painter.draw_line({ 0, 0 }, { 0, rect().bottom() }, Color::MidGray);
|
||||||
painter.draw_line({ 1, 0 }, { 1, rect().bottom() }, Color::White);
|
painter.draw_line({ 1, 0 }, { 1, rect().bottom() }, Color::White);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
virtual const char* class_name() const override { return "SeparatorWidget"; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void GToolBar::add_separator()
|
void GToolBar::add_separator()
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
class GAction;
|
class GAction;
|
||||||
|
|
||||||
class GToolBar : public GWidget {
|
class GToolBar : public GWidget {
|
||||||
|
C_OBJECT(GToolBar)
|
||||||
public:
|
public:
|
||||||
explicit GToolBar(GWidget* parent);
|
explicit GToolBar(GWidget* parent);
|
||||||
virtual ~GToolBar() override;
|
virtual ~GToolBar() override;
|
||||||
|
@ -16,8 +17,6 @@ public:
|
||||||
bool has_frame() const { return m_has_frame; }
|
bool has_frame() const { return m_has_frame; }
|
||||||
void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
|
void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GToolBar"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
#include <LibGUI/GAbstractView.h>
|
#include <LibGUI/GAbstractView.h>
|
||||||
|
|
||||||
class GTreeView : public GAbstractView {
|
class GTreeView : public GAbstractView {
|
||||||
|
C_OBJECT(GTreeView)
|
||||||
public:
|
public:
|
||||||
explicit GTreeView(GWidget*);
|
explicit GTreeView(GWidget*);
|
||||||
virtual ~GTreeView() override;
|
virtual ~GTreeView() override;
|
||||||
|
|
||||||
virtual void scroll_into_view(const GModelIndex&, Orientation);
|
virtual void scroll_into_view(const GModelIndex&, Orientation);
|
||||||
virtual const char* class_name() const override { return "GTreeView"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
|
@ -32,6 +32,7 @@ enum class VerticalDirection {
|
||||||
};
|
};
|
||||||
|
|
||||||
class GWidget : public CObject {
|
class GWidget : public CObject {
|
||||||
|
C_OBJECT(GWidget)
|
||||||
public:
|
public:
|
||||||
explicit GWidget(GWidget* parent = nullptr);
|
explicit GWidget(GWidget* parent = nullptr);
|
||||||
virtual ~GWidget() override;
|
virtual ~GWidget() override;
|
||||||
|
@ -113,8 +114,6 @@ public:
|
||||||
HitTestResult hit_test(const Point&);
|
HitTestResult hit_test(const Point&);
|
||||||
GWidget* child_at(const Point&) const;
|
GWidget* child_at(const Point&) const;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GWidget"; }
|
|
||||||
|
|
||||||
void set_relative_rect(const Rect&);
|
void set_relative_rect(const Rect&);
|
||||||
void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); }
|
void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); }
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ enum class GStandardCursor {
|
||||||
};
|
};
|
||||||
|
|
||||||
class GWindow : public CObject {
|
class GWindow : public CObject {
|
||||||
|
C_OBJECT(GWindow)
|
||||||
public:
|
public:
|
||||||
GWindow(CObject* parent = nullptr);
|
GWindow(CObject* parent = nullptr);
|
||||||
virtual ~GWindow() override;
|
virtual ~GWindow() override;
|
||||||
|
@ -123,8 +124,6 @@ public:
|
||||||
|
|
||||||
Vector<GWidget*> focusable_widgets() const;
|
Vector<GWidget*> focusable_widgets() const;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GWindow"; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void wm_event(GWMEvent&);
|
virtual void wm_event(GWMEvent&);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ enum class WallpaperMode {
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSCompositor final : public CObject {
|
class WSCompositor final : public CObject {
|
||||||
|
C_OBJECT(WSCompositor)
|
||||||
public:
|
public:
|
||||||
static WSCompositor& the();
|
static WSCompositor& the();
|
||||||
|
|
||||||
|
@ -35,8 +36,6 @@ public:
|
||||||
Rect current_cursor_rect() const;
|
Rect current_cursor_rect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual const char* class_name() const override { return "WSCompositor"; }
|
|
||||||
|
|
||||||
WSCompositor();
|
WSCompositor();
|
||||||
void flip_buffers();
|
void flip_buffers();
|
||||||
void flush(const Rect&);
|
void flush(const Rect&);
|
||||||
|
|
|
@ -14,6 +14,7 @@ class WSWindow;
|
||||||
class Font;
|
class Font;
|
||||||
|
|
||||||
class WSMenu final : public CObject {
|
class WSMenu final : public CObject {
|
||||||
|
C_OBJECT(WSMenu)
|
||||||
public:
|
public:
|
||||||
WSMenu(WSClientConnection*, int menu_id, const String& name);
|
WSMenu(WSClientConnection*, int menu_id, const String& name);
|
||||||
virtual ~WSMenu() override;
|
virtual ~WSMenu() override;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <WindowServer/WSWindow.h>
|
#include <WindowServer/WSWindow.h>
|
||||||
|
|
||||||
class WSMenuManager final : public CObject {
|
class WSMenuManager final : public CObject {
|
||||||
|
C_OBJECT(WSMenuManager)
|
||||||
public:
|
public:
|
||||||
WSMenuManager();
|
WSMenuManager();
|
||||||
virtual ~WSMenuManager() override;
|
virtual ~WSMenuManager() override;
|
||||||
|
@ -13,7 +14,6 @@ public:
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
virtual void event(CEvent&) override;
|
virtual void event(CEvent&) override;
|
||||||
virtual const char* class_name() const override { return "WSMenuManager"; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WSWindow& window() { return *m_window; }
|
WSWindow& window() { return *m_window; }
|
||||||
|
|
|
@ -16,6 +16,7 @@ class WSMouseEvent;
|
||||||
|
|
||||||
class WSWindow final : public CObject
|
class WSWindow final : public CObject
|
||||||
, public InlineLinkedListNode<WSWindow> {
|
, public InlineLinkedListNode<WSWindow> {
|
||||||
|
C_OBJECT(WSWindow)
|
||||||
public:
|
public:
|
||||||
WSWindow(WSClientConnection&, WSWindowType, int window_id, bool modal, bool resizable, bool fullscreen);
|
WSWindow(WSClientConnection&, WSWindowType, int window_id, bool modal, bool resizable, bool fullscreen);
|
||||||
WSWindow(CObject&, WSWindowType);
|
WSWindow(CObject&, WSWindowType);
|
||||||
|
|
|
@ -42,6 +42,8 @@ enum class ResizeDirection {
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSWindowManager : public CObject {
|
class WSWindowManager : public CObject {
|
||||||
|
C_OBJECT(WSWindowManager)
|
||||||
|
|
||||||
friend class WSCompositor;
|
friend class WSCompositor;
|
||||||
friend class WSWindowFrame;
|
friend class WSWindowFrame;
|
||||||
friend class WSWindowSwitcher;
|
friend class WSWindowSwitcher;
|
||||||
|
|
|
@ -10,6 +10,7 @@ class WSKeyEvent;
|
||||||
class WSWindow;
|
class WSWindow;
|
||||||
|
|
||||||
class WSWindowSwitcher : public CObject {
|
class WSWindowSwitcher : public CObject {
|
||||||
|
C_OBJECT(WSWindowSwitcher)
|
||||||
public:
|
public:
|
||||||
static WSWindowSwitcher& the();
|
static WSWindowSwitcher& the();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue