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.

105 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Layered Map that contains a background and stateful locations.
  4. // Each location will support mouse over information
  5. //
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef TF_LAYEREDMAPPANEL_H
  9. #define TF_LAYEREDMAPPANEL_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include <vgui/IScheme.h>
  14. #include <vgui_controls/EditablePanel.h>
  15. #include <vgui_controls/ScalableImagePanel.h>
  16. #include <vgui_controls/Tooltip.h>
  17. #include "item_model_panel.h"
  18. class CTFLayeredMapPanel;
  19. class CTFLayeredMapItemPanel;
  20. //=========================================================
  21. class CLayeredMapToolTip : public vgui::BaseTooltip
  22. {
  23. DECLARE_CLASS_SIMPLE( CLayeredMapToolTip, vgui::BaseTooltip );
  24. public:
  25. CLayeredMapToolTip(vgui::Panel *parent, const char *text = NULL);
  26. void SetText(const char *text) { return; }
  27. const char *GetText() { return NULL; }
  28. virtual void PerformLayout();
  29. virtual void ShowTooltip( vgui::Panel *currentPanel );
  30. virtual void HideTooltip();
  31. void SetupPanels( CTFLayeredMapPanel *pParentPanel, vgui::EditablePanel *pControlledPanel );
  32. private:
  33. void GetPosition( itempanel_tooltippos_t iTooltipPosition, CTFLayeredMapItemPanel *pMapItemPanel, int iItemX, int iItemY, int *iXPos, int *iYPos );
  34. bool ValidatePosition( CTFLayeredMapItemPanel *pItemPanel, int iItemX, int iItemY, int *iXPos, int *iYPos );
  35. vgui::DHANDLE<CTFLayeredMapItemPanel> m_hCurrentPanel;
  36. CTFLayeredMapPanel *m_pParentPanel;
  37. vgui::EditablePanel *m_pControlledPanel;
  38. };
  39. //=========================================================
  40. class CTFLayeredMapItemPanel : public vgui::EditablePanel
  41. {
  42. DECLARE_CLASS_SIMPLE( CTFLayeredMapItemPanel, vgui::EditablePanel );
  43. public:
  44. CTFLayeredMapItemPanel( Panel *parent, const char *pName );
  45. virtual void ApplySettings( KeyValues *inResourceData );
  46. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  47. // Button
  48. virtual void OnCursorEntered();
  49. virtual void OnCursorExited();
  50. virtual void OnMousePressed(vgui::MouseCode code);
  51. //
  52. void SetCompletionState( bool bIsCompleted );
  53. KeyValues * GetItemKvData () { return m_kvData; }
  54. private:
  55. vgui::ScalableImagePanel *m_pIsCompleted;
  56. vgui::ScalableImagePanel *m_pIsCompletedHighlight;
  57. vgui::ScalableImagePanel *m_pNotCompleted;
  58. vgui::ScalableImagePanel *m_pNotCompletedHighlight;
  59. bool m_bIsCompleted;
  60. bool m_bIsMouseOvered;
  61. KeyValues *m_kvData;
  62. };
  63. //=========================================================
  64. class CTFLayeredMapPanel : public vgui::EditablePanel
  65. {
  66. DECLARE_CLASS_SIMPLE( CTFLayeredMapPanel, vgui::EditablePanel );
  67. public:
  68. CTFLayeredMapPanel( Panel *parent, const char *pName );
  69. virtual void ApplySettings( KeyValues *inResourceData );
  70. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  71. //CUtlVector<vgui::ImagePanel*> m_pImages;
  72. private:
  73. EditablePanel *m_pToolTipPanel;
  74. CLayeredMapToolTip *m_pToolTip;
  75. KeyValues *m_pLayeredMapKv;
  76. CUtlVector<CTFLayeredMapItemPanel*> m_MapItems;
  77. };
  78. #endif // TF_LAYEREDIMAGEPANEL_H