summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/AbstractButton.cpp
AgeCommit message (Collapse)Author
2023-02-13LibGUI: Store text using the new String class in the AbstractButtonKarol Kosek
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-13LibGUI+Userland: Add `_deprecated` suffix to AbstractButton::{set_,}textKarol Kosek
2023-01-21LibGUI: Mimic a user click when calling `Button::click()`Lucas CHOLLET
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.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
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-09-12Everywhere: Use my very shiny serenityos.org email :^)networkException
2022-09-08LibGUI: Simulate a click on arrow key events for AbstractButtonsthankyouverycool
in exclusive, checkable groups. Instead of merely setting the button checked, call click() so buttons with registered actions can activate. Fixes ActionGroups like FileManager's view type checkables not activating when cycled with the keyboard.
2022-09-08LibGUI+Taskbar: Don't immediately repaint checkable Buttonsthankyouverycool
Unlike regular buttons, unchecked checkables don't need to repaint on MouseUp to feel responsive when clicking rapidly. In fact, this can lead to a flickering effect when a bogus unchecked state gets painted again before the button's checked one.
2022-09-03LibGUI: Stop auto repeat timer for Buttons on EnabledChange eventsthankyouverycool
Since 5064b58 SpinBox buttons are disabled if value reaches the min or max allowed. Consequently this swallows the final MouseUp event, leaving the repeat timer running. Fixes SpinBoxes {dec,inc}rementing their value in perpetuity after min/max value is reached through button clicking.
2022-07-14LibGUI: Add button handler for middle mouse clicksnetworkException
2022-07-14LibGUI: Allow specifying the mouse buttons able to press down a buttonnetworkException
This patch adds the ability to modify the set of mouse buttons able to press down a button
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-12Libraries: Use default constructors/destructors in LibGUILenny Maiorani
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-05Base+LibGUI+LibGfx: Improve disabled text readabilityJaime Valenzuela Durán
Currently, disabled text colors are hardcoded. They look good in Default and light themes, but no so good in dark ones. This PR adds new variables for all themes to correctly display disabled text.
2021-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-10-23LibGUI: Repaint buttons immediately on mouse up/down eventsAndreas Kling
This ensures that rapidly clicking a button doesn't look like it's "swallowing" some of the mouse events. This already worked okay due to a hack in Window, but this will allow us to get rid of that hack.
2021-10-23LibGUI: Make exclusive button group act as a single focusable unitAndreas Kling
Before this change, using the Tab key would cycle through all the individual buttons in an exclusive group (e.g radio buttons.) This felt wrong, since a group of exclusive buttons is really a single logical input with a limited number of possible choices. This patch makes such groups behave as a single focusable unit instead, by dynamically updating the focus policies so that only the currently checked button is focusable. We also allow keyboard navigation within the button group via the arrow keys. This had to be specialized in GUI::AbstractButton, since the default behavior of arrow keys is to traverse the focus chain.
2021-09-27LibGUI: Refine AbstractButton pressing behaviourFrHun
Previously the code couldn't handle leaving the AbstractButton through tab, while having it pressed through space or enter.
2021-09-22LibGUI: Rename CallOnChange => AllowCallback and implement elsewherethankyouverycool
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-08-03LibGUI: Redraw button on Key_{Return,Space} up eventLuK1337
Fixes buttons not getting redrawn after pressing them with return or space key.
2021-07-27Userland: Make TextWrapping::Wrap opt-insin-ack
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-26Userland: Move text wrapping/elision into the new TextLayout :^)sin-ack
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-13LibGUI: Select radio buttons with keyboardAriel Don
2021-06-03LibGUI: Show pressed state for Space and Return key eventsMatthew Jones
Also allows the user to press Esc while the button is being pressed to cancel the button action.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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-01-12Libraries: Move to Userland/Libraries/Andreas Kling