diff options
-rw-r--r-- | include/vcl/layout.hxx | 1 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 2296f8097a4a..f5090b24eac2 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -498,6 +498,7 @@ public: //to override it void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;} void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure); + virtual void DumpAsPropertyTree(::tools::JsonWriter& rJsonWriter) override; private: virtual Size calculateRequisition() const override; virtual void setAllocation(const Size &rAllocation) override; diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 039cb2690a9d..c77a4a0d30e1 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -2167,6 +2167,53 @@ void VclScrolledWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R nBorderWidth << " is larger than expected " << m_nBorderWidth); } +namespace { +void lcl_dumpScrollbar(::tools::JsonWriter& rJsonWriter, ScrollBar& rScrollBar) +{ + rJsonWriter.put("lower", rScrollBar.GetRangeMin()); + rJsonWriter.put("upper", rScrollBar.GetRangeMax()); + rJsonWriter.put("step_increment", rScrollBar.GetLineSize()); + rJsonWriter.put("page_increment", rScrollBar.GetPageSize()); + rJsonWriter.put("value", rScrollBar.GetThumbPos()); + rJsonWriter.put("page_size", rScrollBar.GetVisibleSize()); +} +}; + +void VclScrolledWindow::DumpAsPropertyTree(::tools::JsonWriter& rJsonWriter) +{ + VclBin::DumpAsPropertyTree(rJsonWriter); + + { + auto aVertical = rJsonWriter.startNode("vertical"); + + ScrollBar& rScrollBar = getVertScrollBar(); + lcl_dumpScrollbar(rJsonWriter, rScrollBar); + + WinBits nWinBits = GetStyle(); + if (nWinBits & WB_VSCROLL) + rJsonWriter.put("policy", "always"); + else if (nWinBits & WB_AUTOVSCROLL) + rJsonWriter.put("policy", "auto"); + else + rJsonWriter.put("policy", "never"); + } + + { + auto aHorizontal = rJsonWriter.startNode("horizontal"); + + ScrollBar& rScrollBar = getHorzScrollBar(); + lcl_dumpScrollbar(rJsonWriter, rScrollBar); + + WinBits nWinBits = GetStyle(); + if (nWinBits & WB_HSCROLL) + rJsonWriter.put("policy", "always"); + else if (nWinBits & WB_AUTOHSCROLL) + rJsonWriter.put("policy", "auto"); + else + rJsonWriter.put("policy", "never"); + } +} + void VclViewport::setAllocation(const Size &rAllocation) { vcl::Window *pChild = get_child(); |