mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +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
|
@ -4,6 +4,7 @@
|
|||
#include <LibCore/CIODevice.h>
|
||||
|
||||
class CFile final : public CIODevice {
|
||||
C_OBJECT(CFile)
|
||||
public:
|
||||
CFile() {}
|
||||
explicit CFile(const StringView&);
|
||||
|
@ -20,8 +21,6 @@ public:
|
|||
};
|
||||
bool open(int fd, CIODevice::OpenMode, ShouldCloseFileDescription);
|
||||
|
||||
virtual const char* class_name() const override { return "CFile"; }
|
||||
|
||||
private:
|
||||
String m_filename;
|
||||
ShouldCloseFileDescription m_should_close_file_descriptor { ShouldCloseFileDescription::Yes };
|
||||
|
|
|
@ -7,14 +7,13 @@
|
|||
class CTCPSocket;
|
||||
|
||||
class CHttpJob final : public CNetworkJob {
|
||||
C_OBJECT(CHttpJob)
|
||||
public:
|
||||
explicit CHttpJob(const CHttpRequest&);
|
||||
virtual ~CHttpJob() override;
|
||||
|
||||
virtual void start() override;
|
||||
|
||||
virtual const char* class_name() const override { return "CHttpJob"; }
|
||||
|
||||
private:
|
||||
void on_socket_connected();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <LibCore/CObject.h>
|
||||
|
||||
class CIODevice : public CObject {
|
||||
C_OBJECT(CIODevice)
|
||||
public:
|
||||
enum OpenMode {
|
||||
NotOpen = 0,
|
||||
|
@ -52,8 +53,6 @@ public:
|
|||
|
||||
int printf(const char*, ...);
|
||||
|
||||
virtual const char* class_name() const override { return "CIODevice"; }
|
||||
|
||||
protected:
|
||||
explicit CIODevice(CObject* parent = nullptr);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <LibCore/CSocket.h>
|
||||
|
||||
class CLocalSocket final : public CSocket {
|
||||
C_OBJECT(CLocalSocket)
|
||||
public:
|
||||
explicit CLocalSocket(CObject* parent = nullptr);
|
||||
virtual ~CLocalSocket() override;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
class CNetworkResponse;
|
||||
|
||||
class CNetworkJob : public CObject {
|
||||
C_OBJECT(CNetworkJob)
|
||||
public:
|
||||
enum class Error {
|
||||
None,
|
||||
|
@ -24,8 +25,6 @@ public:
|
|||
|
||||
virtual void start() = 0;
|
||||
|
||||
virtual const char* class_name() const override { return "CNetworkJob"; }
|
||||
|
||||
protected:
|
||||
CNetworkJob();
|
||||
void did_finish(NonnullRefPtr<CNetworkResponse>&&);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "CObject.h"
|
||||
|
||||
class CNotifier : public CObject {
|
||||
C_OBJECT(CNotifier)
|
||||
public:
|
||||
enum Event {
|
||||
None = 0,
|
||||
|
@ -12,7 +13,7 @@ public:
|
|||
Exceptional = 4,
|
||||
};
|
||||
CNotifier(int fd, unsigned event_mask);
|
||||
~CNotifier();
|
||||
virtual ~CNotifier() override;
|
||||
|
||||
void set_enabled(bool);
|
||||
|
||||
|
@ -23,8 +24,7 @@ public:
|
|||
unsigned event_mask() const { return m_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& event) override;
|
||||
void event(CEvent&) override;
|
||||
|
||||
private:
|
||||
int m_fd { -1 };
|
||||
|
|
|
@ -11,13 +11,16 @@ class CChildEvent;
|
|||
class CCustomEvent;
|
||||
class CTimerEvent;
|
||||
|
||||
#define C_OBJECT(klass) \
|
||||
public: \
|
||||
virtual const char* class_name() const override { return #klass; }
|
||||
|
||||
class CObject : public Weakable<CObject> {
|
||||
// NOTE: No C_OBJECT macro for CObject itself.
|
||||
public:
|
||||
CObject(CObject* parent = nullptr, bool is_widget = false);
|
||||
virtual ~CObject();
|
||||
|
||||
virtual const char* class_name() const { return "CObject"; }
|
||||
|
||||
virtual const char* class_name() const = 0;
|
||||
virtual void event(CEvent&);
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
|
@ -58,6 +61,8 @@ public:
|
|||
virtual bool is_window() const { return false; }
|
||||
|
||||
protected:
|
||||
CObject(CObject* parent = nullptr, bool is_widget = false);
|
||||
|
||||
virtual void timer_event(CTimerEvent&);
|
||||
virtual void child_event(CChildEvent&);
|
||||
virtual void custom_event(CCustomEvent&);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
class CNotifier;
|
||||
|
||||
class CSocket : public CIODevice {
|
||||
C_OBJECT(CSocket)
|
||||
public:
|
||||
enum class Type {
|
||||
Invalid,
|
||||
|
@ -35,8 +36,6 @@ public:
|
|||
|
||||
Function<void()> on_connected;
|
||||
|
||||
virtual const char* class_name() const override { return "CSocket"; }
|
||||
|
||||
protected:
|
||||
CSocket(Type, CObject* parent);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <LibCore/CSocket.h>
|
||||
|
||||
class CTCPSocket final : public CSocket {
|
||||
C_OBJECT(CTCPSocket)
|
||||
public:
|
||||
explicit CTCPSocket(CObject* parent = nullptr);
|
||||
virtual ~CTCPSocket() override;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <LibCore/CObject.h>
|
||||
|
||||
class CTimer final : public CObject {
|
||||
C_OBJECT(CTimer)
|
||||
public:
|
||||
explicit CTimer(CObject* parent = nullptr);
|
||||
CTimer(int interval, Function<void()>&& timeout_handler, CObject* parent = nullptr);
|
||||
|
@ -29,8 +30,6 @@ public:
|
|||
|
||||
Function<void()> on_timeout;
|
||||
|
||||
virtual const char* class_name() const override { return "CTimer"; }
|
||||
|
||||
private:
|
||||
virtual void timer_event(CTimerEvent&) override;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
|
||||
template <typename ServerMessage, typename ClientMessage>
|
||||
class Connection : public CObject {
|
||||
C_OBJECT(Connection)
|
||||
public:
|
||||
Connection(const StringView& address)
|
||||
: m_notifier(CNotifier(m_connection.fd(), CNotifier::Read))
|
||||
|
|
|
@ -55,8 +55,8 @@ T* new_connection_for_client(Args&& ... args)
|
|||
};
|
||||
|
||||
template <typename ServerMessage, typename ClientMessage>
|
||||
class Connection : public CObject
|
||||
{
|
||||
class Connection : public CObject {
|
||||
C_OBJECT(Connection)
|
||||
public:
|
||||
Connection(int fd, int client_id)
|
||||
: m_socket(fd)
|
||||
|
@ -168,8 +168,6 @@ public:
|
|||
m_notifier.set_enabled(false);
|
||||
}
|
||||
|
||||
const char* class_name() const override { return "Connection"; }
|
||||
|
||||
int client_id() const { return m_client_id; }
|
||||
pid_t client_pid() const { return m_pid; }
|
||||
void set_client_pid(pid_t pid) { m_pid = pid; }
|
||||
|
@ -194,10 +192,9 @@ protected:
|
|||
|
||||
private:
|
||||
// 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:
|
||||
const char* class_name() const override { return "COpenedSocket"; }
|
||||
COpenedSocket(int fd)
|
||||
{
|
||||
set_fd(fd);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
class GPainter;
|
||||
|
||||
class GAbstractButton : public GWidget {
|
||||
C_OBJECT(GAbstractButton)
|
||||
public:
|
||||
virtual ~GAbstractButton() override;
|
||||
|
||||
|
@ -28,7 +29,6 @@ public:
|
|||
bool is_being_pressed() const { return m_being_pressed; }
|
||||
|
||||
virtual void click() = 0;
|
||||
virtual const char* class_name() const override { return "GAbstractButton"; }
|
||||
virtual bool accepts_focus() const override { return true; }
|
||||
virtual bool supports_keyboard_activation() const override { return true; }
|
||||
virtual bool is_uncheckable() const { return true; }
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
class GModelEditingDelegate;
|
||||
|
||||
class GAbstractView : public GScrollableWidget {
|
||||
C_OBJECT(GAbstractView)
|
||||
friend class GModel;
|
||||
|
||||
public:
|
||||
explicit GAbstractView(GWidget* parent);
|
||||
virtual ~GAbstractView() override;
|
||||
|
@ -38,8 +38,6 @@ public:
|
|||
|
||||
Function<OwnPtr<GModelEditingDelegate>(const GModelIndex&)> aid_create_editing_delegate;
|
||||
|
||||
virtual const char* class_name() const override { return "GAbstractView"; }
|
||||
|
||||
protected:
|
||||
virtual void model_notification(const GModelNotification&);
|
||||
virtual void did_scroll() override;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
class GAction;
|
||||
|
||||
class GButton : public GAbstractButton {
|
||||
C_OBJECT(GButton)
|
||||
public:
|
||||
GButton(const StringView& text, GWidget* parent);
|
||||
explicit GButton(GWidget* parent);
|
||||
|
@ -31,7 +32,6 @@ public:
|
|||
|
||||
void set_action(GAction&);
|
||||
|
||||
virtual const char* class_name() const override { return "GButton"; }
|
||||
virtual bool accepts_focus() const override { return m_focusable; }
|
||||
virtual bool supports_keyboard_activation() const override;
|
||||
virtual bool is_uncheckable() const override;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <LibGUI/GAbstractButton.h>
|
||||
|
||||
class GCheckBox : public GAbstractButton {
|
||||
C_OBJECT(GCheckBox)
|
||||
public:
|
||||
GCheckBox(const StringView&, GWidget* parent);
|
||||
explicit GCheckBox(GWidget* parent);
|
||||
|
@ -12,8 +13,6 @@ public:
|
|||
|
||||
virtual void click() override;
|
||||
|
||||
virtual const char* class_name() const override { return "GCheckBox"; }
|
||||
|
||||
private:
|
||||
// These don't make sense for a check box, so hide them.
|
||||
using GAbstractButton::auto_repeat_interval;
|
||||
|
|
|
@ -7,6 +7,7 @@ class GButton;
|
|||
class GTextEditor;
|
||||
|
||||
class GComboBox : public GWidget {
|
||||
C_OBJECT(GComboBox)
|
||||
public:
|
||||
explicit GComboBox(GWidget* parent = nullptr);
|
||||
virtual ~GComboBox() override;
|
||||
|
@ -28,8 +29,6 @@ public:
|
|||
Function<void(const String&)> on_change;
|
||||
Function<void()> on_return_pressed;
|
||||
|
||||
virtual const char* class_name() const override { return "GComboBox"; }
|
||||
|
||||
protected:
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <LibGUI/GWindow.h>
|
||||
|
||||
class GDialog : public GWindow {
|
||||
C_OBJECT(GDialog)
|
||||
public:
|
||||
enum ExecResult {
|
||||
ExecOK = 0,
|
||||
|
@ -18,8 +19,6 @@ public:
|
|||
int result() const { return m_result; }
|
||||
void done(int result);
|
||||
|
||||
virtual const char* class_name() const override { return "GDialog"; }
|
||||
|
||||
protected:
|
||||
explicit GDialog(CObject* parent);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ class GDirectoryModel;
|
|||
class GLabel;
|
||||
|
||||
class GFilePicker final : public GDialog {
|
||||
C_OBJECT(GFilePicker)
|
||||
public:
|
||||
enum class Mode {
|
||||
Open,
|
||||
|
@ -22,8 +23,6 @@ public:
|
|||
|
||||
FileSystemPath selected_file() const { return m_selected_file; }
|
||||
|
||||
virtual const char* class_name() const override { return "GFilePicker"; }
|
||||
|
||||
private:
|
||||
void set_preview(const FileSystemPath&);
|
||||
void clear_preview();
|
||||
|
@ -48,4 +47,4 @@ private:
|
|||
GLabel* m_preview_name_label { nullptr };
|
||||
GLabel* m_preview_geometry_label { nullptr };
|
||||
Mode m_mode { Mode::Open };
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <LibDraw/StylePainter.h>
|
||||
|
||||
class GFrame : public GWidget {
|
||||
C_OBJECT(GFrame)
|
||||
public:
|
||||
explicit GFrame(GWidget* parent = nullptr);
|
||||
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() const { return frame_inner_rect_for_size(size()); }
|
||||
|
||||
virtual const char* class_name() const override { return "GFrame"; }
|
||||
|
||||
protected:
|
||||
void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GGroupBox : public GWidget {
|
||||
C_OBJECT(GGroupBox)
|
||||
public:
|
||||
explicit GGroupBox(GWidget* parent);
|
||||
GGroupBox(const StringView& title, GWidget* parent);
|
||||
|
@ -11,8 +12,6 @@ public:
|
|||
String title() const { return m_title; }
|
||||
void set_title(const StringView&);
|
||||
|
||||
virtual const char* class_name() const override { return "GGroupBox"; }
|
||||
|
||||
protected:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
|
|
@ -6,14 +6,13 @@ class GButton;
|
|||
class GTextEditor;
|
||||
|
||||
class GInputBox : public GDialog {
|
||||
C_OBJECT(GInputBox)
|
||||
public:
|
||||
explicit GInputBox(const StringView& prompt, const StringView& title, CObject* parent = nullptr);
|
||||
virtual ~GInputBox() override;
|
||||
|
||||
String text_value() const { return m_text_value; }
|
||||
|
||||
virtual const char* class_name() const override { return "GInputBox"; }
|
||||
|
||||
private:
|
||||
void build();
|
||||
String m_prompt;
|
||||
|
|
|
@ -9,6 +9,7 @@ class GScrollBar;
|
|||
class Painter;
|
||||
|
||||
class GItemView : public GAbstractView {
|
||||
C_OBJECT(GItemView)
|
||||
public:
|
||||
explicit GItemView(GWidget* parent);
|
||||
virtual ~GItemView() override;
|
||||
|
@ -22,8 +23,6 @@ public:
|
|||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
||||
virtual const char* class_name() const override { return "GItemView"; }
|
||||
|
||||
private:
|
||||
virtual void did_update_model() override;
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
class GraphicsBitmap;
|
||||
|
||||
class GLabel : public GFrame {
|
||||
C_OBJECT(GLabel)
|
||||
public:
|
||||
explicit GLabel(GWidget* parent = nullptr);
|
||||
GLabel(const StringView& text, GWidget* parent = nullptr);
|
||||
|
@ -26,8 +27,6 @@ public:
|
|||
|
||||
void size_to_fit();
|
||||
|
||||
virtual const char* class_name() const override { return "GLabel"; }
|
||||
|
||||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ class GScrollBar;
|
|||
class Painter;
|
||||
|
||||
class GListView : public GAbstractView {
|
||||
C_OBJECT(GListView)
|
||||
public:
|
||||
explicit GListView(GWidget* parent);
|
||||
virtual ~GListView() override;
|
||||
|
@ -26,8 +27,6 @@ public:
|
|||
|
||||
virtual Rect content_rect(const GModelIndex&) const override;
|
||||
|
||||
virtual const char* class_name() const override { return "GListView"; }
|
||||
|
||||
private:
|
||||
virtual void did_update_model() override;
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <LibGUI/GDialog.h>
|
||||
|
||||
class GMessageBox : public GDialog {
|
||||
C_OBJECT(GMessageBox)
|
||||
public:
|
||||
enum class Type {
|
||||
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);
|
||||
|
||||
virtual const char* class_name() const override { return "GMessageBox"; }
|
||||
|
||||
private:
|
||||
bool should_include_ok_button() const;
|
||||
bool should_include_cancel_button() const;
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
#include <LibGUI/GAbstractButton.h>
|
||||
|
||||
class GRadioButton : public GAbstractButton {
|
||||
C_OBJECT(GRadioButton)
|
||||
public:
|
||||
GRadioButton(const StringView& text, GWidget* parent);
|
||||
virtual ~GRadioButton() override;
|
||||
|
||||
virtual const char* class_name() const override { return "GRadioButton"; }
|
||||
|
||||
virtual void click() override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GResizeCorner : public GWidget {
|
||||
C_OBJECT(GResizeCorner)
|
||||
public:
|
||||
explicit GResizeCorner(GWidget* parent);
|
||||
virtual ~GResizeCorner() override;
|
||||
|
||||
virtual const char* class_name() const override { return "GResizeCorner"; }
|
||||
|
||||
protected:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GScrollBar final : public GWidget {
|
||||
C_OBJECT(GScrollBar)
|
||||
public:
|
||||
explicit GScrollBar(Orientation, GWidget* parent);
|
||||
virtual ~GScrollBar() override;
|
||||
|
@ -27,8 +28,6 @@ public:
|
|||
|
||||
Function<void(int)> on_change;
|
||||
|
||||
virtual const char* class_name() const override { return "GScrollBar"; }
|
||||
|
||||
enum Component {
|
||||
Invalid,
|
||||
DecrementButton,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
class GScrollBar;
|
||||
|
||||
class GScrollableWidget : public GFrame {
|
||||
C_OBJECT(GScrollableWidget)
|
||||
public:
|
||||
virtual ~GScrollableWidget() override;
|
||||
|
||||
|
@ -37,8 +38,6 @@ public:
|
|||
int width_occupied_by_vertical_scrollbar() const;
|
||||
int height_occupied_by_horizontal_scrollbar() const;
|
||||
|
||||
virtual const char* class_name() const override { return "GScrollableWidget"; }
|
||||
|
||||
protected:
|
||||
explicit GScrollableWidget(GWidget* parent);
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
|
|
@ -6,6 +6,7 @@ class GButton;
|
|||
class GTextEditor;
|
||||
|
||||
class GSpinBox : public GWidget {
|
||||
C_OBJECT(GSpinBox)
|
||||
public:
|
||||
GSpinBox(GWidget* parent = nullptr);
|
||||
virtual ~GSpinBox() override;
|
||||
|
@ -21,8 +22,6 @@ public:
|
|||
|
||||
Function<void(int value)> on_change;
|
||||
|
||||
virtual const char* class_name() const override { return "GSpinBox"; }
|
||||
|
||||
protected:
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GStackWidget : public GWidget {
|
||||
C_OBJECT(GStackWidget)
|
||||
public:
|
||||
explicit GStackWidget(GWidget* parent);
|
||||
virtual ~GStackWidget() override;
|
||||
|
@ -12,8 +13,6 @@ public:
|
|||
|
||||
Function<void(GWidget*)> on_active_widget_change;
|
||||
|
||||
virtual const char* class_name() const override { return "GStackWidget"; }
|
||||
|
||||
protected:
|
||||
virtual void child_event(CChildEvent&) override;
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
|
|
@ -6,6 +6,7 @@ class GLabel;
|
|||
class GResizeCorner;
|
||||
|
||||
class GStatusBar : public GWidget {
|
||||
C_OBJECT(GStatusBar)
|
||||
public:
|
||||
explicit GStatusBar(GWidget* parent);
|
||||
virtual ~GStatusBar() override;
|
||||
|
@ -13,8 +14,6 @@ public:
|
|||
String text() const;
|
||||
void set_text(const StringView&);
|
||||
|
||||
virtual const char* class_name() const override { return "GStatusBar"; }
|
||||
|
||||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GTabWidget : public GWidget {
|
||||
C_OBJECT(GTabWidget)
|
||||
public:
|
||||
explicit GTabWidget(GWidget* parent);
|
||||
virtual ~GTabWidget() override;
|
||||
|
@ -15,8 +16,6 @@ public:
|
|||
|
||||
void add_widget(const StringView&, GWidget*);
|
||||
|
||||
virtual const char* class_name() const override { return "GTabWidget"; }
|
||||
|
||||
protected:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void child_event(CChildEvent&) override;
|
||||
|
|
|
@ -9,6 +9,7 @@ class GScrollBar;
|
|||
class Painter;
|
||||
|
||||
class GTableView : public GAbstractView {
|
||||
C_OBJECT(GTableView)
|
||||
public:
|
||||
explicit GTableView(GWidget* parent);
|
||||
virtual ~GTableView() override;
|
||||
|
@ -34,8 +35,6 @@ public:
|
|||
|
||||
virtual Rect content_rect(const GModelIndex&) const override;
|
||||
|
||||
virtual const char* class_name() const override { return "GTableView"; }
|
||||
|
||||
private:
|
||||
virtual void did_update_model() override;
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
#include <LibGUI/GTextEditor.h>
|
||||
|
||||
class GTextBox final : public GTextEditor {
|
||||
C_OBJECT(GTextBox)
|
||||
public:
|
||||
explicit GTextBox(GWidget* parent);
|
||||
virtual ~GTextBox() override;
|
||||
|
||||
virtual const char* class_name() const override { return "GTextBox"; }
|
||||
};
|
||||
|
|
|
@ -78,6 +78,7 @@ private:
|
|||
};
|
||||
|
||||
class GTextEditor : public GScrollableWidget {
|
||||
C_OBJECT(GTextEditor)
|
||||
public:
|
||||
enum Type {
|
||||
MultiLine,
|
||||
|
@ -134,8 +135,6 @@ public:
|
|||
Function<void()> on_return_pressed;
|
||||
Function<void()> on_escape_pressed;
|
||||
|
||||
virtual const char* class_name() const override { return "GTextEditor"; }
|
||||
|
||||
GAction& undo_action() { return *m_undo_action; }
|
||||
GAction& redo_action() { return *m_redo_action; }
|
||||
GAction& cut_action() { return *m_cut_action; }
|
||||
|
|
|
@ -45,6 +45,7 @@ void GToolBar::add_action(GAction& action)
|
|||
}
|
||||
|
||||
class SeparatorWidget final : public GWidget {
|
||||
C_OBJECT(SeparatorWidget)
|
||||
public:
|
||||
SeparatorWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
|
@ -63,9 +64,6 @@ public:
|
|||
painter.draw_line({ 0, 0 }, { 0, rect().bottom() }, Color::MidGray);
|
||||
painter.draw_line({ 1, 0 }, { 1, rect().bottom() }, Color::White);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "SeparatorWidget"; }
|
||||
};
|
||||
|
||||
void GToolBar::add_separator()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
class GAction;
|
||||
|
||||
class GToolBar : public GWidget {
|
||||
C_OBJECT(GToolBar)
|
||||
public:
|
||||
explicit GToolBar(GWidget* parent);
|
||||
virtual ~GToolBar() override;
|
||||
|
@ -16,8 +17,6 @@ public:
|
|||
bool has_frame() const { return m_has_frame; }
|
||||
void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
|
||||
|
||||
virtual const char* class_name() const override { return "GToolBar"; }
|
||||
|
||||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
#include <LibGUI/GAbstractView.h>
|
||||
|
||||
class GTreeView : public GAbstractView {
|
||||
C_OBJECT(GTreeView)
|
||||
public:
|
||||
explicit GTreeView(GWidget*);
|
||||
virtual ~GTreeView() override;
|
||||
|
||||
virtual void scroll_into_view(const GModelIndex&, Orientation);
|
||||
virtual const char* class_name() const override { return "GTreeView"; }
|
||||
|
||||
protected:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
|
|
@ -32,6 +32,7 @@ enum class VerticalDirection {
|
|||
};
|
||||
|
||||
class GWidget : public CObject {
|
||||
C_OBJECT(GWidget)
|
||||
public:
|
||||
explicit GWidget(GWidget* parent = nullptr);
|
||||
virtual ~GWidget() override;
|
||||
|
@ -113,8 +114,6 @@ public:
|
|||
HitTestResult hit_test(const Point&);
|
||||
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(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 {
|
||||
C_OBJECT(GWindow)
|
||||
public:
|
||||
GWindow(CObject* parent = nullptr);
|
||||
virtual ~GWindow() override;
|
||||
|
@ -123,8 +124,6 @@ public:
|
|||
|
||||
Vector<GWidget*> focusable_widgets() const;
|
||||
|
||||
virtual const char* class_name() const override { return "GWindow"; }
|
||||
|
||||
protected:
|
||||
virtual void wm_event(GWMEvent&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue