Age | Commit message (Collapse) | Author |
|
Previously, calling `.right()` on a `Gfx::Rect` would return the last
column's coordinate still inside the rectangle, or `left + width - 1`.
This is called 'endpoint inclusive' and does not make a lot of sense for
`Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would
return 4 as its right side. This same problem exists for `.bottom()`.
This changes `Gfx::Rect` to be endpoint exclusive, which gives us the
nice property that `width = right - left` and `height = bottom - top`.
It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly
the same.
All users of `Gfx::Rect` have been updated accordingly.
|
|
Prior to this commit, we were always clearing the TreeView's metadata,
even if it wasn't needed. Now, we only clear it if the callee says that
we should invalidate indices.
This fixes an issue in FileManager (#6903), where updating the file
system by creating/deleting any file/folder would cause the tree to
collapse completely.
This may be more of a 'patch' than an actual fix, since I don't have a
lot of experience with `GUI::TreeView` or `GUI::Model`, but it doesn't
appear to break any other `TreeView` use-cases and using FileManager is
now much better than it was before :^)
|
|
This makes tree views with icons look a lot better at larger font sizes.
|
|
Those don't have any non-try counterpart, so we might as well just omit
it.
|
|
|
|
Previously, incorrect items were highlighted when hovering over
elements in TreeView when there was a column header.
|
|
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
|
|
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.
|
|
On other operating systems, if you hold down Alt when you click to
expand part of a tree, it expands all of the children of the node
you clicked. This commit makes our TreeView act the same way :)
|
|
These arrows were previously drawn using the code points U+2B06 and
U+2B07. The .png files for these emoji were removed in commit bfe99eb
and added to the Katica Regular 10 font in commit cf62d08. The emoji
were not added to the bold Katica variants that are used by the table
header view. The effect is that a "?" replacement character was
rendered.
Instead of rendering the emoji, we can draw the arrows programatically,
like we do in other GUI components (e.g. the scrollbar).
|
|
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.
|
|
This would previously cause silly things like [GUI::Icon] to appear if a
non-textlike column was used as the tree column (like, in this example,
an icon column). Let's just not write anything instead.
|
|
This has safer fallbacks than toggle_index, because we want to be able
to call it on indices that don't have children.
|
|
This was using internal_data beforehand, which relies on the internal
data to be distinct for different model indices. That's not the case for
example for SortingProxyModel. Using the model index directly makes tree
expansion work properly when using a tree table widget with a
SortingProxyModel.
|
|
|
|
|
|
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."
|
|
This patch adds a method that can optionally be implemented to allow
a TableCellPaintingDelegate to fall back to the default painting in a
View.
|
|
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
|
|
This resolves #10641.
|
|
|
|
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.
|
|
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.
|
|
We always display the tree indent and the icon, so we shouldn't allow
the tree column to shrink beyond that size.
|
|
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.
|
|
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.
|
|
|
|
Also mark them as [[nodiscard]].
|
|
AbstractView now has a paint_invalidation_rect(index) function that
subclasses can override to provide a tighter invalidation rect for
an index.
|
|
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.
|
|
When collapsing a tree that contains the current selection, the parent
node becomes selected instead.
|
|
This behavior was really irritating and basically never what you wanted
so let's stop doing it.
|
|
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.
|
|
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.
|
|
|
|
|
|
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 *
|
|
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. :^)
|
|
Previously only rows containing root nodes were considered. Fixes
offset content drift and columns failing to resize in multi-column
TreeViews
|
|
|
|
(...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.
|
|
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.
|
|
|
|
|
|
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 }' {} \;
|
|
|