From dc2944d5e90c5840c26b1868a06d49b752a99fd5 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 8 May 2016 14:59:26 -0700 Subject: [PATCH] Make Widget::screen_rect() const. Because I can. --- firmware/common/ui_widget.cpp | 2 +- firmware/common/ui_widget.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/common/ui_widget.cpp b/firmware/common/ui_widget.cpp index 788b7abf..abc040c3 100644 --- a/firmware/common/ui_widget.cpp +++ b/firmware/common/ui_widget.cpp @@ -56,7 +56,7 @@ Size Widget::size() const { return parent_rect.size; } -Rect Widget::screen_rect() { +Rect Widget::screen_rect() const { return parent() ? (parent_rect + parent()->screen_pos()) : parent_rect; } diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index 1b99d282..eb45de44 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -69,7 +69,7 @@ public: Point screen_pos(); Size size() const; - Rect screen_rect(); + Rect screen_rect() const; virtual void set_parent_rect(const Rect new_parent_rect); Widget* parent() const;