Update to latest ZWidget version

This adds new features (such as themes) alongside fixing numerous bugs. This should be kept up-to-date with upstream more often and changes to it should be PR'd back to its main repo.
This commit is contained in:
Boondorl 2025-06-14 08:58:13 -04:00 committed by Ricardo Luís Vaz Silva
commit 885c1d2920
101 changed files with 10156 additions and 2204 deletions

View file

@ -5,6 +5,7 @@
Scrollbar::Scrollbar(Widget* parent) : Widget(parent)
{
SetStyleClass("scrollbar");
UpdatePartPositions();
mouse_down_timer = new Timer(this);
@ -169,7 +170,7 @@ void Scrollbar::OnMouseMove(const Point& pos)
Update();
}
bool Scrollbar::OnMouseDown(const Point& pos, int key)
bool Scrollbar::OnMouseDown(const Point& pos, InputKey key)
{
mouse_drag_start_pos = pos;
@ -253,11 +254,11 @@ bool Scrollbar::OnMouseDown(const Point& pos, int key)
UpdatePartPositions();
Update();
CaptureMouse();
SetPointerCapture();
return true;
}
bool Scrollbar::OnMouseUp(const Point& pos, int key)
bool Scrollbar::OnMouseUp(const Point& pos, InputKey key)
{
if (mouse_down_mode == mouse_down_thumb_drag)
{
@ -269,7 +270,7 @@ bool Scrollbar::OnMouseUp(const Point& pos, int key)
mouse_down_timer->Stop();
Update();
ReleaseMouseCapture();
ReleasePointerCapture();
return true;
}
@ -294,8 +295,8 @@ void Scrollbar::OnPaint(Canvas* canvas)
part_button_increment.render_box(canvas, rect_button_increment);
*/
canvas->fillRect(Rect::shrink(Rect::xywh(0.0, 0.0, GetWidth(), GetHeight()), 4.0, 0.0, 4.0, 0.0), Colorf::fromRgba8(33, 33, 33));
canvas->fillRect(Rect::shrink(rect_thumb, 4.0, 0.0, 4.0, 0.0), Colorf::fromRgba8(58, 58, 58));
canvas->fillRect(Rect::shrink(Rect::xywh(0.0, 0.0, GetWidth(), GetHeight()), 4.0, 0.0, 4.0, 0.0), GetStyleColor("track-color"));
canvas->fillRect(Rect::shrink(rect_thumb, 4.0, 0.0, 4.0, 0.0), GetStyleColor("thumb-color"));
}
// Calculates positions of all parts. Returns true if thumb position was changed compared to previously, false otherwise.