summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/TreeView.cpp
AgeCommit message (Collapse)Author
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-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-08-10LibGUI: Draw a focus rect over the row when sel. behavior is SelectRowssin-ack
2021-08-10LibGUI: Partially restore original TreeView column painting behaviorsin-ack
TreeView now prints columns mostly like it used to. The paddings are now properly applied, though. focus_rect drawing has been gated behind a selection_behavior() check to make sure we don't draw a focus rect around the column text when we're supposed to draw it over the entire row.
2021-08-10LibGUI: Default TreeView to SelectionBehavior::SelectItemssin-ack
AbstractTableView (which TreeView inherits from) sets the selection behavior of the view to SelectRows. This is not how TreeViews are used in most of the system, and TreeView::paint_event actually always draws with the assumption of selecting individual items. This commit defines the expected selection behavior for TreeViews. Users of TreeView can still override this via TreeView::set_selection_behavior.
2021-08-08LibGUI: Do not allow tree column to shrink beyond indent and iconsin-ack
We always display the tree indent and the icon, so we shouldn't allow the tree column to shrink beyond that size.
2021-08-08LibGUI: TreeView tree column text painting adjustmentssin-ack
The text was painted with the assumption that no other column would be present after the tree column, which won't always be true. Additionally, some alignment and focus rect-related issues have been fixed.
2021-07-27LibGUI: Add ModelRole::IconOpacity and support it in all views :^)Andreas Kling
This role allows you to specify a custom opacity for icon painting. Note that the opacity is not in effect when the item is either selected and/or hovered.
2021-07-27LibGUI: Remove some unused code in GUI::TreeViewAndreas Kling
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-07-10LibGUI: Tighten paint invalidation rects in item views :^)Andreas Kling
AbstractView now has a paint_invalidation_rect(index) function that subclasses can override to provide a tighter invalidation rect for an index.
2021-06-05TreeView: Don't try to move cursor with invalid indexMarcus Nilsson
When clicking on the TreeView in profiler without selecting a node and then pressing up or pgup, cursor_index was in an invalid state. Instead select the first node in the index.
2021-06-01LibGUI/TreeView: Select parent on collapseJelle Raaijmakers
When collapsing a tree that contains the current selection, the parent node becomes selected instead.
2021-05-30LibGUI: Don't scroll TreeView horizontally to bring index into viewAndreas Kling
This behavior was really irritating and basically never what you wanted so let's stop doing it.
2021-05-30LibGUI: Avoid a bunch of virtual calls during TreeView paintingAndreas Kling
The index of the tree column will not change while painting. Neither will the number of columsn. So avoid a whole bunch of virtual function calls by caching these two values at the start of painting.
2021-05-29LibGUI/TreeView: Implement Home/End/PageUp/PageDn navigationJelle Raaijmakers
This adds an implementation for the Home, End, Page Up and Page Down cursor movements for TreeView. Also, the Up and Down movement implementations are replaced by a more efficient traversal mechanism: whereas the old code would walk over all visible nodes every time, the new code only evaluates relevant sibling and parent indices.
2021-05-03LibGUI: Rename ScrollableWidget => AbstractScrollableWidgetAndreas Kling
2021-05-01Everywhere: Turn #if *_DEBUG into dbgln_if/if constexprGunnar Beutner
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-19LibGUI: Walk all visible rows when updating TreeView column sizesthankyouverycool
Previously only rows containing root nodes were considered. Fixes offset content drift and columns failing to resize in multi-column TreeViews
2021-03-19LibGUI: Support double-click resizing multi-column TreeViewsthankyouverycool
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-20LibGUI: Always set tree column content width to widest open nodethankyouverycool
Fixes hidable horizontal scrollbars remaining visible even after collapsing their responsible nodes. Tree column width defaults to column header width if wider than current content.
2021-02-03Everywhere: Remove some bitrotted "#if 0" blocksAndreas Kling
2021-01-25Everywhere: Hook up remaining debug macros to Debug.h.asynts
2021-01-25Everywhere: Remove unnecessary debug comments.asynts
It would be tempting to uncomment these statements, but that won't work with the new changes. This was done with the following commands: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling