Age | Commit message (Collapse) | Author |
|
|
|
This gets a lot of unecessary includes out of Widget.cpp. Doing this
didn't work before, but improvements in the C library and using dynamic
libraries have likely un-broken it :^).
Also, move the registration global object to an anonymous namespace. No
reason it has to be an extern symbol.
|
|
Draw a threed drop highlight under the arrows on disabled scrollbars.
This makes it more visible that they are disabled.
|
|
|
|
|
|
Oops, got my width/height mixed up here. :^)
|
|
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.
Box layout now works in 3 passes:
1) Set all items (widgets/spacers) to their min-size
2) Distribute remaining space evenly, respecting max-size
3) Place widgets one after the other, adding spacing in between
I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)
This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
|
|
Why break at LibHTTP? Because "Meta+Libraries" would be insanely large,
and breaking between LibHTTP and LibJS makes the commits roughly evenly large.
|
|
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.
|
|
With this, if clicking the gutter until the scrubber's below the
mouse and then releasing the mouse, the scrubber is correctly
highlighted after releasing the mouse.
|
|
While left-mouse is pressed on any component (arrows, gutter, scrubber),
don't draw hover states for components other than the pressed component.
For example, while clicking the arrow-down button and then dragging
around, the arrow-up button and the scrubber now aren't highlighted.
This also means that during a gutter drag session, the scrubber
isn't highlighted while it's under the mouse cursor. That makes
sense, since we get the gutter drag behavior, not the scrubber
drag behavior, in this case.
The highlight is supposed to indicate "clickability", but if the
mouse is already down, they can't be clicked.
Now that I check for it, this seems to match the scrollbar behavior
on Windows.
|
|
And remove the now-redundant members m_scrubbing, m_scrubber_in_use,
and m_automatic_scrolling_kind.
This also made it clear that we weren't canceling the autoscroll
timer if the scrollbar got disabled while it was scrolling, so
this fixes that too.
|
|
Note that m_hovered_component is only updated on mouse move, not while
just keeping left down. It's arguably wrong to update it on mouse move
while the mouse is down, I'll probably change things so that it doesn't
update there either.
The behavior on click-in-gutter-keep-left-down-then-move-mouse varies
a surprising amount between platforms. This implements the macOS
behavior where the scrubber follows the mouse direction while scrolling
by pages. (To be precise, it's the macOS behavior of Finder and Preview,
Safari has Windows's scrollbar behavior).
On Windows, the first click locks in the scroll direction and then
dragging the mouse off the scrubber in that direction makes the
scroll continue, but dragging it off the other direction has no effect.
I see no reason for that behavior.
|
|
Rather than disable and re-enable the timer, always keep it active
and make it do collision checks to decide if it should have an effect.
This is because set_automatic_scrolling_active(true) calls the
timeout callback immediately before starting the timer, and
when clicking the gutter this callback could disable the timer
again (if the first page scroll put the scrubber under the cursor).
Intead of making set_automatic_scrolling_active() work when it's
called reentrantly (which is easy: just swap the order of
on_automatic_scrolling_timer_fired() and timer->start() so that
on_automatic_scrolling_timer_fired() can immediately stop the
timer again, but it's confusing), make the timer check if it
should do anything.
This is keyed off m_last_mouse_position instead of
m_hovered_component because m_hovered_component is a visual state
and we arguably shouldn't modify it while the left mouse button
is down (as it indicated what part is activated on click).
|
|
|
|
...and use it in mousedown_event(), which allows putting in
stricter asserts.
|
|
Most callers of set_automatic_scrolling_active() also change
m_automatic_scrolling_kind, and it makes it possible to make timer
behavior dependent on the autoscroll kind later.
|
|
AutomaticScrollingKind
Also rename Decrement to DecrementButton and Increment to
IncrementButton.
|
|
It's slightly less code, and m_scrubber_in_use is now set correctly
when shift-clicking, keeping the mouse button down, and then
dragging the throbber.
The shift-click brings the scrubber under the cursor, and then
the scrubber_rect().contains() condition is true and both scrubber
drags and shift-click-drags are handled the same naturally.
|
|
Shift-clicking has the old behavior of jumping to the click position.
This matches scrollbar behavior in macOS and Windows, and in many Linux apps.
|
|
|
|
|
|
|
|
In order to calculate a thumb size that is a representation
of the visible portion (page) of the content, that information
needs to be taken into account.
|
|
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
|
|
Instead of a solid color, we now paint the track/gutter of scrollbars
using a 2-color dither pattern for a pleasant millennium feel. :^)
|
|
|
|
|
|
|
|
|
|
This patch adds <LibGUI/Forward.h> and uses it a bunch.
It also dragged various header dependency reduction changes into it.
|
|
|
|
You can now #include <AK/Forward.h> to get most of the AK types as
forward declarations.
Header dependency explosion is one of the main contributors to compile
times at the moment, so this is a step towards smaller include graphs.
|
|
|