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.

133 lines
4.6 KiB

  1. //========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef INOTIFYUI_H
  8. #define INOTIFYUI_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tier1/utlvector.h"
  13. #include "datamodel/idatamodel.h"
  14. //-----------------------------------------------------------------------------
  15. // Forward declarations
  16. //-----------------------------------------------------------------------------
  17. class CDmElement;
  18. //-----------------------------------------------------------------------------
  19. // Interface used to allow tools to deal with dynamic choice lists
  20. //-----------------------------------------------------------------------------
  21. struct IntChoice_t
  22. {
  23. int m_nValue;
  24. const char *m_pChoiceString;
  25. };
  26. struct StringChoice_t
  27. {
  28. const char *m_pValue;
  29. const char *m_pChoiceString;
  30. };
  31. struct ElementChoice_t
  32. {
  33. ElementChoice_t() {}
  34. ElementChoice_t( CDmElement *pValue, const char *pChoiceString = NULL ) : m_pValue( pValue ), m_pChoiceString( pChoiceString ) {}
  35. CDmElement *m_pValue;
  36. const char *m_pChoiceString;
  37. };
  38. typedef CUtlVector<IntChoice_t> IntChoiceList_t;
  39. typedef CUtlVector<StringChoice_t> StringChoiceList_t;
  40. typedef CUtlVector<ElementChoice_t> ElementChoiceList_t;
  41. //-----------------------------------------------------------------------------
  42. // Interface used to call back out of the element properties panels
  43. // to communicate with external systems
  44. //-----------------------------------------------------------------------------
  45. enum DmeControlsNotifySource_t
  46. {
  47. NOTIFY_SOURCE_PROPERTIES_TREE = NOTIFY_SOURCE_FIRST_DME_CONTROL_SOURCE,
  48. NOTIFY_SOURCE_FILE_LIST_MANAGER,
  49. NOTIFY_SOURCE_PRESET_GROUP_EDITOR,
  50. };
  51. //-----------------------------------------------------------------------------
  52. // Utility scope guards
  53. //-----------------------------------------------------------------------------
  54. DEFINE_SOURCE_UNDO_SCOPE_GUARD( ElementTree, NOTIFY_SOURCE_PROPERTIES_TREE );
  55. DEFINE_SOURCE_NOTIFY_SCOPE_GUARD( ElementTree, NOTIFY_SOURCE_PROPERTIES_TREE );
  56. class IElementPropertiesChoices
  57. {
  58. public:
  59. // For boolean choice lists. Return false if it's an unknown choice list type
  60. // Element, attribute specifies the attribute we're editing.
  61. // bArray element is true if the attribute is an array attribute and we're editing one of its elements
  62. virtual bool GetBoolChoiceList( const char *pChoiceListType, CDmElement *pElement,
  63. const char *pAttributeName, bool bArrayElement, const char *pChoiceStrings[2] ) = 0;
  64. // For integer choice lists. Return false if it's an unknown choice list type
  65. virtual bool GetIntChoiceList( const char *pChoiceListType, CDmElement *pElement,
  66. const char *pAttributeName, bool bArrayElement, IntChoiceList_t &list ) = 0;
  67. // For string choice lists. Return false if it's an unknown choice list type
  68. virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
  69. const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list ) = 0;
  70. // For element choice lists. Return false if it's an unknown choice list type
  71. virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
  72. const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list ) = 0;
  73. virtual const char *GetElementChoiceString( const char *pChoiceListType, CDmElement *pElement,
  74. const char *pAttributeName, bool bArrayElement, CDmElement *pValue ) = 0;
  75. };
  76. //-----------------------------------------------------------------------------
  77. // Default implementation of IElementPropertiesChoices
  78. //-----------------------------------------------------------------------------
  79. class CBaseElementPropertiesChoices : public IElementPropertiesChoices
  80. {
  81. public:
  82. virtual bool GetBoolChoiceList( const char *pChoiceListType, CDmElement *pElement,
  83. const char *pAttributeName, bool bArrayElement, const char *pChoiceStrings[2] )
  84. {
  85. return false;
  86. }
  87. virtual bool GetIntChoiceList( const char *pChoiceListType, CDmElement *pElement,
  88. const char *pAttributeName, bool bArrayElement, IntChoiceList_t &list )
  89. {
  90. return false;
  91. }
  92. virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
  93. const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list )
  94. {
  95. return false;
  96. }
  97. virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
  98. const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list )
  99. {
  100. return false;
  101. }
  102. virtual const char *GetElementChoiceString( const char *pChoiceListType, CDmElement *pElement,
  103. const char *pAttributeName, bool bArrayElement, CDmElement *pValue )
  104. {
  105. return NULL;
  106. }
  107. };
  108. #endif // INOTIFYUI_H