Views now have a cursor index (retrievable via cursor_index()) which
is separate from the selection.
Until now, we've been using the first entry in the selection as
"the cursor", which gets messy whenever you want to select more than
one index in the model.
When setting the cursor, the selection is implicitly updated as well
to maintain the old behavior (for the most part.)
Going forward, this will make it much easier to implement things like
shift-select (extend selection from cursor) and such. :^)
A view can now be told to move its cursor in one of multiple directions
as specified by the CursorMovement enum.
View subclasses can override move_cursor(CursorMovement) to implement
their own cursor behavior. By default, AbstractView::move_cursor() is
a no-op.
This patch improves code sharing between TableView and TreeView. :^)
This patch introduces the HeaderView class, which is a widget that
implements the column headers of TableView and TreeView.
This greatly simplifies event management in the view implementations
and also makes it much easier to eventually implement row headers.
Instead of SortingProxyModel having a column+order, we move that state
to AbstractView. When you click on a column header, the view tells the
model to resort the relevant column with the new order.
This is implemented in SortingProxyModel by simply walking all the
reified source/proxy mappings and resorting their row indexes.
Adds a new highlighting effect to the actively selected row in
ComboBox ListView. ComboBoxEditor can now be controlled with
page up, page down, and the up and down arrow keys. ESC and loss
of focus now cause comboboxes to close. Now activates on mouseup
as well as return.
This implements the following optimizations:
* Rather than clearing a HashTable of selected items and re-populating
it every time the selection rectangle changes, determine the delta
by only examining the items that might be in the area where the
selection may have changed compared to the previous area. Then
only add/remove selection items as needed.
* When painting, only query and paint the items actually visible.
Also, keep a local cache of item information such as calculated
rectangles and selection state, so it doesn't have to be calculated
over and over again.
This is really just a workaround to keep SystemMonitor's process table
working right wrt selection retention during resorts (while also doing
full index invalidation on things like ProfileViewer inversion.)
It's starting to feel like the model abstraction is not super great
and we'll need a better approach if we want to actually build some more
dynamic functionality into our views.
AbstractView does not know which column it's displaying which makes it
impossible to implement the select_all functionality up there. Now
descendants override the pure virtual select_all method and implement
it themselves.
You can now drop things on an AbstractView, which will ask its model if
the drag is acceptable to drop at the index where it's dropped.
If it's accepted by the model, the view will fire the on_drop hook.