1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:07:35 +00:00

LibGUI: More work on GCheckBox.

- Make it track the mouse cursor just like GButton does so that changes only
  get committed if the mouseup event happens while inside the widget rect.

- Draw a focus rect around the box when appropriate.

- When focused, support toggling the checked state with the space bar.
This commit is contained in:
Andreas Kling 2019-01-27 20:22:06 +01:00
parent 90e898b771
commit 35c06f1520
3 changed files with 111 additions and 60 deletions

View file

@ -17,11 +17,15 @@ public:
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 };
};