2019-01-20 06:49:48 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GWidget.h"
|
|
|
|
#include <AK/AKString.h>
|
2019-03-06 14:52:41 +03:00
|
|
|
#include <AK/Function.h>
|
2019-01-20 06:49:48 +03:00
|
|
|
|
|
|
|
class GCheckBox final : public GWidget {
|
|
|
|
public:
|
|
|
|
explicit GCheckBox(GWidget* parent);
|
|
|
|
virtual ~GCheckBox() override;
|
|
|
|
|
|
|
|
String caption() const { return m_caption; }
|
2019-01-21 02:46:08 +03:00
|
|
|
void set_caption(String&&);
|
2019-01-20 06:49:48 +03:00
|
|
|
|
2019-01-21 02:46:08 +03:00
|
|
|
bool is_checked() const { return m_checked; }
|
|
|
|
void set_checked(bool);
|
2019-01-20 06:49:48 +03:00
|
|
|
|
2019-03-06 14:52:41 +03:00
|
|
|
Function<void(GCheckBox&, bool)> on_change;
|
|
|
|
|
2019-03-16 14:57:04 +03:00
|
|
|
virtual const char* class_name() const override { return "GCheckBox"; }
|
|
|
|
|
2019-01-20 06:49:48 +03:00
|
|
|
private:
|
2019-01-21 02:46:08 +03:00
|
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
|
|
virtual void mousedown_event(GMouseEvent&) override;
|
2019-01-27 22:22:06 +03:00
|
|
|
virtual void mouseup_event(GMouseEvent&) override;
|
|
|
|
virtual void mousemove_event(GMouseEvent&) override;
|
|
|
|
virtual void keydown_event(GKeyEvent&) override;
|
2019-01-26 13:24:16 +03:00
|
|
|
virtual bool accepts_focus() const override { return true; }
|
2019-01-20 06:49:48 +03:00
|
|
|
|
|
|
|
String m_caption;
|
2019-01-21 02:46:08 +03:00
|
|
|
bool m_checked { false };
|
2019-01-27 22:22:06 +03:00
|
|
|
bool m_being_modified { false };
|
2019-01-20 06:49:48 +03:00
|
|
|
};
|
|
|
|
|