Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #if !defined( PANELLISTPANEL_H )
  8. #define PANELLISTPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include <vgui_controls/Panel.h>
  14. class KeyValues;
  15. //-----------------------------------------------------------------------------
  16. // Purpose: A list of variable height child panels
  17. //-----------------------------------------------------------------------------
  18. class CPanelListPanel : public vgui::Panel
  19. {
  20. DECLARE_CLASS_SIMPLE( CPanelListPanel, vgui::Panel );
  21. public:
  22. typedef struct dataitem_s
  23. {
  24. // Always store a panel pointer
  25. vgui::Panel *panel;
  26. } DATAITEM;
  27. CPanelListPanel( vgui::Panel *parent, char const *panelName, bool inverseButtons = false );
  28. ~CPanelListPanel();
  29. // DATA & ROW HANDLING
  30. // The list now owns the panel
  31. virtual int computeVPixelsNeeded( void );
  32. virtual int AddItem( vgui::Panel *panel );
  33. virtual int GetItemCount( void );
  34. virtual vgui::Panel *GetItem(int itemIndex); // returns pointer to data the row holds
  35. virtual void RemoveItem(int itemIndex); // removes an item from the table (changing the indices of all following items)
  36. virtual void DeleteAllItems(); // clears and deletes all the memory used by the data items
  37. // career-mode UI wants to nudge sub-controls around
  38. void SetSliderYOffset(int pixels);
  39. // PAINTING
  40. virtual vgui::Panel *GetCellRenderer( int row );
  41. MESSAGE_FUNC_INT( OnSliderMoved, "ScrollBarSliderMoved", position );
  42. virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
  43. vgui::Panel *GetEmbedded()
  44. {
  45. return _embedded;
  46. }
  47. protected:
  48. DATAITEM *GetDataItem( int itemIndex );
  49. virtual void PerformLayout();
  50. virtual void PaintBackground();
  51. virtual void OnMouseWheeled(int delta);
  52. private:
  53. // list of the column headers
  54. vgui::Dar<DATAITEM *> _dataItems;
  55. vgui::ScrollBar *_vbar;
  56. vgui::Panel *_embedded;
  57. int _tableStartX;
  58. int _tableStartY;
  59. int _sliderYOffset;
  60. };
  61. #endif // PANELLISTPANEL_H