From 6f08a77cace2be004826f49a0c9774d7bfc797f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 15 May 2018 17:02:21 +0200 Subject: [PATCH] [escher] create TransparentView --- escher/Makefile | 1 + escher/include/escher.h | 1 + escher/include/escher/transparent_view.h | 11 +++++++++++ escher/include/escher/view.h | 3 ++- escher/src/transparent_view.cpp | 8 ++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 escher/include/escher/transparent_view.h create mode 100644 escher/src/transparent_view.cpp diff --git a/escher/Makefile b/escher/Makefile index f1a39b081..c09c89a02 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -75,6 +75,7 @@ objs += $(addprefix escher/src/,\ timer.o\ toolbox.o\ toolbox_message_tree.o\ + transparent_view.o\ view.o\ view_controller.o\ warning_controller.o\ diff --git a/escher/include/escher.h b/escher/include/escher.h index c1e6896a8..9d136ab4f 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -77,6 +77,7 @@ #include #include #include +#include #include #include #include diff --git a/escher/include/escher/transparent_view.h b/escher/include/escher/transparent_view.h new file mode 100644 index 000000000..582e20eac --- /dev/null +++ b/escher/include/escher/transparent_view.h @@ -0,0 +1,11 @@ +#ifndef ESCHER_TRANSPARENT_VIEW_H +#define ESCHER_TRANSPARENT_VIEW_H + +#include + +class TransparentView : public View { +public: + void markRectAsDirty(KDRect rect) override; +}; + +#endif diff --git a/escher/include/escher/view.h b/escher/include/escher/view.h index c1f6bdde8..8ba895c9f 100644 --- a/escher/include/escher/view.h +++ b/escher/include/escher/view.h @@ -23,6 +23,7 @@ class Window; class View { // We only want Window to be able to invoke View::redraw friend class Window; + friend class TransparentView; public: View(); virtual ~View(); @@ -58,7 +59,7 @@ protected: * - Moving a cursor -> In that case, there's really a much more efficient way * - ... and that's all I can think of. */ - void markRectAsDirty(KDRect rect); + virtual void markRectAsDirty(KDRect rect); #if ESCHER_VIEW_LOGGING virtual const char * className() const; virtual void logAttributes(std::ostream &os) const; diff --git a/escher/src/transparent_view.cpp b/escher/src/transparent_view.cpp new file mode 100644 index 000000000..5eb138ad4 --- /dev/null +++ b/escher/src/transparent_view.cpp @@ -0,0 +1,8 @@ +#include + +void TransparentView::markRectAsDirty(KDRect rect) { + if (m_superview) { + m_superview->markRectAsDirty(KDRect(m_superview->pointFromPointInView(this, rect.origin()), rect.size())); + } + View::markRectAsDirty(rect); +}