[escher] create TransparentView

This commit is contained in:
Émilie Feral
2018-05-15 17:02:21 +02:00
committed by Ecco
parent c6ec8310b2
commit 6f08a77cac
5 changed files with 23 additions and 1 deletions

View File

@@ -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\

View File

@@ -77,6 +77,7 @@
#include <escher/timer.h>
#include <escher/toolbox.h>
#include <escher/toolbox_message_tree.h>
#include <escher/transparent_view.h>
#include <escher/view.h>
#include <escher/view_controller.h>
#include <escher/warning_controller.h>

View File

@@ -0,0 +1,11 @@
#ifndef ESCHER_TRANSPARENT_VIEW_H
#define ESCHER_TRANSPARENT_VIEW_H
#include <escher/view.h>
class TransparentView : public View {
public:
void markRectAsDirty(KDRect rect) override;
};
#endif

View File

@@ -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;

View File

@@ -0,0 +1,8 @@
#include <escher/transparent_view.h>
void TransparentView::markRectAsDirty(KDRect rect) {
if (m_superview) {
m_superview->markRectAsDirty(KDRect(m_superview->pointFromPointInView(this, rect.origin()), rect.size()));
}
View::markRectAsDirty(rect);
}