本文整理汇总了C++中Panel::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Panel::GetSize方法的具体用法?C++ Panel::GetSize怎么用?C++ Panel::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel::GetSize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CPanelListPanel::computeVPixelsNeeded(void)
{
int pixels = 0;
DATAITEM *item;
Panel *panel;
for (int i = 0; i < _dataItems.GetCount(); i++)
{
item = _dataItems[i];
if (!item)
continue;
panel = item->panel;
if (!panel)
continue;
int w, h;
panel->GetSize(w, h);
pixels += h;
}
pixels += 5; // add a buffer after the last item
return pixels;
}
示例2: scheme
//-----------------------------------------------------------------------------
// Purpose: counts the total vertical pixels
//-----------------------------------------------------------------------------
int GEHorzListPanel::ComputeHPixelsNeeded( bool bWithScrollBar /* = false */)
{
int buffer = scheme()->GetProportionalScaledValue( m_iPanelBuffer ); // add in buffer before first item
int itemtall, pixels;
int tall = GetTall();
pixels = buffer;
for ( int i = 0; i < m_SortedItems.Count(); i++ )
{
Panel *panel = m_DataItems[ m_SortedItems[i] ].panel;
if ( !panel )
continue;
int w, h;
panel->GetSize( w, h );
// Assume no scrollbar to give us the biggest possible scenario
itemtall = tall - buffer - buffer;
if ( bWithScrollBar )
itemtall -= m_hbar->GetTall();
w = (w * itemtall) / h;
pixels += w + buffer;
}
pixels += buffer; // add in buffer after last item
return pixels;
}
示例3: panel
BufferCallPaintTraverse( VPANEL panel ) : panel(panel)
{
Panel *pPanel = ipanel()->GetPanel(panel, GetControlsModuleName());
if( pPanel )
{
pPanel->GetPos(posx, posy);
pPanel->GetSize(sizex, sizey);
//parent = pPanel->GetVParent();
if( !pPanel->IsRecordingSBuffer() )
pPanel->ParentFlushSBuffer();
}
}
示例4: CalcFitRowHeight
int CGrid::CalcFitRowHeight(int iRow)
{
AssertCheck(iRow >= 0 && iRow < m_yRows, "CGrid::CalcFitRowHeight: invalid location specified");
int maxSize = 0;
for(int i=0; i < m_xCols; i++)
{
Panel *pPanel = GridEntry(i, iRow)->m_pPanel;
if(!pPanel)
continue;
int w, h;
pPanel->GetSize(w,h);
if(h > maxSize)
maxSize = h;
}
return maxSize;
}
示例5: CalcFitColumnWidth
int CGrid::CalcFitColumnWidth(int iColumn)
{
AssertCheck(iColumn >= 0 && iColumn < m_xCols, "CGrid::CalcFitColumnWidth: invalid location specified");
int maxSize = 0;
for(int i=0; i < m_yRows; i++)
{
Panel *pPanel = GridEntry(iColumn, i)->m_pPanel;
if(!pPanel)
continue;
int w, h;
pPanel->GetSize(w,h);
if(w > maxSize)
maxSize = w;
}
return maxSize;
}
示例6:
//-----------------------------------------------------------------------------
// Purpose: counts the total vertical pixels
//-----------------------------------------------------------------------------
int ControlGrid::ComputeVPixelsNeeded()
{
int iLargestH = 0;
int w, h;
int pixels = 0;
for (int iCurrentItem = 0; iCurrentItem < m_SortedItems.Count(); iCurrentItem++)
{
Panel *panel = m_DataItems[m_SortedItems[iCurrentItem]].panel;
if (!panel)
continue;
int iCurrentColumn = iCurrentItem % m_iNumColumns;
panel->GetSize(w, h);
if (iLargestH < h)
iLargestH = h;
if (iCurrentColumn == 0 && (!m_bShouldDrawLabels || iCurrentItem == 0))
pixels += m_iPanelBuffer; // add in buffer. between rows.
if (iCurrentColumn == m_iNumColumns - 1 && iCurrentItem != m_SortedItems.Count() - 1)
{
if (m_bShouldDrawLabels)
pixels += m_iLabelHeight;
pixels += iLargestH;
iLargestH = 0;
}
}
// Add in remaining height
if (m_bShouldDrawLabels)
pixels += m_iLabelHeight;
pixels += iLargestH;
pixels += m_iPanelBuffer; // add in buffer below last item
return pixels;
}
示例7:
//-----------------------------------------------------------------------------
// Purpose: counts the total vertical pixels
//-----------------------------------------------------------------------------
int PanelListPanel::ComputeVPixelsNeeded()
{
int pixels = 0;
for ( int i = 0; i < m_SortedItems.Count(); i++ )
{
Panel *panel = m_DataItems[ m_SortedItems[i] ].panel;
if ( !panel )
continue;
int w, h;
panel->GetSize( w, h );
pixels += m_iPanelBuffer; // add in buffer. between items.
pixels += h;
}
pixels += m_iPanelBuffer; // add in buffer below last item
return pixels;
}
示例8: Draw
void Draw()
{
int rposx, rposy, rsizex, rsizey;
VPANEL rparent;
Panel *pPanel = ipanel()->GetPanel(panel, GetControlsModuleName());
if( pPanel )
{
pPanel->GetPos(rposx, rposy);
pPanel->GetSize(rsizex, rsizey);
//rparent = pPanel->GetVParent();
pPanel->SetPos(posx, posy);
pPanel->SetSize(sizex, sizey);
//pPanel->SetParent(parent);
}
else
{
rposx = rposy = rsizex = rsizey = 0;
rparent = 0;
}
// SolveTraverse will update the panel in relation to the pos and size
g_pVGuiSurface->Invalidate(panel);
g_pVGuiSurface->SolveTraverse(panel);
g_pVGuiSurface->PaintTraverse(panel);
if( pPanel )
{
pPanel->SetPos(rposx, rposy);
pPanel->SetSize(rsizex, rsizey);
//pPanel->SetParent(rparent);
}
}
示例9: Update
//.........这里部分代码省略.........
for ( int i = 0; i < m_apWeaponIcons.Count(); i++)
{
if (m_apWeaponIcons[i].m_pWeaponName)
m_apWeaponIcons[i].m_pWeaponName->DeletePanel();
if (m_apWeaponIcons[i].m_pSlots)
m_apWeaponIcons[i].m_pSlots->DeletePanel();
if (m_apWeaponIcons[i].m_pImage)
m_apWeaponIcons[i].m_pImage->DeletePanel();
if (m_apWeaponIcons[i].m_pDelete)
m_apWeaponIcons[i].m_pDelete->DeletePanel();
}
m_apWeaponIcons.RemoveAll();
const char szWeaponPreviewTemplate[] =
" \"model\"\n"
" {\n"
" \"spotlight\" \"1\"\n"
" \"modelname\" \"models/weapons/beretta.mdl\"\n"
" \"origin_x\" \"30\"\n"
" \"origin_y\" \"3\"\n"
" \"origin_z\" \"-3\"\n"
" \"angles_y\" \"200\"\n"
" }";
Panel *pWeaponIconArea = FindChildByName("WeaponIconArea");
if ((ShouldShowCharacterAndWeapons() || ShouldShowEverything()) && pWeaponIconArea)
{
int iWeaponAreaX, iWeaponAreaY, iWeaponAreaW, iWeaponAreaH;
pWeaponIconArea->GetPos(iWeaponAreaX, iWeaponAreaY);
pWeaponIconArea->GetSize(iWeaponAreaW, iWeaponAreaH);
int iMargin = 5;
int iBoxSize = (iWeaponAreaW-5)/2;
int iWeapon = 0;
for (int i = 0; i < MAX_LOADOUT; i++)
{
if (!pPlayer->GetLoadoutWeaponCount((SDKWeaponID)i))
continue;
CSDKWeaponInfo* pWeaponInfo = CSDKWeaponInfo::GetWeaponInfo((SDKWeaponID)i);
if (!pWeaponInfo)
continue;
for (int j = 0; j < pPlayer->GetLoadoutWeaponCount((SDKWeaponID)i); j++)
{
float flMoveRight = 0;
if (iWeapon%2 == 1)
flMoveRight = iBoxSize + iMargin;
CWeaponIcon* pIcon = &m_apWeaponIcons[m_apWeaponIcons.AddToTail()];
pIcon->m_pWeaponName = new CFolderLabel(this, NULL);
pIcon->m_pWeaponName->SetText(VarArgs("#DA_Weapon_Obituary_%s", pWeaponInfo->szClassName+7)); // Use the obit version because it's shorter
pIcon->m_pWeaponName->SetPos(iWeaponAreaX + flMoveRight, iWeaponAreaY + 10 + (iWeapon/2) * (iBoxSize+iMargin));
pIcon->m_pWeaponName->SetSize(iBoxSize, 15);
pIcon->m_pWeaponName->SetContentAlignment(Label::a_center);
pIcon->m_pWeaponName->SetZPos(-5);
pIcon->m_pWeaponName->SetFont(vgui::scheme()->GetIScheme(GetScheme())->GetFont("FolderLarge"));
pIcon->m_pWeaponName->SetScheme("FolderScheme");
示例10: MousePressed
//.........这里部分代码省略.........
_controlGroup.RemoveAll();
}
// Show new ctrl menu if they click on the bg (not on a subcontrol)
if ( code == MOUSE_RIGHT && panel == GetContextPanel())
{
// trigger a drop down menu to create new controls
ivgui()->PostMessage (m_hBuildDialog->GetVPanel(), new KeyValues("ShowNewControlMenu"), NULL);
}
else
{
// don't respond if we click on ruler numbers
if (_showRulers) // rulers are visible
{
for ( int i=0; i < 4; i++)
{
if ( panel == _rulerNumber[i])
return true;
}
}
_dragging = true;
_dragMouseCode = code;
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("HideNewControlMenu"), NULL);
int x, y;
input()->GetCursorPos(x, y);
_dragStartCursorPos[0] = x;
_dragStartCursorPos[1] = y;
input()->SetMouseCapture(panel->GetVPanel());
_groupDeltaX.RemoveAll();
_groupDeltaY.RemoveAll();
// basepanel is the panel that all the deltas will be calculated from.
// it is the last panel we clicked in because if we move the panels as a group
// it would be from that one
Panel *basePanel = NULL;
// find the panel we clicked in, that is the base panel
// it might already be in the group
for (int i=0; i< _controlGroup.Count(); ++i)
{
if (panel == _controlGroup[i].Get())
{
basePanel = panel;
break;
}
}
// if its not in the group we just added this panel. get it in the group
if (basePanel == NULL)
{
PHandle temp;
temp = panel;
_controlGroup.AddToTail(temp);
basePanel = panel;
}
basePanel->GetPos(x,y);
_dragStartPanelPos[0]=x;
_dragStartPanelPos[1]=y;
basePanel->GetSize( _dragStartPanelSize[ 0 ], _dragStartPanelSize[ 1 ] );
// figure out the deltas of the other panels from the base panel
for (int i=0; i<_controlGroup.Count(); ++i)
{
int cx, cy;
_controlGroup[i].Get()->GetPos(cx, cy);
_groupDeltaX.AddToTail(cx - x);
_groupDeltaY.AddToTail(cy - y);
}
// if this panel wasn't already selected update the buildmode dialog controls to show its info
if(_currentPanel != panel)
{
_currentPanel = panel;
if ( m_hBuildDialog )
{
// think this is taken care of by SetActiveControl.
//ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("ApplyDataToControls"), NULL);
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
}
// store undo information upon panel selection.
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("StoreUndo"), NULL);
panel->RequestFocus();
}
return true;
}