From 4dbda55f670866db29a64ca7a79500efbe6f8d00 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 11 Oct 2012 23:17:58 +0300 Subject: Replace some getters to direct fileds using. --- src/guichan/include/guichan/widget.hpp | 15 ++++++++++----- src/guichan/widget.cpp | 27 +-------------------------- 2 files changed, 11 insertions(+), 31 deletions(-) (limited to 'src/guichan') diff --git a/src/guichan/include/guichan/widget.hpp b/src/guichan/include/guichan/widget.hpp index 1b8b6ae54..87d2868c3 100644 --- a/src/guichan/include/guichan/widget.hpp +++ b/src/guichan/include/guichan/widget.hpp @@ -180,7 +180,8 @@ namespace gcn * has no parent. * @since 0.1.0 */ - virtual Widget* getParent() const; + virtual Widget* getParent() const + { return mParent; } /** * Sets the width of the widget. @@ -200,7 +201,8 @@ namespace gcn * setDimension, getDimension * @since 0.1.0 */ - int getWidth() const; + int getWidth() const + { return mDimension.width; } /** * Sets the height of the widget. @@ -220,7 +222,8 @@ namespace gcn * setDimension, getDimension * @since 0.1.0 */ - int getHeight() const; + int getHeight() const + { return mDimension.height; } /** * Sets the size of the widget. @@ -251,7 +254,8 @@ namespace gcn * @see setX, setY, getY, setPosition, setDimension, getDimension * @since 0.1.0 */ - int getX() const; + int getX() const + { return mDimension.x; } /** * Sets the y coordinate of the widget. The coordinate is @@ -271,7 +275,8 @@ namespace gcn * @see setY, setX, getX, setPosition, setDimension, getDimension * @since 0.1.0 */ - int getY() const; + int getY() const + { return mDimension.y; } /** * Sets position of the widget. The position is relative diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp index 95e026d98..e9e846e76 100644 --- a/src/guichan/widget.cpp +++ b/src/guichan/widget.cpp @@ -133,11 +133,6 @@ namespace gcn mParent = parent; } - Widget* Widget::getParent() const - { - return mParent; - } - void Widget::setWidth(int width) { Rectangle newDimension = mDimension; @@ -146,11 +141,6 @@ namespace gcn setDimension(newDimension); } - int Widget::getWidth() const - { - return mDimension.width; - } - void Widget::setHeight(int height) { Rectangle newDimension = mDimension; @@ -159,11 +149,6 @@ namespace gcn setDimension(newDimension); } - int Widget::getHeight() const - { - return mDimension.height; - } - void Widget::setX(int x) { Rectangle newDimension = mDimension; @@ -172,11 +157,6 @@ namespace gcn setDimension(newDimension); } - int Widget::getX() const - { - return mDimension.x; - } - void Widget::setY(int y) { Rectangle newDimension = mDimension; @@ -185,17 +165,12 @@ namespace gcn setDimension(newDimension); } - int Widget::getY() const - { - return mDimension.y; - } - void Widget::setPosition(int x, int y) { Rectangle newDimension = mDimension; newDimension.x = x; newDimension.y = y; - + setDimension(newDimension); } -- cgit v1.2.3-60-g2f50