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.

59 lines
1.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef WINDOW_ANCHOR_MGR_H
  8. #define WINDOW_ANCHOR_MGR_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "utllinkedlist.h"
  13. enum
  14. {
  15. ANCHOR_LEFT = 1,
  16. ANCHOR_RIGHT,
  17. ANCHOR_TOP,
  18. ANCHOR_BOTTOM,
  19. ANCHOR_WIDTH_PERCENT,
  20. ANCHOR_HEIGHT_PERCENT
  21. };
  22. class CWindowAnchor
  23. {
  24. public:
  25. bool Init( CWnd *pParentWnd, CWnd *pChildWnd, int aLeft, int aTop, int aRight, int aBottom );
  26. void Update( CWnd *pParentWnd );
  27. private:
  28. CWnd *m_pWnd;
  29. CRect m_Rect; // The rectangle in client coordinates of the parent.
  30. CRect m_ParentRect;
  31. int m_aLeft, m_aTop, m_aRight, m_aBottom;
  32. };
  33. class CWindowAnchorMgr
  34. {
  35. public:
  36. bool AddAnchor( CWnd *pParentWnd, CWnd *pChildWnd, int aLeft, int aTop, int aRight, int aBottom );
  37. void UpdateAnchors( CWnd *pParentWnd );
  38. private:
  39. CUtlLinkedList<CWindowAnchor,int> m_Anchors;
  40. };
  41. #endif // WINDOW_ANCHOR_MGR_H