mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibGUI: Mass coding style fixes.
This commit is contained in:
parent
6c4f1bad09
commit
d66b0f7dd8
15 changed files with 178 additions and 178 deletions
|
@ -13,87 +13,87 @@ class GWindow;
|
|||
class GWidget : public GObject {
|
||||
public:
|
||||
explicit GWidget(GWidget* parent = nullptr);
|
||||
virtual ~GWidget();
|
||||
virtual ~GWidget() override;
|
||||
|
||||
virtual void event(GEvent&) override;
|
||||
virtual void paintEvent(GPaintEvent&);
|
||||
virtual void showEvent(GShowEvent&);
|
||||
virtual void hideEvent(GHideEvent&);
|
||||
virtual void keyDownEvent(GKeyEvent&);
|
||||
virtual void keyUpEvent(GKeyEvent&);
|
||||
virtual void mouseMoveEvent(GMouseEvent&);
|
||||
virtual void mouseDownEvent(GMouseEvent&);
|
||||
virtual void mouseUpEvent(GMouseEvent&);
|
||||
virtual void paint_event(GPaintEvent&);
|
||||
virtual void show_event(GShowEvent&);
|
||||
virtual void hide_event(GHideEvent&);
|
||||
virtual void keydown_event(GKeyEvent&);
|
||||
virtual void keyup_event(GKeyEvent&);
|
||||
virtual void mousemove_event(GMouseEvent&);
|
||||
virtual void mousedown_event(GMouseEvent&);
|
||||
virtual void mouseup_event(GMouseEvent&);
|
||||
|
||||
Rect relativeRect() const { return m_relativeRect; }
|
||||
Point relativePosition() const { return m_relativeRect.location(); }
|
||||
Rect relative_rect() const { return m_relative_rect; }
|
||||
Point relative_position() const { return m_relative_rect.location(); }
|
||||
|
||||
int x() const { return m_relativeRect.x(); }
|
||||
int y() const { return m_relativeRect.y(); }
|
||||
int width() const { return m_relativeRect.width(); }
|
||||
int height() const { return m_relativeRect.height(); }
|
||||
int x() const { return m_relative_rect.x(); }
|
||||
int y() const { return m_relative_rect.y(); }
|
||||
int width() const { return m_relative_rect.width(); }
|
||||
int height() const { return m_relative_rect.height(); }
|
||||
|
||||
Rect rect() const { return { 0, 0, width(), height() }; }
|
||||
Size size() const { return m_relativeRect.size(); }
|
||||
Size size() const { return m_relative_rect.size(); }
|
||||
|
||||
void update();
|
||||
void repaint(const Rect&);
|
||||
|
||||
bool isFocused() const;
|
||||
void setFocus(bool);
|
||||
bool is_focused() const;
|
||||
void set_focus(bool);
|
||||
|
||||
struct HitTestResult {
|
||||
GWidget* widget { nullptr };
|
||||
int localX { 0 };
|
||||
int localY { 0 };
|
||||
};
|
||||
HitTestResult hitTest(int x, int y);
|
||||
HitTestResult hit_test(int x, int y);
|
||||
|
||||
virtual const char* class_name() const override { return "GWidget"; }
|
||||
|
||||
void setWindowRelativeRect(const Rect&, bool should_update = true);
|
||||
void set_relative_rect(const Rect&, bool should_update = true);
|
||||
|
||||
Color backgroundColor() const { return m_backgroundColor; }
|
||||
Color foregroundColor() const { return m_foregroundColor; }
|
||||
Color background_color() const { return m_background_color; }
|
||||
Color foreground_color() const { return m_foreground_color; }
|
||||
|
||||
void setBackgroundColor(Color color) { m_backgroundColor = color; }
|
||||
void setForegroundColor(Color color) { m_foregroundColor = color; }
|
||||
void set_background_color(Color color) { m_background_color = color; }
|
||||
void set_foreground_color(Color color) { m_foreground_color = color; }
|
||||
|
||||
GWindow* window()
|
||||
{
|
||||
if (auto* pw = parentWidget())
|
||||
if (auto* pw = parent_widget())
|
||||
return pw->window();
|
||||
return m_window;
|
||||
}
|
||||
|
||||
const GWindow* window() const
|
||||
{
|
||||
if (auto* pw = parentWidget())
|
||||
if (auto* pw = parent_widget())
|
||||
return pw->window();
|
||||
return m_window;
|
||||
}
|
||||
|
||||
void set_window(GWindow*);
|
||||
|
||||
GWidget* parentWidget() { return static_cast<GWidget*>(parent()); }
|
||||
const GWidget* parentWidget() const { return static_cast<const GWidget*>(parent()); }
|
||||
GWidget* parent_widget() { return static_cast<GWidget*>(parent()); }
|
||||
const GWidget* parent_widget() const { return static_cast<const GWidget*>(parent()); }
|
||||
|
||||
void setFillWithBackgroundColor(bool b) { m_fillWithBackgroundColor = b; }
|
||||
bool fillWithBackgroundColor() const { return m_fillWithBackgroundColor; }
|
||||
void set_fill_with_background_color(bool b) { m_fill_with_background_color = b; }
|
||||
bool fill_with_background_color() const { return m_fill_with_background_color; }
|
||||
|
||||
const Font& font() const { return *m_font; }
|
||||
void setFont(RetainPtr<Font>&&);
|
||||
void set_font(RetainPtr<Font>&&);
|
||||
|
||||
GraphicsBitmap* backing();
|
||||
|
||||
private:
|
||||
GWindow* m_window { nullptr };
|
||||
|
||||
Rect m_relativeRect;
|
||||
Color m_backgroundColor { 0xffffff };
|
||||
Color m_foregroundColor { 0x000000 };
|
||||
Rect m_relative_rect;
|
||||
Color m_background_color { 0xffffff };
|
||||
Color m_foreground_color { 0x000000 };
|
||||
RetainPtr<Font> m_font;
|
||||
|
||||
bool m_hasPendingPaintEvent { false };
|
||||
bool m_fillWithBackgroundColor { true };
|
||||
bool m_has_pending_paint_event { false };
|
||||
bool m_fill_with_background_color { true };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue