Team Fortress 2 Source Code as on 22/4/2020
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.

139 lines
5.4 KiB

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