7 #ifndef __MYGUI_I_CROPPED_RECTANGLE_H__
8 #define __MYGUI_I_CROPPED_RECTANGLE_H__
29 return mCroppedParent;
33 virtual void setPosition(
const IntPoint& _value)
35 mCoord.left = _value.
left;
36 mCoord.top = _value.
top;
39 virtual void setSize(
const IntSize& _value)
41 mCoord.width = _value.
width;
42 mCoord.height = _value.
height;
53 return mCoord.point();
69 return mAbsolutePosition;
74 return IntRect(mAbsolutePosition.left, mAbsolutePosition.top, mAbsolutePosition.left + mCoord.width, mAbsolutePosition.top + mCoord.height);
79 return IntCoord(mAbsolutePosition.left, mAbsolutePosition.top, mCoord.width, mCoord.height);
83 int getAbsoluteLeft()
const
85 return mAbsolutePosition.left;
88 int getAbsoluteTop()
const
90 return mAbsolutePosition.top;
101 return mCoord.right();
109 int getBottom()
const
111 return mCoord.bottom();
119 int getHeight()
const
121 return mCoord.height;
127 bool _isMargin()
const
133 int _getViewLeft()
const
135 return mCoord.left + mMargin.left;
137 int _getViewRight()
const
139 return mCoord.right() - mMargin.right;
141 int _getViewTop()
const
143 return mCoord.top + mMargin.top;
145 int _getViewBottom()
const
147 return mCoord.bottom() - mMargin.bottom;
149 int _getViewWidth()
const
151 return mCoord.width - mMargin.left - mMargin.right;
153 int _getViewHeight()
const
155 return mCoord.height - mMargin.top - mMargin.bottom;
160 mCroppedParent = _parent;
167 int _getMarginLeft()
const
171 int _getMarginRight()
const
173 return mMargin.right;
175 int _getMarginTop()
const
179 int _getMarginBottom()
const
181 return mMargin.bottom;
189 if (getLeft() < mCroppedParent->mMargin.left)
191 mMargin.left = mCroppedParent->mMargin.left - getLeft();
200 if (getRight() > mCroppedParent->getWidth() - mCroppedParent->mMargin.right)
202 mMargin.right = getRight() - (mCroppedParent->getWidth() - mCroppedParent->mMargin.right);
211 if (getTop() < mCroppedParent->mMargin.top)
213 mMargin.top = mCroppedParent->mMargin.top - getTop();
222 if (getBottom() > mCroppedParent->getHeight() - mCroppedParent->mMargin.bottom)
224 mMargin.bottom = getBottom() - (mCroppedParent->getHeight() - mCroppedParent->mMargin.bottom);
235 bool _checkOutside() const
237 return ( (getRight() < mCroppedParent->mMargin.left ) ||
238 (getLeft() > mCroppedParent->getWidth() - mCroppedParent->mMargin.right ) ||
239 (getBottom() < mCroppedParent->mMargin.top ) ||
240 (getTop() > mCroppedParent->getHeight() - mCroppedParent->mMargin.bottom ) );
254 #endif // __MYGUI_I_CROPPED_RECTANGLE_H__