当前位置: 首页>>代码示例>>C++>>正文


C++ TRect::GetWidth方法代码示例

本文整理汇总了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;
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:32,代码来源:TSplitter.cpp

示例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();
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:54,代码来源:TScrollBar.cpp

示例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);
	}
} 
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:14,代码来源:TWindow.cpp

示例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;
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:17,代码来源:TSplitter.cpp

示例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;
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:44,代码来源:TSplitter.cpp


注:本文中的TRect::GetWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。