diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-27 20:22:06 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-27 20:22:06 +0100 |
commit | 35c06f15202c580199e71019f215d8b065e44239 (patch) | |
tree | 081992687375f2bf5d0405141bf9c90d0aa31e7f /Userland | |
parent | 90e898b77174ce5df160661a0a9df417a8fee7e9 (diff) | |
download | serenity-35c06f15202c580199e71019f215d8b065e44239.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/guitest2.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/guitest2.cpp b/Userland/guitest2.cpp index 541266cfec..6d23d8bb97 100644 --- a/Userland/guitest2.cpp +++ b/Userland/guitest2.cpp @@ -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; |