summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/ComboBox.cpp
AgeCommit message (Collapse)Author
2023-04-30LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStylethankyouverycool
Previously, Frames could set both these properties along with a thickness to confusing effect: Most shapes of the same shadowing only differentiated at a thickness >= 2, and some not at all. This led to a lot of creative but ultimately superfluous choices in the code. Instead let's streamline our options, automate thickness, and get the right look without so much guesswork. Plain shadowing has been consolidated into a single Plain style, and 0 thickness can be had by setting style to NoFrame.
2023-04-04LibGUI: Open and increment ComboBox ListViews by exact stepsthankyouverycool
This feels a bit nicer and always places the current index at the top of visible content in long scrollable lists.
2023-04-04LibGUI: Allow ComboBox windows to intersect Desktop's entire heightthankyouverycool
Minus a tasteful item height remainder. Ignoring Taskbar is okay now that the window is a PopUp. Also expands its width if intersection with the Desktop makes its ListView scrollable. ComboBox windows no longer intersect horizontally, remaining firmly "attached" to the editor, similar to other classic UIs.
2023-04-04LibGUI: Remove calculated_min_size() for ListViewsthankyouverycool
Originally implemented to handle resizable ComboBox windows, this "feature" no longer exists, so calculating min size is no longer necessary. The calculation was also failing to account for dynamic ListViews properly. This patch simplifies things by setting ComboBox ListView's minimum size explicitly and deferring to AbstractScrollableWidget's more flexible calculated implementation otherwise. Fixes FontPicker resizing incorrectly due to overly rigid ListViews.
2023-03-16LibCore+Userland: Add DEPRECATED infix to REGISTER_STRING_PROPERTY macroKarol Kosek
2023-01-26LibGfx: Remove `try_` prefix from bitmap creation functionsTim Schumacher
Those don't have any non-try counterpart, so we might as well just omit it.
2023-01-06LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)Sam Atkins
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
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-11-19LibGUI: Don't search ComboBox Windows when holding a mod keythankyouverycool
2022-11-19LibGUI+WindowServer+Applets+Taskbar: Remove active input conceptsthankyouverycool
and the CaptureInput mode. They are a source of unneeded complexity in WindowServer and have proven prone to regressions, so this patch replaces them with a simple input preemption scheme using Popups. Popup windows now have ergonomics similar to menus: When open, a popup preempts all mouse and key events for the entire window stack; however, they are fragile and will close after WindowServer swallows the first event outside them. This is similar to how combo box windows and popups work in the classic Windows DE and has the added benefit of letting the user click anywhere to dismiss a popup without having to worry about unwanted interactions with other widgets.
2022-11-19LibGUI+WindowServer: Remove InputPreemptor conceptthankyouverycool
This functionality will be superceded by WindowType:Popups
2022-11-19LibGUI: Accept() mouse wheel events in {Spin,Combo}Boxesthankyouverycool
Prevents ScrollableContainerWidgets from moving when changing values in embedded widgets with the mouse wheel.
2022-10-26LibGUI: Make sure combobox list windows can't be movedGunnar Beutner
This is done by adding a new window type (Popup) and using it for the combobox list window. Other incorrect uses of the Tooltip window type have also been updated to use the new window type.
2022-10-25LibGUI: Remove Window::set_blocks_command_palette()demostanis
Since the logic to open the command palette is now in the form of an action, its keybinding is only bound when the window active. Thus, when a combo box or the emoji input dialog is active, the window isn't, and the command palette doesn't show up, without requiring special checks.
2022-09-22LibGUI: Hide unnecessary Scrollbars in ComboBox windowsthankyouverycool
And simplify rect calculations using content size.
2022-09-22LibGUI: Allow setting max visible items for ComboBoxesthankyouverycool
This will govern the maximum number of items ComboBox windows display before scrolling content.
2022-09-22LibGUI: Don't show empty ComboBox windowsthankyouverycool
2022-09-22LibGUI: Don't open windows for editable ComboBoxes when typingthankyouverycool
Fixes inability to type custom values into ComboBox editors. CaptureInput preempts typing while the ListView window is open. For now, searching can still be done by manually opening the window.
2022-09-22LibGUI: Always activate ComboBox ListView selections on MouseUpthankyouverycool
Fixes having to doubleclick selected items to activate them if the selection index hasn't changed since last activation.
2022-09-22LibGUI: Block ComboBox windows from using CommandPalettethankyouverycool
2022-09-08LibGUI+WindowServer: Notify Windows on input preemptionthankyouverycool
Previously Menus set themselves as active input solely to make sure CaptureInput modals would close, but this is a functional half-truth. Menus don't actually use the active input role; they preempt normal Windows during event handling instead. Now the active input window is notified on preemption and Menus can remain outside the active input concept. This lets us make more granular choices about modal behavior. For now, the only thing clients care about is menu preemption on popup. Fixes windows which close on changes to active input closing on their own context menus.
2022-08-25LibGUI+WindowServer+Apps: Replace Accessory Windowsthankyouverycool
with the CaptureInput WindowMode. This mode will serve the same function as accessories: redirecting input while allowing parent windows to remain active.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-08LibGUI: Support typing to search for ComboBoxzzLinus
LibGUI: Fixup missing one charactor issue
2022-06-28LibGUI: Use new layout system for basic widgetsFrHun
2022-06-17LibGUI: Actually update the selection in ComboBox::set_selected_indexnetworkException
Previously we would not set m_selected_index or the editor's text value when calling set_selected_index.
2022-06-17LibGUI: Add clear_selection helper for ComboBoxnetworkException
This patch adds a helper to ComboBox allowing it to clear the current selection and show a blank editor.
2022-05-12LibGUI: Add AllowCallback parameter to ComboBox::set_text()Sam Atkins
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-01-20Userland: Add horizontal mouse scroll supportDmitry Petrov
2021-11-30LibGUI+FontEditor: Allow ComboBox on_change callback to be toggledthankyouverycool
When calling set_selected_index() on ComboBox, allow its on_change callback to be disabled. Fixes FontEditor window state erroneously switching to modified when initializing between different slopes and weights.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-03LibGUI: Make ComboBox text editor release focus when Escape is pressedkleines Filmröllchen
2021-11-03LibGUI: Make ComboBox report on_change for set_selected_indexkleines Filmröllchen
As navigate and navigate_relative also do this, it seems reasonable to have it here.
2021-09-02Userland: Migrate to argument-less deferred_invokesin-ack
Only one place used this argument and it was to hold on to a strong ref for the object. Since we already do that now, there's no need to keep this argument around since this can be easily captured. This commit contains no changes.
2021-09-01LibGUI:: Style Combo and SpinBox buttons as ThickCapsthankyouverycool
These suffered the same visual defect as scrollbars when styled as normal buttons: against backgrounds with the same color as their highlighting, aspect was lost.
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-07-06LibGUI: Fix `go_upwards_instead` check in ComboBoxLuK1337
This change addresses an issue where ComboBox list window would always be drawn upwards if the number of elements is lower or equal 3.
2021-06-03LibGUI: ComboBox now goes upwards when running out of room to renderMatthew Jones
2021-06-03LibGUI: ComboBox now correctly sizes height in relation to taskbarMatthew Jones
2021-05-26LibGUI/AbstractView: Remove `on_selection`Jelle Raaijmakers
Since the introduction of multi-select, we have had both `on_selection` and `on_selection_change`, the latter of which was only invoked when a change in selection came in through the model. This removes `AbstractView::on_selection` and replaces it usage with the more explicit `on_selection_change` everywhere.
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-04-13Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"Andreas Kling
I hereby declare these to be full nouns that we don't split, neither by space, nor by underscore: - Breadcrumbbar - Coolbar - Menubar - Progressbar - Scrollbar - Statusbar - Taskbar - Toolbar This patch makes everything consistent by replacing every other variant of these with the proper one. :^)
2021-03-25WindowServer+LibGUI: Remove the global menubar :^)Andreas Kling
This leaves menu applets running but invisible, and that's a regression we need to take care of obviously. But not today, because it's getting too late.
2021-03-16LibGUI: Remove has_visible_list members from TextEditorthankyouverycool
This was a kludge to paint ComboBox editors before the advent of accessory windows, isn't being used anymore, and was inadvertently letting two ComboBoxes paint as if both had focus.
2021-03-12LibGUI: Register more GML properties and widgetsthankyouverycool
Register "placeholder" for TextEditor and ComboBox; "models_only" for ComboBox; Vertical/HorizontalSeparator for SeparatorWidget
2021-02-27LibGUI: Remove ControlBoxButton widgetthankyouverycool
ComboBoxes and SpinBoxes were still relying on ascii-to-bitmap icons instead of PNGs. This makes it easier to theme in the future.