Commit graph

40 commits

Author SHA1 Message Date
Andreas Kling
66a8e151fb LibGUI: Remove redundant scroll_into_view() calls in TableView
The calls to set_cursor() already take care of scrolling the new cursor
into view if needed.
2020-10-30 23:52:59 +01:00
Andreas Kling
80e12999c4 LibGUI: Model-less views should not swallow key events
At least pass them up to GUI::Widget so they can be handled there.
2020-10-28 21:26:27 +01:00
Andreas Kling
df98c9ebbe LibGUI: Run clang-format on TableView.cpp 2020-10-27 20:21:51 +01:00
Andreas Kling
c0076681ad LibGUI: Paint a focus rect around the cursor index in TableView 2020-10-27 16:18:55 +01:00
Andreas Kling
4bc8768737 LibGUI: Tint selected icons in {Icon,Table,Columns}View
Add a gentle tint to selected icons based on the selection color. :^)
2020-10-26 21:32:27 +01:00
Tom
52a847a0eb LibGUI: Implement searching/jumping as you type in views
This allows the user to start typing and highlighting and jumping
to a match in ColumnsView, IconView, TableView and TreeView if
the model supports it.
2020-10-22 15:23:45 +02:00
Andreas Kling
d3adbed231 LibGUI: Move keyboard item activation up to AbstractView
All views want the same behavior, so move this to the base class. :^)
2020-09-24 21:35:47 +02:00
Andreas Kling
f52527ef9c LibGUI: Move editing key handling up to AbstractView
We want all views to respond to the editing key as long as the relevant
edit trigger is activated.
2020-09-24 11:42:11 +02:00
Andreas Kling
b084411258 LibGUI: Make Del/Backspace clear cell w/ "any key pressed" edit trigger
This doesn't feel 100% right but it's better than inserting some goofy
whitespace when pressing these keys.
2020-08-29 01:04:22 +02:00
Andreas Kling
1847219cbf LibGUI: Let's make F2 the standard "edit key"
This matches what other systems do, and allows Return to become
the unambiguous "activation key" instead. :^)
2020-08-28 20:55:25 +02:00
Andreas Kling
5daa19fdab LibGUI: Implement a basic "any key pressed" edit trigger for TableView
This trigger allows you to initiate cell editing by simply starting to
type something into the cell. :^)
2020-08-28 20:47:02 +02:00
Andreas Kling
f3e4b62be9 LibGUI: Add AbstractView "edit triggers" to improve editing control
This API allows the embedder of a view to decide which actions upon
the view will begin editing the current item.

To maintain the old behavior, we will begin editing when an item is
either double-clicked, or when the "edit key" (return) is pressed.
2020-08-28 20:40:12 +02:00
Andreas Kling
2222fc5e08 LibGUI: Add optional grid and cursor styles to TableView 2020-08-28 17:09:30 +02:00
Andreas Kling
9cf37901cd LibGUI: Add a cursor to AbstractView, separate from the selection
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. :^)
2020-08-27 18:36:31 +02:00
Andreas Kling
0b9d765f6b LibGUI: Add AbstractView::move_cursor() and share some movement logic
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. :^)
2020-08-27 17:47:19 +02:00
Andreas Kling
c4347a16cf LibGUI: Make AbstractTableView row height configurable
The row height is per-table, not per-row, but this is still nice.
2020-08-26 20:34:07 +02:00
Andreas Kling
447b65bf7b LibGUI: Add (optional) row headers to GUI::TableView
You can now get row headers in your TableView by simply calling:

    table_view.row_header().set_visible(true)

Note that rows are not yet resizable.
2020-08-26 17:00:40 +02:00
Andreas Kling
44e371635e LibGUI: Move table view headers into their own widget
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.
2020-08-26 00:51:35 +02:00
Andreas Kling
f86c074be8 LibGUI: Pressing Return in an editable TableView should begin editing
This matches what happens when you double-click on a cell.
2020-08-24 21:20:54 +02:00
Andreas Kling
2cbe290930 LibGUI: Allow moving the TableView selection horizontally with keyboard 2020-08-24 21:03:34 +02:00
AnotherTest
e1a819827c LibGUI: Make AbstractTableView and TableView more customisable
This patchset adds a few getters/setters to AbstractTableView to make
its looks more customisable:
- Header width & text alignment
- Default column width
- Ability to disable selected row highlighting
2020-08-24 18:21:33 +02:00
Andreas Kling
9102b624ac LibGUI+DevTools+Applications: Use ModelIndex::data() in many places
This way you don't have to keep track of which model it came from.
2020-08-16 16:44:09 +02:00
Andreas Kling
96f98b1fc9 LibGUI: Simplify TableCellPaintingDelegate API slightly
No need to pass the Model *and* a ModelIndex, the index knows which
model it belongs to anyway.
2020-08-16 16:44:09 +02:00
Andreas Kling
a1e381a0f8 LibGUI: Move GUI::Model::Role to GUI::ModelRole
This is preparation for using ModelRole in the ModelIndex API.
2020-08-16 16:44:09 +02:00
Andreas Kling
e1ed71ef9e LibGUI: Make model sorting imperative and move order to AbstractView
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.
2020-08-16 16:44:09 +02:00
Andreas Kling
d851863704 Userspace: Remove a bunch of unnecessary Kernel/API/KeyCode.h includes 2020-07-04 17:25:31 +02:00
Andreas Kling
11c4a28660 Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
Andreas Kling
116cf92156 LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
2020-06-10 10:59:04 +02:00
Andreas Kling
278b307713 LibGUI: Make all views use CenterLeft as the default text alignment
If a model doesn't specify a text alignment for a given field, we now
fall back to CenterLeft. This will look better than Center in the vast
majority of cases.
2020-05-21 19:55:44 +02:00
Andreas Kling
2e03bded43 LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata 2020-05-21 19:55:44 +02:00
Andreas Kling
04187576ff LibGUI: Models should always specify font via Model::Role::Font
This gets rid of one field in ColumnData. The goal is to get rid of all
fields and lose ColumnData entirely.
2020-05-21 19:55:44 +02:00
Andreas Kling
80f43ffc27 LibGUI: Move AbstractTableView::keydown_event() down to TableView
We can't really share this stuff with TreeView anyway, since tables
and trees have very different spatial relationships between indexes.
2020-05-21 13:40:52 +02:00
Andreas Kling
d17b42b28d LibGUI: Make view widgets fill background by default
Most clients will want background autofill, so let's make it the
default mode.
2020-04-18 21:55:37 +02:00
Andreas Kling
235ae80e5e LibGUI: Make TableView ignore custom colors for selected rows
This allows them to look selected instead.
2020-04-12 15:23:24 +02:00
Andreas Kling
c199b0e1aa LibGUI: Fill whole TableView cells with custom background color
This was easier than I expected. :^)
2020-04-11 19:20:40 +02:00
Andreas Kling
3a65e9107e LibGUI: Respect Model::Role::BackgroundColor
This implementation is very gappy, but the basic feature allows us to
highlight cells with a custom background color.
2020-04-11 18:56:15 +02:00
Andreas Kling
b4fde72013 LibGUI: Brighten icons when hovering items in item views
View classes now track their hovered item and paint them in a slightly
brighter shade to liven up the user interface. :^)
2020-03-30 19:57:44 +02:00
Andreas Kling
c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Tibor Nagy
4d95163400 LibGUI: Use inactive selection colors from palette instead of hardcoding them 2020-02-15 18:42:13 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Renamed from Libraries/LibGUI/GTableView.cpp (Browse further)