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.

75 lines
2.1 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ====
  2. //
  3. // A tree list control for cordons. Supports drag and drop, and posts a
  4. // registered windows message to the list view's parent window when cordons
  5. // are hidden or shown.
  6. //
  7. //=============================================================================
  8. #include "stdafx.h"
  9. #include "GroupList.h"
  10. #include "cordon.h"
  11. #include "cordonlist.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include <tier0/memdbgon.h>
  14. //-----------------------------------------------------------------------------
  15. //-----------------------------------------------------------------------------
  16. CCordonList::CCordonList()
  17. {
  18. }
  19. //-----------------------------------------------------------------------------
  20. //-----------------------------------------------------------------------------
  21. CCordonList::~CCordonList()
  22. {
  23. }
  24. //-----------------------------------------------------------------------------
  25. // Called when the user finishes editing the label of a tree item.
  26. //-----------------------------------------------------------------------------
  27. void CCordonList::OnRenameItem(void *pItem, const char *pszText)
  28. {
  29. Assert(pItem);
  30. Assert(pszText);
  31. if (!pItem || !pszText)
  32. return;
  33. CordonListItem_t *pCordon = (CordonListItem_t *)pItem;
  34. // Can't rename cordon boxes
  35. if ( !pCordon->m_pBox )
  36. {
  37. pCordon->m_pCordon->m_szName.Set( pszText );
  38. }
  39. }
  40. //-----------------------------------------------------------------------------
  41. //-----------------------------------------------------------------------------
  42. void CCordonList::AddCordon( CordonListItem_t *pCordon, CordonListItem_t *pParent )
  43. {
  44. if ( !pCordon->m_pBox )
  45. {
  46. AddItem( pCordon, pParent, pCordon->m_pCordon->m_szName, true );
  47. }
  48. else
  49. {
  50. AddItem( pCordon, pParent, "box", false );
  51. }
  52. }
  53. //-----------------------------------------------------------------------------
  54. //-----------------------------------------------------------------------------
  55. void CCordonList::UpdateCordon( CordonListItem_t *pCordon )
  56. {
  57. UpdateItem( pCordon, pCordon->m_pCordon->m_szName );
  58. }