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.

73 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Creates a Message box with a question in it and yes/no buttons
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TOOLTIP_H
  8. #define TOOLTIP_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include <vgui_controls/Controls.h>
  14. #include <utlvector.h>
  15. namespace vgui
  16. {
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Tooltip for a panel - shows text when cursor hovers over a panel
  19. //-----------------------------------------------------------------------------
  20. class BaseTooltip
  21. {
  22. public:
  23. BaseTooltip(Panel *parent, const char *text = NULL);
  24. virtual void SetText(const char *text);
  25. virtual const char *GetText();
  26. virtual void ShowTooltip(Panel *currentPanel);
  27. virtual void HideTooltip();
  28. bool ShouldLayout( void );
  29. virtual void PerformLayout() { return; }
  30. virtual void PositionWindow( Panel *pTipPanel );
  31. void ResetDelay();
  32. void SetTooltipFormatToSingleLine();
  33. void SetTooltipFormatToMultiLine();
  34. void SetTooltipDelay(int tooltipDelayMilliseconds);
  35. int GetTooltipDelay();
  36. void SetEnabled( bool bState );
  37. protected:
  38. Panel *m_pParent;
  39. CUtlVector<char> m_Text;
  40. int _delay; // delay that counts down
  41. int _tooltipDelay; // delay before tooltip comes up.
  42. bool _makeVisible : 1;
  43. bool _displayOnOneLine : 1;
  44. bool _isDirty : 1;
  45. bool _enabled : 1;
  46. };
  47. class TextTooltip : public BaseTooltip
  48. {
  49. public:
  50. TextTooltip(Panel *parent, const char *text = NULL);
  51. ~TextTooltip();
  52. virtual void SetText(const char *text);
  53. virtual void ShowTooltip(Panel *currentPanel);
  54. virtual void HideTooltip();
  55. virtual void SizeTextWindow();
  56. virtual void PerformLayout();
  57. };
  58. };
  59. #endif // TOOLTIP_H