Commit Graph

18 Commits

Author SHA1 Message Date
Sam Atkins
8f717927f2 LibGUI: Add Button double-click callback 2023-02-19 01:09:09 +01:00
Karol Kosek
14951b92ca LibGUI: Remove deprecated text and set_text functions in AbstractButton
This moves the functions to lambda when registering a property.
External code can now only communicate using the new String API.
2023-02-13 00:45:09 +00:00
Karol Kosek
fca29eae09 LibGUI: Store text using the new String class in the AbstractButton
This change also adds non-deprecated text() and set_text() functions and
helper constructors for Button, CheckBox, and RadioButton to call the
strings directly.

The whole codebase at this point is still using the deprecated string
functions, which the class will quietly convert to a new String.
2023-02-13 00:45:09 +00:00
Karol Kosek
d32b052f22 LibGUI+Userland: Add _deprecated suffix to AbstractButton::{set_,}text 2023-02-13 00:45:09 +00:00
Lucas CHOLLET
d4ef2e226c LibGUI: Mimic a user click when calling Button::click()
The `mimic_pressed` function was primarily used in one place, the
Calculator. This patch removes quite a lot of logic duplication there.
It is also profitable to a lot of other places where `click()` was
called without mimicking a click.
2023-01-21 14:49:46 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Timothy Flynn
234ae3a2ae LibGUI: Allow buttons to control the behavior when their text changes
Some buttons control how their text is set in unique ways. For example,
GUI::ToolbarButton will set only its tooltip instead of its text if it
has an icon. So when the text changes, ToolbarButton will want to change
its tooltip instead.
2022-11-26 09:02:25 +01:00
networkException
f9212ac02e LibGUI: Add button handler for middle mouse clicks 2022-07-14 13:17:33 +02:00
networkException
18c84d2e63 LibGUI: Allow specifying the mouse buttons able to press down a button
This patch adds the ability to modify the set of mouse buttons able to
press down a button
2022-07-14 13:17:33 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Lenny Maiorani
fe3b846ac8 Libraries: Use default constructors/destructors in LibGUI
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-12 14:44:43 -08:00
FrHun
34844dd547 LibGUI: Refine AbstractButton pressing behaviour
Previously the code couldn't handle leaving the AbstractButton through
tab, while having it pressed through space or enter.
2021-09-27 16:29:50 +02:00
thankyouverycool
92fffc3abc LibGUI: Rename CallOnChange => AllowCallback and implement elsewhere
This is a helpful option to prevent unwanted side effects, distinguish
between user and programmatic input, etc. Sliders and SpinBoxes were
implementing it idiosyncratically, so let's generalize the API and
give Buttons and TextEditors the same ability.
2021-09-22 21:35:42 +02:00
sin-ack
4c9c85ac01 Userland: Make TextWrapping::Wrap opt-in
This was breaking many places which didn't expect text to wrap. Now,
the only place where text currently wraps is in GUI::Label.
2021-07-27 22:05:20 +02:00
sin-ack
e11940fd01 Userland: Move text wrapping/elision into the new TextLayout :^)
This class now contains all the fun bits about laying out text in a
rect. It will handle line wrapping at a certain width, cutting off lines
that don't fit the given rect, and handling text elision.
Painter::draw_text now internally uses this.

Future work here would be not laying out text twice (once actually
preparing the lines to be rendered and once to get the bounding box),
and possibly adding left elision if necessary.

Additionally, this commit makes the Utf32View versions of
Painter::draw_text convert to Utf8View internally. The intention is to
completely remove those versions, but they're kept at the moment to keep
the scope of this PR small.
2021-07-26 21:14:39 +04:30
Matthew Jones
af72b5ec82 LibGUI: Show pressed state for Space and Return key events
Also allows the user to press Esc while the button is being pressed
to cancel the button action.
2021-06-03 00:33:26 +01:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00