Commit graph

14 commits

Author SHA1 Message Date
Andreas Kling
aef56159a8 LibGUI: Add Widget focus policies
Every widget now has a GUI::FocusPolicy that determines how it can
receive focus:

- NoFocus: The widget is not focusable (default)
- TabFocus: The widget can be focused using the tab key.
- ClickFocus: The widget can be focused by clicking on it.
- StrongFocus: Both of the above.

For widgets that have a focus proxy, getting/setting the focus policy
will affect the proxy instead.
2020-10-30 17:03:28 +01:00
Tibor Nagy
1fa5a526e8 LibGUI: Use on_up_pressed/on_down_pressed events in SpinBox
Fixes keyboard increment/decrement of SpinBox values.

After PR #2412 the TextBox class started not propagating arrow key
events to the parent widgets because it handles them itself now.
It also added two new events for these arrow keys, so use them instead
in SpinBox.
2020-09-23 20:44:23 +02:00
thankyouverycool
c90fe7ce93 LibGUI: Use ControlBoxButtons in SpinBox and ComboBox
Converts the buttons of these widgets into ControlBoxButtons.
2020-07-20 21:03:48 +02:00
Benoît Lormeau
951a429268 LibGUI: SpinBox: update the displayed value when set_range() clamps it
Consider the following: upon instanciation of a GUI::SpinBox, its
internal value and displayed value are both 0. When calling `set_min(1)`
on it (same as `set_range(1, max())`), the internal value gets clamped
to 1 correctly, but "0" is still displayed by the widget.

The displayed value is now updated accordingly to the internal value
when it gets clamped.
2020-06-29 14:57:36 +02:00
Andreas Kling
fdfda6dec2 AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature:

- int StringType::to_int(bool& ok) const

And replace it with sensible new signature:

- Optional<int> StringType::to_int() const
2020-06-12 21:28:55 +02:00
Hüseyin ASLITÜRK
d18f6e82eb LibGUI: Replace up and down arrows with emoji 2020-05-20 13:40:24 +02:00
Andreas Kling
977863ea07 LibGUI: Include keyboard modifier state with button on_click calls
This will allow you us to implement special behavior when Ctrl+clicking
a button.
2020-05-12 20:31:16 +02:00
Andreas Kling
0f0d73d1b5 LibGUI: Make the "enabled" widget state propagate to child widgets
This simplifies building composite widgets by not having to worry about
updating widget subtrees.
2020-05-08 13:49:58 +02:00
Hüseyin ASLITÜRK
f0f98de5d8 LibGUI: Fix for disable state of SpinBox 2020-05-08 09:49:41 +02:00
Andreas Kling
a26b63a958 LibGUI: Remove Button& parameter from Button::on_click hook
There was but a single user of this parameter and it's a bit tedious
to write it out every time, so let's get rid of it.
2020-03-03 17:02:38 +01:00
Tibor Nagy
5f913c67d9 LibGUI: Implement keyboard and mouse wheel events for SpinBox 2020-02-24 10:40:32 +01:00
Andreas Kling
c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Andreas Kling
45c25ffecd LibGUI: Use Core::Object::add() a whole bunch 2020-02-23 11:10:52 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Renamed from Libraries/LibGUI/GSpinBox.cpp (Browse further)