summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/ScrollBar.cpp
AgeCommit message (Collapse)Author
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling
2021-01-03LibGUI: Move widget registrations to the corresponding cpp fileAndrew Kaster
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.
2020-12-30LibGUI: Make disabled scrollbars have more disabled looking iconsAndreas Kling
Draw a threed drop highlight under the arrows on disabled scrollbars. This makes it more visible that they are disabled.
2020-12-30LibGUI: Make GUI::ScrollBar inherit from AbstractSliderAndreas Kling
2020-12-30LibGUI: Register a whole bunch of properties in various widgetsAnotherTest
2020-12-30LibGUI: Unbreak GUI::ScrollBar default sizeAndreas Kling
Oops, got my width/height mixed up here. :^)
2020-12-30LibGUI: Rewrite layout system in terms of min and max sizesAndreas Kling
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. :^)
2020-09-25Meta+LibC through LibHTTP: Make clang-format-10 cleanBen Wiederhake
Why break at LibHTTP? Because "Meta+Libraries" would be insanely large, and breaking between LibHTTP and LibJS makes the commits roughly evenly large.
2020-09-09LibGUI: Do not paint scrollbar button highlight for scrollbars without scrubberNico Weber
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-08-25LibGUI: Make ScrollBar show hover state of scrubber after gutter dragNico Weber
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.
2020-08-25LibGUI: Only paint ScrollBar hover states if a component is pressedNico Weber
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.
2020-08-25LibGUI: Make ScrollBar track the currently pressed componentNico Weber
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.
2020-08-25LibGUI: Make scrollbars keep scrolling by page while clicking the gutterNico Weber
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.
2020-08-25LibGUI: Keep scrollbar timer active while mouse is downNico Weber
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).
2020-08-25LibGUI: Extract ScrollBar::update_hovered_component() methodNico Weber
2020-08-25LibGUI: Extract ScrollBar::component_at_position() methodNico Weber
...and use it in mousedown_event(), which allows putting in stricter asserts.
2020-08-25LibGUI: Make AutomaticScrollingKind a paramter on set_automatic_scrolling_activeNico Weber
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.
2020-08-25LibGUI: In ScrollBar, rename AutomaticScrollingDirection to ↵Nico Weber
AutomaticScrollingKind Also rename Decrement to DecrementButton and Increment to IncrementButton.
2020-08-25LibGUI: Make ScrollBar shift-click use same code path as scrubber clickNico Weber
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.
2020-08-12ScrollBar: Let clicking the gutter scroll by one pageNico Weber
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.
2020-08-12ScrollBar: Simplify ScrollBar::scroll_to_position()Nico Weber
2020-08-12GUI: Rename ScrollBar::scrubber_size() to ScrollBar::visibile_scrubber_size()Nico Weber
2020-08-12GUI: Extract a ScrollBar::scroll_to_position methodNico Weber
2020-07-09LibGUI: Make scrollbar thumb size relative to content sizeTom
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.
2020-06-10LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSizeAndreas Kling
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much better visual clue about what type of metric is being used.
2020-05-10LibGUI+LibGfx: Paint scollbar tracks with a dithered patternAndreas Kling
Instead of a solid color, we now paint the track/gutter of scrollbars using a 2-color dither pattern for a pleasant millennium feel. :^)
2020-04-23LibGUI: Tweak default ScrollBar size to make arrow icons centered :^)Andreas Kling
2020-04-23LibGUI: Tweak colorization of ScrollBar gutterAndreas Kling
2020-02-23LibGUI: Remove parent parameter to GUI::Widget constructorAndreas Kling
2020-02-23LibGUI: Use Core::Object::add() a whole bunchAndreas Kling
2020-02-16LibGUI: Add forwarding headerAndreas Kling
This patch adds <LibGUI/Forward.h> and uses it a bunch. It also dragged various header dependency reduction changes into it.
2020-02-16LibGUI: Render ScrollBar buttons as pressed when they are being pressedTibor Nagy
2020-02-14AK: Add a forward declaration headerAndreas Kling
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.
2020-02-06LibGUI: Remove leading G from filenamesAndreas Kling