Andreas Kling
6590eb8eb7
LibGUI: Complain about malformed "layout" values in JSON GUI
2020-09-14 16:16:36 +02:00
Andreas Kling
ea17b0cbb6
LibGUI: Start building a way to instantiate GUI from JSON
...
My original idea for GUI building tools was to have the "VisualBuilder"
app generate C++ code which in turn programmatically instantiated UI.
That never really materialized in any useful way beyond static UIs.
This is a fresh, new approach: using JSON to declare the UI and parsing
and constructing this UI at runtime. This will allow for way more
dynamic and flexible approaches to GUI development (I think.)
The basic idea is that you pass a JSON string to Widget::load_from_json
and it takes care of the rest.
This first version supports basic box layouts and instantiation of
arbitrary widgets, as long as those widgets have been registered.
This code has some pretty rough edges right now as it's evolving and
we need to figure out a lot of things about how it should work.
Nevertheless, it feels pretty cool. :^)
2020-09-14 16:16:36 +02:00
Andreas Kling
3c580233d1
LibGUI: Improve widget registration mechanism a bit
...
Allow registering widgets from namespaces other than GUI. :^)
Also add a few widgets.
2020-09-14 16:16:36 +02:00
Andreas Kling
b78e13cf2e
LibGUI: Make some GUI event getters return const references
...
There's no good reason to return rects/sizes/positions by value.
2020-09-13 21:41:45 +02:00
Ben Wiederhake
e3101c74c6
LibGUI: Use new Bitmap::minimum_pitch method
...
Also, make sure that the painter actually draws on a RGB(A) bitmap.
Closes #3460 .
2020-09-12 11:35:41 +02:00
Ben Wiederhake
9c3a33762b
LibGfx: Saner memory usage of indexed bitmaps
...
Indexed bitmaps used to allocate four times the required amount of memory.
Also, we should acknowledge that the underlying data is not always RGBA32,
and instead cast it only when the true type is known.
2020-09-12 00:13:29 +02:00
Ben Wiederhake
d6673b384e
LibGfx: Remove redundant bits() method
...
In all circumstances, this returned exactly the same thing as scanline_u8(),
so let's just remove the silly detour.
This does not add any new dependency on Bitmap-internals, because that already existed.
2020-09-12 00:13:29 +02:00
Andreas Kling
1a2b626746
LibGUI+LibGfx: Move check box painting to Gfx::StylePainter
...
This will allow us to render check boxes from other places. :^)
2020-09-11 18:42:43 +02:00
Andreas Kling
d76b2d0baa
LibGUI: Use widget override cursors in ColorInput
2020-09-11 14:51:02 +02:00
Andreas Kling
cab422b441
LibGUI: Use widget override cursors in HeaderView
2020-09-11 14:50:30 +02:00
Andreas Kling
69adaf3308
LibGUI: Use widget override cursors in GUI::ResizeCorner
2020-09-11 14:47:38 +02:00
Andreas Kling
7a2faecc15
LibGUI: Use widget override cursors in GUI::TextEditor
2020-09-11 14:26:37 +02:00
Andreas Kling
e2050ea0ce
LibGUI: Use widget override cursors in GUI::Splitter
2020-09-11 14:26:37 +02:00
Andreas Kling
cf429a788c
LibGUI: Add Widget override cursor concept
...
We got ourselves into a mess by making widgets override the window
cursor whenever they wanted a custom cursor. This patch introduces a
better solution to that issue: per-widget override cursors.
Each widget now has an override cursor that overrides the window
cursor when that widget is hovered.
2020-09-11 14:26:37 +02:00
Andreas Kling
b4f307f982
LibGUI+WindowServer: Rename window "override cursor" to just "cursor"
...
Let's just say each window has a cursor, there's not really overriding
going on.
2020-09-11 14:26:37 +02:00
Andreas Kling
0f9be82826
LibGfx: Move StandardCursor enum to LibGfx
...
This enum existed both in LibGUI and WindowServer which was silly and
error-prone.
2020-09-10 19:25:13 +02:00
Andreas Kling
e860a9aa80
LibGUI: Unregister AbstractView from model on destruction
...
It was possible to leave stale view pointers in the model after a view
was destroyed while attached to a model.
2020-09-10 18:45:00 +02:00
Nico Weber
01ff17d374
LibGUI: Do not paint scrollbar button highlight for scrollbars without scrubber
...
If a scrollbar doesn't have a scrubber (because the view it scrolls is
large enough to display all its contents without scrolling), then
it ignores all clicks. We shouldn't draw a hover highlight that suggests
clickability in that case.
2020-09-09 21:04:15 +02:00
asynts
70dd97c46e
AK: Remove FixedArray class.
2020-09-08 14:01:21 +02:00
AnotherTest
02f251bb4a
LibGUI: Fix OOB read in Clipboard::set_data()
2020-09-06 22:22:17 +02:00
Andreas Kling
158f3b9362
LibGUI: Add a Clipboard API for retrieving a copied Gfx::Bitmap
...
The returned bitmap is always going to be a 32-bit RGBA bitmap for now.
In the future we may want to support copy-pasting other formats.
2020-09-05 16:52:35 +02:00
Andreas Kling
2e6d59b7b2
Clipboard: Add a key-value map alongside the clipboard storage
...
A clipping now consists of three things:
- The raw clip data
- A MIME type
- A key-value map (String, String) for anything you like
2020-09-05 16:52:24 +02:00
Andreas Kling
51146e3075
LibGUI: Make the Clipboard API deal in raw byte buffers a bit more
...
To open up for putting not just text/plain content on the clipboard,
let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
2020-09-05 16:16:01 +02:00
Andreas Kling
27687b1c6e
LibGUI: Handle cursor keydown events in AbstractView
...
Move the basic movement keys (up/down/left/right/home/end/pgup/pgdn)
up to AbstractView::keydown_event() and have it call the virtual
move_cursor() which is then implemented by subclasses.
2020-09-02 21:29:31 +02:00
Andreas Kling
4ba12e9c23
LibGUI: Simplify ListView hover highlighting
...
Instead of tracking the last valid hovered index, just hook the
mousemove event and make the cursor follow the hover when it changes.
2020-09-02 21:29:31 +02:00
Andreas Kling
274a09246b
LibGUI: Move ListView to using AbstractView::move_cursor()
2020-09-02 21:29:31 +02:00
Andreas Kling
dec3998b3c
LibGUI: Disable whitespace visualization in single-line text editors
...
You can enable it manually if you really want it, of course. :^)
2020-09-01 23:57:30 +02:00
Andreas Kling
aa70d8c217
LibGUI: Implement trailing whitespace visualization in TextEditor
...
This patch adds an optional mode where TextEditor highlights trailing
whitespace characters on each line with a nice reddish dither pattern.
We should probably make this themable and I'm sure it could be nicer
somehow, but this is just a first cut and I do kinda like it. :^)
2020-09-01 23:55:35 +02:00
Andreas Kling
a56360f787
LibGUI: Implement the virtual ListView::scroll_into_view()
...
Instead of shadowing the one from AbstractView.
2020-09-01 17:45:28 +02:00
Andreas Kling
04507e288f
LibGUI: Remove ListView::doubleclick_event()
...
We can just let AbstractView take care of this. :^)
2020-09-01 17:45:28 +02:00
Andreas Kling
daeb2bdc60
LibGUI: Don't return early from AbstractView::set_cursor()
...
Calling set_cursor() with the same cursor index is not necessarily
a no-op! For example, we may want to toggle the selection.
2020-09-01 16:33:31 +02:00
Andreas Kling
37df36dbed
LibGUI: Implement move_cursor() in ColumnsView
2020-09-01 16:26:32 +02:00
Andreas Kling
27e86c03da
LibGUI: Implement the virtual IconView::scroll_into_view()
...
This is virtual in AbstractView so let's not shadow it with an IconView
specific variant.
2020-09-01 16:17:17 +02:00
Andreas Kling
72443bd1ab
LibGUI: Teach IconView to use AbstractView::move_cursor()
...
This makes it possible to manipulate the cursor programmatically via
the AbstractView interface.
2020-09-01 16:17:17 +02:00
thankyouverycool
199c1da31c
LibGUI: Hide ResizeCorner in StatusBar when window is maximized
...
Fully expands status bars when maximized and prevents maximized
windows from being erroneously resized.
2020-08-31 09:08:26 +02:00
AnotherTest
e75247a75b
DisplaySettings+LibGUI: Move ItemListModel into LibGUI
...
Without this model, comboboxes are abysmal to work with, so let's not
redefine it every time.
2020-08-29 17:42:03 +02:00
thankyouverycool
2f9a071072
Base+LibGUI: Refresh filetype icons for consistency
...
Improves ini icon depth and adds complementary 16x16/32x32 icons
for music and sound filetypes.
2020-08-29 16:19:02 +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
c3b3a078f3
LibGUI: Make SortingProxyModel update all view cursors on resort
...
Otherwise they will be stale indexes, which is no good. :^)
2020-08-29 00:18:35 +02:00
Andreas Kling
fed53e19c7
LibGUI: Make AbstractView::set_cursor() scrolling into view optional
...
Sometimes you just want to set the cursor programmatically without
scrolling the view to make the cursor visible.
2020-08-29 00:17:42 +02:00
Andreas Kling
734035857e
LibGUI: Allow AbstractView::set_cursor(ModelIndex(), ...)
...
This should be a valid way to clear the cursor.
2020-08-29 00:16:58 +02:00
Andreas Kling
6316525d50
LibGUI: Add optional "tab key navigation" to AbstractView
...
If enabled, the view cursor will move right/left when pressing
tab/shift+tab.
2020-08-28 21:09:38 +02:00
Andreas Kling
70d3dd5b87
LibGUI: Make TableView::move_cursor() public
...
It was already public in the base class, so hiding it here was just
a mistake.
2020-08-28 21:02:46 +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
12dfeb9845
LibGUI: Allow rollback of model editing delegate input
...
In the StringModelEditingDelegate convenience class, we simply hook up
the escape key to editor rollback. This means you can cancel an ongoing
cell edit by pressing escape. :^)
2020-08-28 20:50:12 +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
Ben Wiederhake
6020a4f274
LibGUI: Remove unused String member
2020-08-28 09:15:47 +02:00
Andreas Kling
d2d2361152
LibGUI: Unbreak PageUp/PageDown in AbstractTableView
...
These key events need to trigger a move_cursor() as well.
2020-08-27 19:29:50 +02:00