include/vcl/weld/customweld.hxx | 29 +++++++++++++++++++++++++++-- vcl/source/app/customweld.cxx | 1 + 2 files changed, 28 insertions(+), 2 deletions(-)
New commits: commit 21b0793b53645d577c193892c0d9f5a2f27f6927 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Feb 14 21:58:41 2026 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Feb 15 22:27:14 2026 +0100 Related: tdf#143449 allow distinguishing Invalidation reasons Change-Id: Icf6d7adc7bcf4edcb361fd294541d78a2bc7a57e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199393 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/weld/customweld.hxx b/include/vcl/weld/customweld.hxx index 2d7b7b3417d1..91a27976d75e 100644 --- a/include/vcl/weld/customweld.hxx +++ b/include/vcl/weld/customweld.hxx @@ -10,6 +10,7 @@ #pragma once #include <comphelper/OAccessible.hxx> +#include <o3tl/typed_flags_set.hxx> #include <vcl/weld/DrawingArea.hxx> #include <rtl/ref.hxx> #include <vcl/uitest/factory.hxx> @@ -21,11 +22,30 @@ namespace weld { class Builder; +// Reasons for invalidation, accumulated via OR between paints +enum class InvalidateFlags : sal_uInt8 +{ + NONE = 0x00, + Cursor = 0x01, // Cursor blink only + All = 0xff // Default +}; +} + +namespace o3tl +{ +template <> struct typed_flags<weld::InvalidateFlags> : is_typed_flags<weld::InvalidateFlags, 0xff> +{ +}; +} + +namespace weld +{ class VCL_DLLPUBLIC CustomWidgetController { private: Size m_aSize; weld::DrawingArea* m_pDrawingArea; + InvalidateFlags m_eInvalidateFlags; DECL_LINK(DragBeginHdl, weld::DrawingArea&, bool); public: @@ -50,19 +70,23 @@ public: void SetOutputSizePixel(const Size& rSize) { m_aSize = rSize; } virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) { m_pDrawingArea = pDrawingArea; } weld::DrawingArea* GetDrawingArea() const { return m_pDrawingArea; } - void Invalidate() + void Invalidate(InvalidateFlags eFlags = InvalidateFlags::All) { + m_eInvalidateFlags |= eFlags; if (!m_pDrawingArea) return; m_pDrawingArea->queue_draw(); } - void Invalidate(const tools::Rectangle& rRect) + void Invalidate(const tools::Rectangle& rRect, InvalidateFlags eFlags = InvalidateFlags::All) { + m_eInvalidateFlags |= eFlags; if (!m_pDrawingArea) return; m_pDrawingArea->queue_draw_area(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight()); } + InvalidateFlags GetInvalidateFlags() const { return m_eInvalidateFlags; } + void ClearInvalidateFlags() { m_eInvalidateFlags = InvalidateFlags::NONE; } virtual void Show() { m_pDrawingArea->show(); } virtual void Hide() { m_pDrawingArea->hide(); } void SetCursor(void* pData) { m_pDrawingArea->set_cursor_data(pData); } @@ -137,6 +161,7 @@ public: } CustomWidgetController() : m_pDrawingArea(nullptr) + , m_eInvalidateFlags(InvalidateFlags::NONE) { } virtual ~CustomWidgetController(); diff --git a/vcl/source/app/customweld.cxx b/vcl/source/app/customweld.cxx index dc3d399604af..19344d076b7c 100644 --- a/vcl/source/app/customweld.cxx +++ b/vcl/source/app/customweld.cxx @@ -58,6 +58,7 @@ IMPL_LINK(CustomWeld, DoResize, const Size&, rSize, void) IMPL_LINK(CustomWeld, DoPaint, weld::DrawingArea::draw_args, aPayload, void) { m_rWidgetController.Paint(aPayload.first, aPayload.second); + m_rWidgetController.ClearInvalidateFlags(); } IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
