1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:07:34 +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

@ -14,6 +14,7 @@
#include <LibGUI/GButton.h>
#include <LibGUI/GEventLoop.h>
#include <LibGUI/GTextBox.h>
#include <LibGUI/GCheckBox.h>
static GWindow* make_font_test_window();
static GWindow* make_launcher_window();
@ -117,6 +118,10 @@ GWindow* make_launcher_window()
auto* other_textbox = new GTextBox(widget);
other_textbox->set_relative_rect({ 5, 140, 90, 20 });
auto* checkbox = new GCheckBox(widget);
checkbox->set_relative_rect({ 5, 170, 90, 20 });
checkbox->set_caption("CheckBox");
window->set_focused_widget(textbox);
return window;