diff --git a/escher/include/escher/view.h b/escher/include/escher/view.h index 442c53b40..a5fa14056 100644 --- a/escher/include/escher/view.h +++ b/escher/include/escher/view.h @@ -30,7 +30,7 @@ class View { friend class TransparentView; friend class Shared::RoundCursorView; public: - View(); + View() : m_frame(KDRectZero), m_superview(nullptr), m_dirtyRect(KDRectZero) {} virtual ~View() { for (int i = 0; i < numberOfSubviews(); i++) { View * subview = subviewAtIndex(i); @@ -49,7 +49,9 @@ public: /* The drawRect method should be implemented by each View subclass. In a * typical drawRect implementation, a subclass will make drawing calls to the * Kandinsky library using the provided context. */ - virtual void drawRect(KDContext * ctx, KDRect rect) const; + virtual void drawRect(KDContext * ctx, KDRect rect) const { + // By default, a view doesn't do anything, it's transparent + } void setSize(KDSize size); void setFrame(KDRect frame); @@ -58,7 +60,7 @@ public: KDRect bounds() const; View * subview(int index); - virtual KDSize minimalSizeForOptimalDisplay() const; + virtual KDSize minimalSizeForOptimalDisplay() const { return KDSizeZero; } #if ESCHER_VIEW_LOGGING friend std::ostream &operator<<(std::ostream &os, View &view); @@ -80,13 +82,9 @@ protected: #endif KDRect m_frame; private: - virtual int numberOfSubviews() const { - return 0; - } - virtual View * subviewAtIndex(int index) { - return nullptr; - } - virtual void layoutSubviews(); + virtual int numberOfSubviews() const { return 0; } + virtual View * subviewAtIndex(int index) { return nullptr; } + virtual void layoutSubviews(bool force = false) {} virtual const Window * window() const; KDRect redraw(KDRect rect, KDRect forceRedrawRect = KDRectZero); KDPoint absoluteOrigin() const; diff --git a/escher/src/view.cpp b/escher/src/view.cpp index 829a77779..2542aa0f3 100644 --- a/escher/src/view.cpp +++ b/escher/src/view.cpp @@ -3,18 +3,6 @@ extern "C" { } #include -View::View() : - m_frame(KDRectZero), - m_superview(nullptr), - m_dirtyRect(KDRectZero) -{ -} - -void View::drawRect(KDContext * ctx, KDRect rect) const { - // By default, a view doesn't do anything - // It's transparent! -} - const Window * View::window() const { if (m_superview == nullptr) { return nullptr; @@ -167,14 +155,6 @@ KDRect View::absoluteVisibleFrame() const { } } -KDSize View::minimalSizeForOptimalDisplay() const { - return KDSizeZero; -} - -void View::layoutSubviews() { -} - - #if ESCHER_VIEW_LOGGING const char * View::className() const { return "View";