Commit Graph

23 Commits

Author SHA1 Message Date
tetektoza
9deaa74ad6 LibGUI: Split HorizontalSlider to separate header
This patch splits HorizontalSlider to separate header so it can be used
as a component in .gml files with new GML compiler.
2023-12-08 01:06:09 +01:00
thankyouverycool
f7e034d4b2 LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStyle
Previously, Frames could set both these properties along with a
thickness to confusing effect: Most shapes of the same shadowing only
differentiated at a thickness >= 2, and some not at all. This led
to a lot of creative but ultimately superfluous choices in the code.

Instead let's streamline our options, automate thickness, and get
the right look without so much guesswork.

Plain shadowing has been consolidated into a single Plain style,
and 0 thickness can be had by setting style to NoFrame.
2023-04-30 05:49:46 +02:00
Andreas Oppebøen
c943ab823d LibGUI: Paint slider track shorter to ensure the knob covers it
A 1px drop shadow from the track was peeking out behind the knob when
at rightmost or lowest position. That made it look like it was possible
to drag the knob even further right or down. Painting the track 1px
shorter seems like a good compromise to avoid the problem.
2023-03-24 10:33:22 +01:00
Andreas Oppebøen
c8547124e2 LibGUI: Fix slider so dragging handle left and right feels similar
When dragging the slider handle left/down, the handle would
snap to lower value with the slightest move of the mouse. When dragging
to the right/up however, it would take a lot more movement to cause
a change in value. This asymmetry made it feel really awkward to drag
the slider. It was caused by always rounding down using a cast to int.
By rounding to the nearest integer first, we ensure symmetric behavior.
2023-03-24 10:33:22 +01:00
FrHun
6d79d932f9 LibGUI: Implement calculated sizes for Slider 2023-02-17 16:25:57 +00:00
Zaggy1024
0c230f5ff0 LibGUI: Callback with the clamped value of Sliders on a jump to cursor 2023-02-12 09:53:05 +01:00
Zaggy1024
d9a73bbc96 LibGUI: Add callbacks for Slider drags starting and ending 2023-02-07 14:36:58 +00:00
Zaggy1024
fa98c43c0d LibGUI: Make sliders start a drag when jumping to the cursor
This allows users to seek to any position in VideoPlayer, then continue
adjusting the playback timestamp while holding left mouse.
2023-02-07 14:36:58 +00:00
implicitfield
a2ca2d8364 LibGUI: Register "jump_to_cursor" as a GML property 2023-01-09 17:32:03 +00:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Lenny Maiorani
fe3b846ac8 Libraries: Use default constructors/destructors in LibGUI
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-12 14:44:43 -08:00
Dmitry Petrov
1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
Elyse
173a84a2ef LibGUI+SoundPlayer: Use 'decrease_slider_by_page_steps()' method
This method allow us to avoid repeating the pattern
'set_value(value() - page_step() * page_number)'.
2021-12-30 14:31:50 +01:00
Elyse
0d660b27ae LibGUI+SoundPlayer: Use 'increase_slider_by_page_steps()'
This method allow us to avoid repeating the pattern
'set_value(value() + page_step() * page_number)'.
2021-12-30 14:31:50 +01:00
Elyse
086615535f Everywhere: Use 'decrease_slider_by()' method from AbstractSlider
The same idea as 'increase_slider_by()', it helps us to avoid repeating
the pattern 'set_value(value() - delta)'.
2021-12-30 14:31:50 +01:00
Elyse
d53e1fa1fa Everywhere: Use 'increase_slider_by()' method from AbstractSlider
This method help us to avoid repeating the pattern
'set_value(value() + delta)'.
2021-12-30 14:31:50 +01:00
Filiph Sandström
d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Karol Kosek
43a800a838 LibGUI: Set correct value on click with set jump_to_cursor() in Slider
Prior this change, clicking on a slider with set jump_to_cursor() flag
didn't exactly match the knob to the mouse position, and therefore
the slider values were a bit off in the corners.
The calculation used the whole widget size to set new values, which
isn't correct as the track slider has margins on both ends.

I noticed this while seeking in the Sound Player.
2021-09-03 02:32:43 +02:00
Brian Gianforcaro
8623cec0d7 LibGUI: Remove unused header includes 2021-08-01 08:10:16 +02:00
Nick Miller
c3a60a5dcd LibGUI+SoundPlayer: Add Slider option to jump to cursor
When the cursor is clicked outside of the slider knob,
the current behavior is that it will step up or down by the
Slider page step amount.

This commit adds an option to jump the slider knob
directly to the where the mouse cursor is on mouse down events.

This behavior is disabled by default. It must be enabled with
`Slider::set_jump_to_cursor()`.

Jump to cursor is enabled in SoundPlayer since most music players
have this behavior.
2021-06-08 00:10:54 +04:30
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
thankyouverycool
bd34cdbbb3 LibGUI: Ignore scroll length multiplier in SpinBoxes & Sliders
Prevents discrete values from being skipped when using the mouse
wheel on SpinBoxes and proportional Sliders. Wheel delta can be
accelerated by holding Ctrl.
2021-03-12 09:59:03 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00