1 Star 0 Fork 0

yoyojacky/CSMoE

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
PanelListPanel.h 2.91 KB
一键复制 编辑 原始数据 按行查看 历史
//========= Copyright ?1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef PANELLISTPANEL_H
#define PANELLISTPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include <tier1/utllinkedlist.h>
#include <tier1/utlvector.h>
#include <vgui/VGUI2.h>
#include "Panel.h"
class KeyValues;
namespace vgui2
{
//-----------------------------------------------------------------------------
// Purpose: A list of variable height child panels
// each list item consists of a label-panel pair. Height of the item is
// determined from the lable.
//-----------------------------------------------------------------------------
class PanelListPanel : public Panel
{
DECLARE_CLASS_SIMPLE( PanelListPanel, Panel );
public:
PanelListPanel( vgui2::Panel *parent, char const *panelName );
~PanelListPanel();
// DATA & ROW HANDLING
// The list now owns the panel
virtual int AddItem( Panel *labelPanel, Panel *panel );
int GetItemCount() const;
int GetItemIDFromRow( int nRow ) const;
// Iteration. Use these until they return InvalidItemID to iterate all the items.
int FirstItem() const;
int NextItem( int nItemID ) const;
int InvalidItemID() const;
virtual Panel *GetItemLabel(int itemID);
virtual Panel *GetItemPanel(int itemID);
virtual void RemoveItem(int itemID); // removes an item from the table (changing the indices of all following items)
virtual void DeleteAllItems(); // clears and deletes all the memory used by the data items
void RemoveAll();
// painting
virtual vgui2::Panel *GetCellRenderer( int row );
// layout
void SetFirstColumnWidth( int width );
int GetFirstColumnWidth();
void SetNumColumns( int iNumColumns );
int GetNumColumns( void );
void MoveScrollBarToTop();
// selection
void SetSelectedPanel( Panel *panel );
Panel *GetSelectedPanel();
/*
On a panel being selected, a message gets sent to it
"PanelSelected" int "state"
where state is 1 on selection, 0 on deselection
*/
void SetVerticalBufferPixels( int buffer );
void ScrollToItem( int itemNumber );
protected:
// overrides
virtual void OnSizeChanged(int wide, int tall);
MESSAGE_FUNC_INT( OnSliderMoved, "ScrollBarSliderMoved", position );
virtual void PerformLayout();
virtual void ApplySchemeSettings(vgui2::IScheme *pScheme);
virtual void OnMouseWheeled(int delta);
private:
int ComputeVPixelsNeeded();
enum { DEFAULT_HEIGHT = 24, PANELBUFFER = 5 };
typedef struct dataitem_s
{
// Always store a panel pointer
Panel *panel;
Panel *labelPanel;
} DATAITEM;
// list of the column headers
CUtlLinkedList<DATAITEM, int> m_DataItems;
CUtlVector<int> m_SortedItems;
ScrollBar *m_vbar;
Panel *m_pPanelEmbedded;
PHandle m_hSelectedItem;
int m_iFirstColumnWidth;
int m_iNumColumns;
int m_iDefaultHeight;
int m_iPanelBuffer;
};
}
#endif // PANELLISTPANEL_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yoyojacky/CSMoE.git
git@gitee.com:yoyojacky/CSMoE.git
yoyojacky
CSMoE
CSMoE
master

搜索帮助