本文整理汇总了C++中TRect::MinX方法的典型用法代码示例。如果您正苦于以下问题:C++ TRect::MinX方法的具体用法?C++ TRect::MinX怎么用?C++ TRect::MinX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRect
的用法示例。
在下文中一共展示了TRect::MinX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompatibleDraw
//! The fun part of the control
//!
//! XXX need to test with vertically oriented images
void TMeterControl::CompatibleDraw(RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
{
#pragma unused(inLimitRgn)
TRect bounds = Bounds();
CGContextRef context = inContext;
SliderOrientation boundsOrientation = OrientationForRect(bounds);
TRect backBounds = RectForCGImage(mBackImage);
float scaleY = ScaleY();
// draw slider thumb
if (mThumbImage)
{
TRect thumbBounds = ScaledThumbBounds();
// compute a thumb bounds oriented the same as the slider
TRect orientedThumbBounds = thumbBounds;
if (boundsOrientation != mImageOrientation)
{
float temp = orientedThumbBounds.Width();
orientedThumbBounds.SetWidth(orientedThumbBounds.Height());
orientedThumbBounds.SetHeight(temp);
}
// the thumb image is assumed to be of the same orientation as the
// background image
float slideDistance;
if (boundsOrientation == TSliderControl::kVerticalOrientation)
slideDistance = orientedThumbBounds.Height();
else
slideDistance = orientedThumbBounds.Width();
slideDistance -= (mTopInset + mBottomInset) * scaleY;
float position = (float(GetValue() - GetMinimum()) / float(GetMaximum() - GetMinimum())) * slideDistance;
orientedThumbBounds.SetAroundCenter(bounds.CenterX(), bounds.CenterY(),
orientedThumbBounds.Width(), orientedThumbBounds.Height());
#if 0
float xOffset, yOffset;
if (boundsOrientation == TSliderControl::kVerticalOrientation)
{
xOffset = bounds.CenterX() + mXInset - orientedThumbBounds.Width()/2.0;
yOffset = bounds.MinY() + mTopInset + (bounds.Height() + slideDistance) / 2.0;
}
else
{
xOffset = bounds.MinX() + mTopInset + (bounds.Width() + slideDistance) / 2.0;
yOffset = bounds.CenterY() + mXInset - - orientedThumbBounds.Height()/2.0;;
}
#else
float xOffset, yOffset;
if (boundsOrientation == TSliderControl::kVerticalOrientation)
{
xOffset = bounds.CenterX() + mXInset - orientedThumbBounds.Width()/2.0;
yOffset = bounds.CenterY() + mTopInset - slideDistance / 2.0;
}
else
{
yOffset = bounds.CenterY() + mXInset - orientedThumbBounds.Height()/2.0;;
xOffset = bounds.CenterX() + mTopInset - slideDistance / 2.0;
}
#endif
CGContextTranslateCTM(context, xOffset, yOffset);
orientedThumbBounds.SetOrigin(thumbBounds.Origin());
if (boundsOrientation == TSliderControl::kHorizontalOrientation) {
orientedThumbBounds.SetWidth(position);
} else {
orientedThumbBounds.MoveBy(0, orientedThumbBounds.Height()-position);
orientedThumbBounds.SetHeight(position);
}
CGContextClipToRect(context, orientedThumbBounds);
if (mImageOrientation != boundsOrientation)
{
CGContextRotateCTM(context, DegreesToRadians(90.0));
}
HIViewDrawCGImage(context, &thumbBounds, mThumbImage);
}
}