本文整理汇总了C++中TRect::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ TRect::GetWidth方法的具体用法?C++ TRect::GetWidth怎么用?C++ TRect::GetWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRect
的用法示例。
在下文中一共展示了TRect::GetWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoMouseUp
void TSplitter::DoMouseUp(const TPoint& mouse, TMouseButton button, TModifierState state)
{
if (fTracking && button == kLeftButton)
{
TPoint point;
ConstrainMouse(mouse, point);
if (!fLiveDrag)
{
TRect rect;
GetTrackingRect(fLastMouse, rect);
DrawTrackingRect(rect);
TRect bounds;
GetLocalBounds(bounds);
if (fVertical)
fRatio = (float)point.h / (float)bounds.GetWidth();
else
fRatio = (float)point.v / (float)bounds.GetHeight();
if (fRatio < 0.0)
fRatio = 0.0;
else if (fRatio > 1.0)
fRatio = 1.0;
ResizeChildren();
}
fTracking = false;
}
}
示例2: GetThumb
void TScrollBar::GetThumb(TRect& r) const
{
if (fMinimum < fMaximum)
{
GetThumbArea(r);
if (IsVertical())
{
TCoord available = r.GetHeight();
if (available > kMinThumbSize)
{
TCoord thumbSize;
if (fProportionalThumbs)
thumbSize = ((long long)fBounds.GetHeight() * (long long)available) / (long long)(fMaximum - fMinimum + fBounds.GetHeight());
else
thumbSize = fBounds.GetWidth();
if (thumbSize < kMinThumbSize)
thumbSize = kMinThumbSize;
else if (thumbSize > available)
thumbSize = available;
available -= thumbSize;
r.top += (int)(((long long)(fValue - fMinimum) * (long long)available) / (long long)(fMaximum - fMinimum));
r.bottom = r.top + thumbSize;
}
}
else
{
TCoord available = r.GetWidth();
if (available > kMinThumbSize)
{
TCoord thumbSize;
if (fProportionalThumbs)
thumbSize = ((long long)fBounds.GetWidth() * (long long)available) / (long long)(fMaximum - fMinimum + fBounds.GetWidth());
else
thumbSize = fBounds.GetHeight();
if (thumbSize < kMinThumbSize)
thumbSize = kMinThumbSize;
else if (thumbSize > available)
thumbSize = available;
available -= thumbSize;
r.left += (int)(((long long)(fValue - fMinimum) * (long long)available) / (long long)(fMaximum - fMinimum));
r.right = r.left + thumbSize;
}
}
}
else
r.SetEmpty();
}
示例3: SetBounds
void TWindow::SetBounds(const TRect& bounds)
{
if (fWindow)
XMoveResizeWindow(sDisplay, fWindow, bounds.left, bounds.top, bounds.GetWidth(), bounds.GetHeight());
// do the notification for child windows or unmapped windows.
if ((!fWindow || fParent) && bounds != fBounds)
{
TRect oldBounds(fBounds);
fBounds = bounds;
NotifyBoundsChanged(oldBounds);
}
}
示例4: GetSplitterRect
void TSplitter::GetSplitterRect(float ratio, TRect& rect) const
{
ASSERT(ratio >= 0.0 && ratio <= 1.0);
GetLocalBounds(rect);
if (fVertical)
{
rect.left = (TCoord)((rect.GetWidth() - kSplitterWidth) * fRatio);
rect.right = rect.left + kSplitterWidth;
}
else
{
rect.top = (TCoord)((rect.GetHeight() - kSplitterWidth) * fRatio);
rect.bottom = rect.top + kSplitterWidth;
}
}
示例5: DoMouseMoved
void TSplitter::DoMouseMoved(const TPoint& mouse, TModifierState state)
{
if (fTracking)
{
TPoint point;
ConstrainMouse(mouse, point);
if ((fVertical && fLastMouse.h != point.h) ||
(!fVertical && fLastMouse.v != point.v))
{
if (fLiveDrag)
{
TRect bounds;
GetLocalBounds(bounds);
if (fVertical)
fRatio = (float)point.h / (float)bounds.GetWidth();
else
fRatio = (float)point.v / (float)bounds.GetHeight();
if (fRatio < 0.0)
fRatio = 0.0;
else if (fRatio > 1.0)
fRatio = 1.0;
ResizeChildren();
TDrawContext context(this);
DrawSplitterRect(context);
}
else
{
TRect rect;
GetTrackingRect(fLastMouse, rect);
DrawTrackingRect(rect);
GetTrackingRect(point, rect);
DrawTrackingRect(rect);
}
}
fLastMouse = point;
}
}