summaryrefslogtreecommitdiff
path: root/LibGUI/GCheckBox.h
blob: 4d3ddde3733f95527dc612d684eeeb494425ff6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include "GWidget.h"
#include <AK/AKString.h>

class GCheckBox final : public GWidget {
public:
    explicit GCheckBox(GWidget* parent);
    virtual ~GCheckBox() override;

    String caption() const { return m_caption; }
    void set_caption(String&&);

    bool is_checked() const { return m_checked; }
    void set_checked(bool);

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 const char* class_name() const override { return "GCheckBox"; }
    virtual bool accepts_focus() const override { return true; }

    String m_caption;
    bool m_checked { false };
    bool m_being_modified { false };
    bool m_tracking_cursor { false };
};