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.

148 lines
5.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IPANEL_H
  8. #define IPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include "tier1/interface.h"
  14. #include "tier1/utlvector.h"
  15. #ifdef SendMessage
  16. #undef SendMessage
  17. #endif
  18. //-----------------------------------------------------------------------------
  19. // Forward declarations
  20. //-----------------------------------------------------------------------------
  21. class KeyValues;
  22. struct DmxElementUnpackStructure_t;
  23. class CDmxElement;
  24. namespace vgui
  25. {
  26. class SurfacePlat;
  27. class IClientPanel;
  28. //!! must be removed
  29. class Panel;
  30. //-----------------------------------------------------------------------------
  31. // Purpose: interface from Client panels -> vgui panels
  32. //-----------------------------------------------------------------------------
  33. class IPanel : public IBaseInterface
  34. {
  35. public:
  36. virtual void Init(VPANEL vguiPanel, IClientPanel *panel) = 0;
  37. // methods
  38. virtual void SetPos(VPANEL vguiPanel, int x, int y) = 0;
  39. virtual void GetPos(VPANEL vguiPanel, int &x, int &y) = 0;
  40. virtual void SetSize(VPANEL vguiPanel, int wide,int tall) = 0;
  41. virtual void GetSize(VPANEL vguiPanel, int &wide, int &tall) = 0;
  42. virtual void SetMinimumSize(VPANEL vguiPanel, int wide, int tall) = 0;
  43. virtual void GetMinimumSize(VPANEL vguiPanel, int &wide, int &tall) = 0;
  44. virtual void SetZPos(VPANEL vguiPanel, int z) = 0;
  45. virtual int GetZPos(VPANEL vguiPanel) = 0;
  46. virtual void GetAbsPos(VPANEL vguiPanel, int &x, int &y) = 0;
  47. virtual void GetClipRect(VPANEL vguiPanel, int &x0, int &y0, int &x1, int &y1) = 0;
  48. virtual void SetInset(VPANEL vguiPanel, int left, int top, int right, int bottom) = 0;
  49. virtual void GetInset(VPANEL vguiPanel, int &left, int &top, int &right, int &bottom) = 0;
  50. virtual void SetVisible(VPANEL vguiPanel, bool state) = 0;
  51. virtual bool IsVisible(VPANEL vguiPanel) = 0;
  52. virtual void SetParent(VPANEL vguiPanel, VPANEL newParent) = 0;
  53. virtual int GetChildCount(VPANEL vguiPanel) = 0;
  54. virtual VPANEL GetChild(VPANEL vguiPanel, int index) = 0;
  55. virtual CUtlVector< VPANEL > &GetChildren( VPANEL vguiPanel ) = 0;
  56. virtual VPANEL GetParent(VPANEL vguiPanel) = 0;
  57. virtual void MoveToFront(VPANEL vguiPanel) = 0;
  58. virtual void MoveToBack(VPANEL vguiPanel) = 0;
  59. virtual bool HasParent(VPANEL vguiPanel, VPANEL potentialParent) = 0;
  60. virtual bool IsPopup(VPANEL vguiPanel) = 0;
  61. virtual void SetPopup(VPANEL vguiPanel, bool state) = 0;
  62. virtual bool IsFullyVisible( VPANEL vguiPanel ) = 0;
  63. // gets the scheme this panel uses
  64. virtual HScheme GetScheme(VPANEL vguiPanel) = 0;
  65. // gets whether or not this panel should scale with screen resolution
  66. virtual bool IsProportional(VPANEL vguiPanel) = 0;
  67. // returns true if auto-deletion flag is set
  68. virtual bool IsAutoDeleteSet(VPANEL vguiPanel) = 0;
  69. // deletes the Panel * associated with the vpanel
  70. virtual void DeletePanel(VPANEL vguiPanel) = 0;
  71. // input interest
  72. virtual void SetKeyBoardInputEnabled(VPANEL vguiPanel, bool state) = 0;
  73. virtual void SetMouseInputEnabled(VPANEL vguiPanel, bool state) = 0;
  74. virtual bool IsKeyBoardInputEnabled(VPANEL vguiPanel) = 0;
  75. virtual bool IsMouseInputEnabled(VPANEL vguiPanel) = 0;
  76. // calculates the panels current position within the hierarchy
  77. virtual void Solve(VPANEL vguiPanel) = 0;
  78. // gets names of the object (for debugging purposes)
  79. virtual const char *GetName(VPANEL vguiPanel) = 0;
  80. virtual const char *GetClassName(VPANEL vguiPanel) = 0;
  81. // delivers a message to the panel
  82. virtual void SendMessage(VPANEL vguiPanel, KeyValues *params, VPANEL ifromPanel) = 0;
  83. // these pass through to the IClientPanel
  84. virtual void Think(VPANEL vguiPanel) = 0;
  85. virtual void PerformApplySchemeSettings(VPANEL vguiPanel) = 0;
  86. virtual void PaintTraverse(VPANEL vguiPanel, bool forceRepaint, bool allowForce = true) = 0;
  87. virtual void Repaint(VPANEL vguiPanel) = 0;
  88. virtual VPANEL IsWithinTraverse(VPANEL vguiPanel, int x, int y, bool traversePopups) = 0;
  89. virtual void OnChildAdded(VPANEL vguiPanel, VPANEL child) = 0;
  90. virtual void OnSizeChanged(VPANEL vguiPanel, int newWide, int newTall) = 0;
  91. virtual void InternalFocusChanged(VPANEL vguiPanel, bool lost) = 0;
  92. virtual bool RequestInfo(VPANEL vguiPanel, KeyValues *outputData) = 0;
  93. virtual void RequestFocus(VPANEL vguiPanel, int direction = 0) = 0;
  94. virtual bool RequestFocusPrev(VPANEL vguiPanel, VPANEL existingPanel) = 0;
  95. virtual bool RequestFocusNext(VPANEL vguiPanel, VPANEL existingPanel) = 0;
  96. virtual VPANEL GetCurrentKeyFocus(VPANEL vguiPanel) = 0;
  97. virtual int GetTabPosition(VPANEL vguiPanel) = 0;
  98. // used by ISurface to store platform-specific data
  99. virtual SurfacePlat *Plat(VPANEL vguiPanel) = 0;
  100. virtual void SetPlat(VPANEL vguiPanel, SurfacePlat *Plat) = 0;
  101. // returns a pointer to the vgui controls baseclass Panel *
  102. // destinationModule needs to be passed in to verify that the returned Panel * is from the same module
  103. // it must be from the same module since Panel * vtbl may be different in each module
  104. virtual Panel *GetPanel(VPANEL vguiPanel, const char *destinationModule) = 0;
  105. virtual bool IsEnabled(VPANEL vguiPanel) = 0;
  106. virtual void SetEnabled(VPANEL vguiPanel, bool state) = 0;
  107. // Used by the drag/drop manager to always draw on top
  108. virtual bool IsTopmostPopup( VPANEL vguiPanel) = 0;
  109. virtual void SetTopmostPopup( VPANEL vguiPanel, bool state ) = 0;
  110. virtual void SetMessageContextId( VPANEL vguiPanel, int nContextId ) = 0;
  111. virtual int GetMessageContextId( VPANEL vguiPanel ) = 0;
  112. virtual const DmxElementUnpackStructure_t *GetUnpackStructure( VPANEL vguiPanel ) const = 0;
  113. virtual void OnUnserialized( VPANEL vguiPanel, CDmxElement *pElement ) = 0;
  114. // sibling pins
  115. virtual void SetSiblingPin(VPANEL vguiPanel, VPANEL newSibling, byte iMyCornerToPin = 0, byte iSiblingCornerToPinTo = 0 ) = 0;
  116. };
  117. } // namespace vgui
  118. #endif // IPANEL_H