1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 11:25:08 +00:00

Merge remote-tracking branch 'origin/master' into serenity-keys

This commit is contained in:
faissaloo 2019-06-15 21:55:17 +01:00
commit b635c3db54
527 changed files with 9637 additions and 5614 deletions

View file

@ -11,9 +11,12 @@ public:
Function<void(bool)> on_checked;
void set_text(const String&);
void set_text(const StringView&);
const String& text() const { return m_text; }
bool is_exclusive() const { return m_exclusive; }
void set_exclusive(bool b) { m_exclusive = b; }
bool is_checked() const { return m_checked; }
void set_checked(bool);
@ -30,7 +33,7 @@ public:
protected:
explicit GAbstractButton(GWidget* parent);
GAbstractButton(const String&, GWidget* parent);
GAbstractButton(const StringView&, GWidget* parent);
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
@ -43,9 +46,20 @@ protected:
void paint_text(GPainter&, const Rect&, const Font&, TextAlignment);
private:
virtual bool is_abstract_button() const final { return true; }
String m_text;
bool m_checked { false };
bool m_checkable { false };
bool m_hovered { false };
bool m_being_pressed { false };
bool m_exclusive { false };
};
template<>
inline bool is<GAbstractButton>(const CObject& object)
{
if (!is<GWidget>(object))
return false;
return to<GWidget>(object).is_abstract_button();
}