代码拉取完成,页面将自动刷新
//========= Copyright ?1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "ScrollableEditablePanel.h"
#include "ScrollBar.h"
using namespace vgui2;
ScrollableEditablePanel::ScrollableEditablePanel( vgui2::Panel *pParent, vgui2::EditablePanel *pChild, const char *pName ) :
BaseClass( pParent, pName )
{
m_pChild = pChild;
m_pChild->SetParent( this );
m_pScrollBar = new vgui2::ScrollBar( this, "VerticalScrollBar", true );
m_pScrollBar->SetWide( 16 );
m_pScrollBar->SetAutoResize( PIN_TOPRIGHT, AUTORESIZE_DOWN, 0, 0, -16, 0 );
m_pScrollBar->AddActionSignalTarget( this );
}
void ScrollableEditablePanel::PerformLayout()
{
BaseClass::PerformLayout();
m_pChild->SetWide( GetWide() - 16 );
m_pScrollBar->SetRange( 0, m_pChild->GetTall() );
m_pScrollBar->SetRangeWindow( GetTall() );
}
//-----------------------------------------------------------------------------
// Called when the scroll bar moves
//-----------------------------------------------------------------------------
void ScrollableEditablePanel::OnScrollBarSliderMoved()
{
InvalidateLayout();
int nScrollAmount = m_pScrollBar->GetValue();
m_pChild->SetPos( 0, -nScrollAmount );
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。