mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-14 06:55:36 +00:00
Add scrollpanel widget
This PR introduces a new ScrollPanel component with the following capabilities: - Scroll Orientation Support: Allows scrolling in horizontal, vertical, or both directions, providing flexibility for different use cases. - Partial Object Rendering: Supports partial rendering of objects that are only partially visible within the scroll boundaries, improving visual accuracy and performance. - Boundary-Constrained Mouse Interaction: Handles mouse events strictly within the panel's visible boundaries, preventing interaction with objects outside the scrollable area. - Minimum Internal Size (min_width, min_height): Introduces support for virtual space management, allowing the panel to maintain a minimum internal size independent of its actual on-screen dimensions. Even when the panel is resized, this ensures that the content respects a defined virtual space (with min_width and min_height), effectively simulating a larger internal canvas. This is particularly useful for large content or scenarios where a more extensive scrollable area is required than the current visible panel.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gui/ObjectTypes/CButton.h"
|
||||
#include "gui/ObjectTypes/CList.h"
|
||||
#include "gui/ObjectTypes/CMiniMap.h"
|
||||
#include "gui/ObjectTypes/CScrollPanel.h"
|
||||
#include "gui/ObjectTypes/CText.h"
|
||||
|
||||
// Called for every specialization - adds the common interface.
|
||||
@@ -66,3 +67,10 @@ template<> void JSI_GUIProxy<CMiniMap>::CreateFunctions(const ScriptRequest& rq,
|
||||
CreateFunction<&CMiniMap::Flare>(rq, cache, "flare");
|
||||
}
|
||||
DECLARE_GUIPROXY(CMiniMap);
|
||||
|
||||
// CScrollPanel
|
||||
template<> void JSI_GUIProxy<CScrollPanel>::CreateFunctions(const ScriptRequest& rq, GUIProxyProps* cache)
|
||||
{
|
||||
CreateFunction<&CScrollPanel::ResetScrollPosition>(rq, cache, "resetScrollPosition");
|
||||
}
|
||||
DECLARE_GUIPROXY(CScrollPanel);
|
||||
|
||||
Reference in New Issue
Block a user