diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2011-11-19 13:44:26 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2011-11-19 14:04:35 +0800 |
commit | 9919334ca66802d3540030de24a2532cb42889e5 (patch) | |
tree | d1ae7705e038ad42f59daad919d77b83abd64f9d | |
parent | 9459f9a638500095f242f1c50b8deab1c154b8d9 (diff) |
SexyAppFramework: Added a absolute center point getter to widget
-rw-r--r-- | osframework/source/SexyAppFramework/WidgetContainer.cpp | 7 | ||||
-rw-r--r-- | osframework/source/SexyAppFramework/WidgetContainer.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/osframework/source/SexyAppFramework/WidgetContainer.cpp b/osframework/source/SexyAppFramework/WidgetContainer.cpp index 59d8172..8a1e306 100644 --- a/osframework/source/SexyAppFramework/WidgetContainer.cpp +++ b/osframework/source/SexyAppFramework/WidgetContainer.cpp @@ -334,6 +334,13 @@ Point WidgetContainer::GetCenter() const // relative to top level return Point(mX + (mWidth / 2), mY + (mHeight / 2)); } + +Point WidgetContainer::GetAbsCenter() const // relative to top level +{ + const Point p = GetAbsPos(); + return Point(p.mX + (mWidth / 2), p.mY + (mHeight / 2)); +} + struct WidgetCompare { bool operator() (Widget* const & lhs, Widget* const & rhs) const diff --git a/osframework/source/SexyAppFramework/WidgetContainer.h b/osframework/source/SexyAppFramework/WidgetContainer.h index 3d90107..7f0dde8 100644 --- a/osframework/source/SexyAppFramework/WidgetContainer.h +++ b/osframework/source/SexyAppFramework/WidgetContainer.h @@ -67,6 +67,7 @@ public: virtual void PutInfront(Widget* theWidget, Widget* theRefWidget); virtual Point GetAbsPos() const ; // relative to top level virtual Point GetCenter() const ; + virtual Point GetAbsCenter() const ; virtual void MarkDirty(); virtual void MarkDirtyFull(); |