22 #ifndef __MYGUI_I_CROPPED_RECTANGLE_H__
23 #define __MYGUI_I_CROPPED_RECTANGLE_H__
44 return mCroppedParent;
48 virtual void setPosition(
const IntPoint& _value)
50 mCoord.left = _value.
left;
51 mCoord.top = _value.
top;
54 virtual void setSize(
const IntSize& _value)
56 mCoord.width = _value.
width;
57 mCoord.height = _value.
height;
68 return mCoord.point();
84 return mAbsolutePosition;
89 return IntRect(mAbsolutePosition.left, mAbsolutePosition.top, mAbsolutePosition.left + mCoord.width, mAbsolutePosition.top + mCoord.height);
94 return IntCoord(mAbsolutePosition.left, mAbsolutePosition.top, mCoord.width, mCoord.height);
98 int getAbsoluteLeft()
const
100 return mAbsolutePosition.left;
103 int getAbsoluteTop()
const
105 return mAbsolutePosition.top;
116 return mCoord.right();
124 int getBottom()
const
126 return mCoord.bottom();
134 int getHeight()
const
136 return mCoord.height;
142 bool _isMargin()
const
148 int _getViewLeft()
const
150 return mCoord.left + mMargin.left;
152 int _getViewRight()
const
154 return mCoord.right() - mMargin.right;
156 int _getViewTop()
const
158 return mCoord.top + mMargin.top;
160 int _getViewBottom()
const
162 return mCoord.bottom() - mMargin.bottom;
164 int _getViewWidth()
const
166 return mCoord.width - mMargin.left - mMargin.right;
168 int _getViewHeight()
const
170 return mCoord.height - mMargin.top - mMargin.bottom;
175 mCroppedParent = _parent;
182 int _getMarginLeft()
const
186 int _getMarginRight()
const
188 return mMargin.right;
190 int _getMarginTop()
const
194 int _getMarginBottom()
const
196 return mMargin.bottom;
204 if (getLeft() < mCroppedParent->mMargin.left)
206 mMargin.left = mCroppedParent->mMargin.left - getLeft();
215 if (getRight() > mCroppedParent->getWidth() - mCroppedParent->mMargin.right)
217 mMargin.right = getRight() - (mCroppedParent->getWidth() - mCroppedParent->mMargin.right);
226 if (getTop() < mCroppedParent->mMargin.top)
228 mMargin.top = mCroppedParent->mMargin.top - getTop();
237 if (getBottom() > mCroppedParent->getHeight() - mCroppedParent->mMargin.bottom)
239 mMargin.bottom = getBottom() - (mCroppedParent->getHeight() - mCroppedParent->mMargin.bottom);
250 bool _checkOutside() const
252 return ( (getRight() < mCroppedParent->mMargin.left ) ||
253 (getLeft() > mCroppedParent->getWidth() - mCroppedParent->mMargin.right ) ||
254 (getBottom() < mCroppedParent->mMargin.top ) ||
255 (getTop() > mCroppedParent->getHeight() - mCroppedParent->mMargin.bottom ) );
269 #endif // __MYGUI_I_CROPPED_RECTANGLE_H__