Commit graph

1232 commits

Author SHA1 Message Date
Peter Elliott
fa96e57c15 LibGUI: Add optional placeholder to TextEditor
This lets you show some disabled text when no text is entered, and the
editor is not focused.
2020-09-21 20:15:10 +02:00
asynts
03a27bc693 LibGUI: Remove unnecessary type cast in JsonArrayModel.
Since TCP sequence numbers are randomly choosen 32-bit numbers, it often
happend that the most significant bit was set. The cast to a 32-bit
signed integer then made the number negative.

Thus TCP sequence were shown negative in the SystemMonitor every so
often.
2020-09-20 21:10:46 +02:00
Tibor Nagy
3ce97b9c0e LibGUI: Pad row/column headers of AbstractTableView 2020-09-20 20:54:23 +02:00
Itamar
32d0d00ab2 LibGUI: Fix row_rect(int) calculation in AbstractTableView
Previously, it didn't take into account the visibility of
column headers.
2020-09-20 16:34:56 +02:00
Jakob-Niklas See
eeb3ef405c
LibGUI: Increase slider acceleration with Ctrl (#3499)
When holding Ctrl and scrolling on a slider widget, the scrolling
acceleration gets increased.

This can make it faster to get to the knob location you want to
get to. :^)
2020-09-19 16:45:51 +02:00
Andreas Kling
3bccd99fe9 LibGUI: Add TreeView::expand_all_parents_of(ModelIndex)
This does exactly what it sounds like. :^)
2020-09-18 21:29:01 +02:00
Andreas Kling
76ae47c6ed LibGUI: Unbreak FileSystemModel::index(path) after virtual root changes
Now that the "/" directory can have a (virtual) parent index, we need
to account for that when converting a full path to a model index.
2020-09-18 21:29:01 +02:00
Andreas Kling
e4c23b0151 iLibGUI+Base: Show inaccessible directories with special icon in views 2020-09-18 21:29:01 +02:00
Andreas Kling
fad6b8f267 LibGUI: FileSystemModel should provide full paths to FileIconProvider
This will allow FileIconProvider to check additional things about
the specified path. (We previously only had access to the basename.)
2020-09-18 21:29:01 +02:00
Andreas Kling
9b89303767 LibGUI: StackWidget should not steal focus when switching active child
Only focus the new active child if the old one had focus previously.
2020-09-18 21:29:01 +02:00
Uma Sankar
19f2203b53
LibGUI: Set ProcessChooser key column and sort order after set_model (#3521)
Need to set the sort order after model was set to sort the table.
2020-09-17 16:17:14 +02:00
Uma Sankar
d7673b41ef
LibGUI: Respect the previously selected sort order in HeaderView (#3522)
Instead of forcefully setting the sort order to Ascending upon column
sort, setting it to the previously selected sort order
2020-09-17 16:15:35 +02:00
Peter Elliott
1720030625 LibGUI: Don't recalcuate color from hue if it was not set by hue
Basically, setting the hue is numerically sensitive when the value or
saturation are low.
2020-09-17 09:47:05 +02:00
Peter Elliott
9670d9ad50 LibGUI: Don't allow 4 character html color codes in GUI::ColorPicker
When 4 character colors were allowed, backspace misbehaved and you
couldn't backspace the whole color.
2020-09-17 09:47:05 +02:00
Andreas Kling
d89cad7c57 LibGUI: Use FileIconProvider in the FilePicker dialog 2020-09-16 21:08:55 +02:00
Andreas Kling
31b65145b6 LibGUI+Base: Add a hard-disk icon and use it for the path "/" 2020-09-16 21:08:55 +02:00
Andreas Kling
4d2782db5a LibGUI: Allow FileSystemModel to be rooted one level above "/"
You can now construct a FileSystemModel with a null String() as the
root path. This will root it one level above "/" which makes the
root directory itself selectable as a child.

This will be useful in some places, e.g the FileManager application.
2020-09-16 21:08:55 +02:00
Andreas Kling
f69281573e LibGUI: Double-clicking on a TreeView item should set cursor
Don't just set the selection, set the cursor.
2020-09-16 16:37:28 +02:00
Andreas Kling
95b6c98435 LibGUI: Fix TreeView scrolling to top when clicking sub-items
This code was confusing two different versions of scroll_into_view that
were getting mixed up due to member function shadowing.

Adding an "override" to the subclass declaration exposed the problem.

With this fixed, we no longer lose our scroll position wildly when
using the mouse to select TreeView items.
2020-09-16 16:37:28 +02:00
Andreas Kling
e2f32b8f9d LibCore: Make Core::Object properties more dynamic
Instead of everyone overriding save_to() and set_property() and doing
a pretty asymmetric job of implementing the various properties, let's
add a bit of structure here.

Object properties are now represented by a Core::Property. Properties
are registered with a getter and setter (optional) in constructors.
I've added some convenience macros for creating and registering
properties, but this does still feel a bit bulky. We'll have to
iterate on this and see where it goes.
2020-09-15 21:46:26 +02:00
Itamar
435c6c6f96 HackStudio: Add basic Git integration
This adds a "Git" tab to Hackstudio.
Currently has support for staging and unstaging files.
2020-09-15 21:43:29 +02:00
pkotzbach
82696078b0 LibGUI: Fix to ComboBox fields activation 2020-09-15 20:37:13 +02:00
pkotzbach
8a21c528ad
LibGUI: Minor consistency cleanup in AbstractView::set_cursor() (#3478) 2020-09-14 20:55:07 +02:00
Andreas Kling
e78cf6c590 LibGfx+LibGUI: Allow setting tab text alignment with set_property() 2020-09-14 19:55:17 +02:00
Andreas Kling
3355a3e179 LibGUI: Add TabWidget::set_property() and handle some properties 2020-09-14 19:55:17 +02:00
Andreas Kling
22b03dd11b LibGUI: Add registration for GUI::TabWidget 2020-09-14 16:23:39 +02:00
Andreas Kling
093de0e323 LibGUI: Use Core::Object::set_property() to handle JSON GUI properties
Piggyback on the existing mechanism to set individual properties.
This doesn't cover layouts or child widgets, but the per-widget own
properties can be set this way.

Any property can now be set in JSON GUI, all you need to do is handle
it in the relevant Core::Object::set_property() override. :^)
2020-09-14 16:16:36 +02:00
Andreas Kling
6fc8dedd28 LibGUI: Allow setting widget visibility from JSON GUI spec 2020-09-14 16:16:36 +02:00
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