mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibGUI: Make class_name() public so you can always call it.
I found myself having to cast to GWidget* all the time when writing some generic debugging code that just wanted to dump widget info.
This commit is contained in:
parent
955a0ff477
commit
eb610b309e
11 changed files with 22 additions and 13 deletions
|
@ -23,6 +23,8 @@ public:
|
||||||
void set_button_style(GButtonStyle style) { m_button_style = style; }
|
void set_button_style(GButtonStyle style) { m_button_style = style; }
|
||||||
GButtonStyle button_style() const { return m_button_style; }
|
GButtonStyle button_style() const { return m_button_style; }
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GButton"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
|
@ -31,8 +33,6 @@ private:
|
||||||
virtual void enter_event(GEvent&) override;
|
virtual void enter_event(GEvent&) override;
|
||||||
virtual void leave_event(GEvent&) override;
|
virtual void leave_event(GEvent&) override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GButton"; }
|
|
||||||
|
|
||||||
String m_caption;
|
String m_caption;
|
||||||
RetainPtr<GraphicsBitmap> m_icon;
|
RetainPtr<GraphicsBitmap> m_icon;
|
||||||
GButtonStyle m_button_style { GButtonStyle::Normal };
|
GButtonStyle m_button_style { GButtonStyle::Normal };
|
||||||
|
|
|
@ -17,13 +17,14 @@ public:
|
||||||
|
|
||||||
Function<void(GCheckBox&, bool)> on_change;
|
Function<void(GCheckBox&, bool)> on_change;
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GCheckBox"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
virtual void mouseup_event(GMouseEvent&) override;
|
virtual void mouseup_event(GMouseEvent&) override;
|
||||||
virtual void mousemove_event(GMouseEvent&) override;
|
virtual void mousemove_event(GMouseEvent&) override;
|
||||||
virtual void keydown_event(GKeyEvent&) override;
|
virtual void keydown_event(GKeyEvent&) override;
|
||||||
virtual const char* class_name() const override { return "GCheckBox"; }
|
|
||||||
virtual bool accepts_focus() const override { return true; }
|
virtual bool accepts_focus() const override { return true; }
|
||||||
|
|
||||||
String m_caption;
|
String m_caption;
|
||||||
|
|
|
@ -5,6 +5,7 @@ public:
|
||||||
GFilePicker();
|
GFilePicker();
|
||||||
virtual ~GFilePicker() override;
|
virtual ~GFilePicker() override;
|
||||||
|
|
||||||
private:
|
|
||||||
virtual const char* class_name() const override { return "GFilePicker"; }
|
virtual const char* class_name() const override { return "GFilePicker"; }
|
||||||
|
|
||||||
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,11 +22,11 @@ public:
|
||||||
TextAlignment text_alignment() const { return m_text_alignment; }
|
TextAlignment text_alignment() const { return m_text_alignment; }
|
||||||
void set_text_alignment(TextAlignment text_alignment) { m_text_alignment = text_alignment; }
|
void set_text_alignment(TextAlignment text_alignment) { m_text_alignment = text_alignment; }
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GLabel"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GLabel"; }
|
|
||||||
|
|
||||||
String m_text;
|
String m_text;
|
||||||
RetainPtr<GraphicsBitmap> m_icon;
|
RetainPtr<GraphicsBitmap> m_icon;
|
||||||
TextAlignment m_text_alignment { TextAlignment::Center };
|
TextAlignment m_text_alignment { TextAlignment::Center };
|
||||||
|
|
|
@ -10,10 +10,11 @@ public:
|
||||||
void add_item(String&&);
|
void add_item(String&&);
|
||||||
int selected_index() const { return m_selected_index; }
|
int selected_index() const { return m_selected_index; }
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GListBox"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
virtual const char* class_name() const override { return "GListBox"; }
|
|
||||||
virtual bool accepts_focus() const override { return true; }
|
virtual bool accepts_focus() const override { return true; }
|
||||||
|
|
||||||
Rect item_rect(int index) const;
|
Rect item_rect(int index) const;
|
||||||
|
|
|
@ -24,12 +24,13 @@ public:
|
||||||
|
|
||||||
Function<void(int)> on_change;
|
Function<void(int)> on_change;
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GScrollBar"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
virtual void mouseup_event(GMouseEvent&) override;
|
virtual void mouseup_event(GMouseEvent&) override;
|
||||||
virtual void mousemove_event(GMouseEvent&) override;
|
virtual void mousemove_event(GMouseEvent&) override;
|
||||||
virtual const char* class_name() const override { return "GScrollBar"; }
|
|
||||||
|
|
||||||
int button_size() const { return orientation() == Orientation::Vertical ? width() : height(); }
|
int button_size() const { return orientation() == Orientation::Vertical ? width() : height(); }
|
||||||
Rect up_button_rect() const;
|
Rect up_button_rect() const;
|
||||||
|
|
|
@ -10,12 +10,12 @@ public:
|
||||||
GWidget* active_widget() const { return m_active_widget; }
|
GWidget* active_widget() const { return m_active_widget; }
|
||||||
void set_active_widget(GWidget*);
|
void set_active_widget(GWidget*);
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GStackWidget"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void child_event(GChildEvent&) override;
|
virtual void child_event(GChildEvent&) override;
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual const char* class_name() const override { return "GStackWidget"; }
|
|
||||||
|
|
||||||
GWidget* m_active_widget { nullptr };
|
GWidget* m_active_widget { nullptr };
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,9 @@ public:
|
||||||
String text() const;
|
String text() const;
|
||||||
void set_text(String&&);
|
void set_text(String&&);
|
||||||
|
|
||||||
private:
|
|
||||||
virtual const char* class_name() const override { return "GStatusBar"; }
|
virtual const char* class_name() const override { return "GStatusBar"; }
|
||||||
|
|
||||||
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
GLabel* m_label { nullptr };
|
GLabel* m_label { nullptr };
|
||||||
|
|
|
@ -14,8 +14,9 @@ public:
|
||||||
Function<void(GTextBox&)> on_return_pressed;
|
Function<void(GTextBox&)> on_return_pressed;
|
||||||
Function<void(GTextBox&)> on_change;
|
Function<void(GTextBox&)> on_change;
|
||||||
|
|
||||||
private:
|
|
||||||
virtual const char* class_name() const override { return "GTextBox"; }
|
virtual const char* class_name() const override { return "GTextBox"; }
|
||||||
|
|
||||||
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
virtual void keydown_event(GKeyEvent&) override;
|
virtual void keydown_event(GKeyEvent&) override;
|
||||||
|
|
|
@ -100,6 +100,8 @@ public:
|
||||||
|
|
||||||
Function<void(GTextEditor&)> on_return_pressed;
|
Function<void(GTextEditor&)> on_return_pressed;
|
||||||
|
|
||||||
|
virtual const char* class_name() const override { return "GTextEditor"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
|
@ -12,8 +12,9 @@ public:
|
||||||
void add_action(Retained<GAction>&&);
|
void add_action(Retained<GAction>&&);
|
||||||
void add_separator();
|
void add_separator();
|
||||||
|
|
||||||
private:
|
|
||||||
virtual const char* class_name() const override { return "GToolBar"; }
|
virtual const char* class_name() const override { return "GToolBar"; }
|
||||||
|
|
||||||
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
struct Item {
|
struct Item {
|
||||||
|
|
Loading…
Add table
Reference in a new issue