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


C++ Panel::GetPinCorner方法代码示例

本文整理汇总了C++中Panel::GetPinCorner方法的典型用法代码示例。如果您正苦于以下问题:C++ Panel::GetPinCorner方法的具体用法?C++ Panel::GetPinCorner怎么用?C++ Panel::GetPinCorner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Panel的用法示例。


在下文中一共展示了Panel::GetPinCorner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnSizeChanged

//-----------------------------------------------------------------------------
// Purpose: Callback for when the panel size has been changed
//-----------------------------------------------------------------------------
void EditablePanel::OnSizeChanged(int wide, int tall)
{
	BaseClass::OnSizeChanged(wide, tall);
	InvalidateLayout();

	int dx = wide - _baseWide;
	int dy = tall - _baseTall;

	for (int i = 0; i < GetChildCount(); i++)
	{
		// perform auto-layout on the child panel
		Panel *child = GetChild(i);

		int x, y, w, t;
		child->GetBounds(x, y, w, t);

		if (child->GetPinCorner() == PIN_TOPRIGHT || child->GetPinCorner() == PIN_BOTTOMRIGHT)
		{
			// move along with the right edge
			x += dx;
		}

		if (child->GetPinCorner() == PIN_BOTTOMLEFT || child->GetPinCorner() == PIN_BOTTOMRIGHT)
		{
			// move along with the lower edge
			y += dy;
		}

		// check for resize
		if (child->GetAutoResize() == AUTORESIZE_RIGHT || child->GetAutoResize() == AUTORESIZE_DOWNANDRIGHT)
		{
			w += dx;
		}

		if (child->GetAutoResize() == AUTORESIZE_DOWN || child->GetAutoResize() == AUTORESIZE_DOWNANDRIGHT)
		{
			t += dy;
		}

		// make sure the child isn't too big...
		if(x+w>wide)
		{
			continue;
		}
		
		if(y+t>tall)
		{
			continue;
		}

		child->SetBounds(x, y, w, t);
		child->InvalidateLayout();
	}
	Repaint();

	// update the baselines
	_baseWide = wide;
	_baseTall = tall;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:62,代码来源:EditablePanel.cpp

示例2: OnSizeChanged

//-----------------------------------------------------------------------------
// Purpose: Callback for when the panel size has been changed
//-----------------------------------------------------------------------------
void EditablePanel::OnSizeChanged(int wide, int tall)
{
	BaseClass::OnSizeChanged(wide, tall);
	InvalidateLayout();

	for (int i = 0; i < GetChildCount(); i++)
	{
		// perform auto-layout on the child panel
		Panel *child = GetChild(i);
		if ( !child )
			continue;

		int x, y, w, h;
		child->GetBounds( x, y, w, h );

		int px, py;
		child->GetPinOffset( px, py );

		int ox, oy;
		child->GetResizeOffset( ox, oy );

		int ex;
		int ey;

		AutoResize_e resize = child->GetAutoResize(); 
		bool bResizeHoriz = ( resize == AUTORESIZE_RIGHT || resize == AUTORESIZE_DOWNANDRIGHT );
		bool bResizeVert = ( resize == AUTORESIZE_DOWN || resize == AUTORESIZE_DOWNANDRIGHT );

		PinCorner_e pinCorner = child->GetPinCorner();
		if ( pinCorner == PIN_TOPRIGHT || pinCorner == PIN_BOTTOMRIGHT )
		{
			// move along with the right edge
			ex = wide + px;
			x = bResizeHoriz ? ox : ex - w;
		}
		else
		{
			x = px;
			ex = bResizeHoriz ? wide + ox : px + w;
		}

		if ( pinCorner == PIN_BOTTOMLEFT || pinCorner == PIN_BOTTOMRIGHT )
		{
			// move along with the right edge
			ey = tall + py;
			y = bResizeVert ? oy : ey - h;
		}
		else
		{
			y = py;
			ey = bResizeVert ? tall + oy : py + h;
		}

		// Clamp..
		if ( ex < x )
		{
			ex = x;
		}
		if ( ey < y )
		{
			ey = y;
		}

		child->SetBounds( x, y, ex - x, ey - y );
		child->InvalidateLayout();
	}
	Repaint();
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:71,代码来源:editablepanel.cpp


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