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.

64 lines
1.9 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ====
  2. //
  3. // A tree list control for visgroups. Supports drag and drop, and posts a
  4. // registered windows message to the list view's parent window when visgroups
  5. // are hidden or shown.
  6. //
  7. //=============================================================================
  8. #include "stdafx.h"
  9. #include "GroupList.h"
  10. #include "VisGroup.h"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include <tier0/memdbgon.h>
  13. //-----------------------------------------------------------------------------
  14. //-----------------------------------------------------------------------------
  15. CGroupList::CGroupList()
  16. {
  17. }
  18. //-----------------------------------------------------------------------------
  19. //-----------------------------------------------------------------------------
  20. CGroupList::~CGroupList()
  21. {
  22. }
  23. //-----------------------------------------------------------------------------
  24. // Called when the user finishes editing the label of a tree item.
  25. //-----------------------------------------------------------------------------
  26. void CGroupList::OnRenameItem(void *pItem, const char *pszText)
  27. {
  28. Assert(pItem);
  29. Assert(pszText);
  30. if (!pItem || !pszText)
  31. return;
  32. CVisGroup *pVisGroup = (CVisGroup *)pItem;
  33. pVisGroup->SetName(pszText);
  34. }
  35. //-----------------------------------------------------------------------------
  36. //-----------------------------------------------------------------------------
  37. void CGroupList::AddVisGroup(CVisGroup *pVisGroup)
  38. {
  39. AddItem(pVisGroup, pVisGroup->GetParent(), pVisGroup->GetName(), true);
  40. for (int i = 0; i < pVisGroup->GetChildCount(); i++)
  41. {
  42. AddVisGroup(pVisGroup->GetChild(i));
  43. }
  44. }
  45. //-----------------------------------------------------------------------------
  46. //-----------------------------------------------------------------------------
  47. void CGroupList::UpdateVisGroup(CVisGroup *pVisGroup)
  48. {
  49. UpdateItem(pVisGroup, pVisGroup->GetName());
  50. }