Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/windowing
diff options
context:
space:
mode:
authorpatman <27874300+patmanf@users.noreply.github.com>2025-02-12 13:13:28 -0600
committerpatman <27874300+patmanf@users.noreply.github.com>2025-02-26 10:45:34 -0600
commit9c582741e983d94604ebdc6d57753c2fc5091324 (patch)
tree25553b4cf9c79e907499c6d179702dee01ea704a /source/windowing
parent7a14ad34c6bfedfe2ffdb13bd6ea6482fc0b560f (diff)
make scrollareas updating their children optional
Diffstat (limited to 'source/windowing')
-rw-r--r--source/windowing/StarScrollArea.cpp8
-rw-r--r--source/windowing/StarScrollArea.hpp4
-rw-r--r--source/windowing/StarWidgetParsing.cpp2
3 files changed, 13 insertions, 1 deletions
diff --git a/source/windowing/StarScrollArea.cpp b/source/windowing/StarScrollArea.cpp
index 775462a..166f4b4 100644
--- a/source/windowing/StarScrollArea.cpp
+++ b/source/windowing/StarScrollArea.cpp
@@ -385,7 +385,9 @@ bool ScrollArea::sendEvent(InputEvent const& event) {
}
void ScrollArea::update(float dt) {
- Widget::update(dt);
+ if (m_updatesChildren)
+ Widget::update(dt);
+
if (!m_visible)
return;
@@ -443,4 +445,8 @@ int ScrollArea::advanceFactorHelper() {
return (int)std::ceil((m_buttonAdvance * t) / (float)ScrollAdvanceTimer);
}
+void ScrollArea::setUpdatesChildren(bool slop) {
+ m_updatesChildren = slop;
+}
+
}
diff --git a/source/windowing/StarScrollArea.hpp b/source/windowing/StarScrollArea.hpp
index eac1e53..8b4b74f 100644
--- a/source/windowing/StarScrollArea.hpp
+++ b/source/windowing/StarScrollArea.hpp
@@ -98,6 +98,8 @@ public:
bool verticalScroll() const;
void setVerticalScroll(bool vertical);
+ void setUpdatesChildren(bool slop);
+
virtual bool sendEvent(InputEvent const& event) override;
virtual void update(float dt) override;
@@ -124,6 +126,8 @@ private:
bool m_horizontalScroll;
bool m_verticalScroll;
+
+ bool m_updatesChildren;
};
typedef shared_ptr<ScrollArea> ScrollAreaPtr;
}
diff --git a/source/windowing/StarWidgetParsing.cpp b/source/windowing/StarWidgetParsing.cpp
index 7a9ea4a..68ec258 100644
--- a/source/windowing/StarWidgetParsing.cpp
+++ b/source/windowing/StarWidgetParsing.cpp
@@ -779,6 +779,8 @@ WidgetConstructResult WidgetParser::scrollAreaHandler(String const& name, Json c
if (config.contains("verticalScroll"))
scrollArea->setVerticalScroll(config.getBool("verticalScroll"));
+ scrollArea->setUpdatesChildren(config.getBool("updatesChildren", false));
+
common(scrollArea, config);
return WidgetConstructResult(scrollArea, name, config.getFloat("zlevel", 0));
}