mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 10:07:34 +00:00
LibGUI: Make GCheckBox inherit from GAbstractButton.
This commit is contained in:
parent
21c56477b0
commit
677794f30d
9 changed files with 25 additions and 97 deletions
|
@ -1,34 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include "GWidget.h"
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <LibGUI/GAbstractButton.h>
|
||||
|
||||
class GCheckBox final : public GWidget {
|
||||
class GCheckBox : public GAbstractButton {
|
||||
public:
|
||||
explicit GCheckBox(GWidget* parent);
|
||||
virtual ~GCheckBox() override;
|
||||
|
||||
String caption() const { return m_caption; }
|
||||
void set_caption(const String&);
|
||||
|
||||
bool is_checked() const { return m_checked; }
|
||||
void set_checked(bool);
|
||||
|
||||
Function<void(GCheckBox&, bool)> on_change;
|
||||
virtual void click() override;
|
||||
|
||||
virtual const char* class_name() const override { return "GCheckBox"; }
|
||||
|
||||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mouseup_event(GMouseEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
virtual void keydown_event(GKeyEvent&) override;
|
||||
virtual bool accepts_focus() const override { return true; }
|
||||
|
||||
String m_caption;
|
||||
bool m_checked { false };
|
||||
bool m_being_modified { false };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue