mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 11:57: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:
parent
90e898b771
commit
35c06f1520
3 changed files with 111 additions and 60 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue