TOOLTIP.H 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. // ToolTip.h
  15. #ifdef WOLAPI_INTEGRATION
  16. #ifndef TOOLTIP_H
  17. #define TOOLTIP_H
  18. #include "Gadget.h"
  19. #define TOOLTIPTEXT_MAX_LEN 100
  20. #define TOOLTIPDELAY 400 // Milliseconds
  21. class ToolTipClass
  22. {
  23. public:
  24. ToolTipClass( GadgetClass* pGadget, const char* szText, int xShow, int yShow, bool bRightAlign = false, bool bIconList = false );
  25. ~ToolTipClass()
  26. {
  27. delete [] pSaveRect;
  28. }
  29. ToolTipClass* GetToolTipHit();
  30. void Show();
  31. void Unshow();
  32. void Move( int xShow, int yShow );
  33. bool bOverDifferentLine() const;
  34. ToolTipClass* next; // Next tooltip in list of which *this is a part.
  35. GadgetClass* pGadget; // Gadget to which this tooltip is bound.
  36. bool bRightAlign;
  37. bool bShowing;
  38. bool bIconList; // True if gadget is iconlist and line-specific tooltips are to be used.
  39. protected:
  40. bool bGadgetHit() const;
  41. int xShow;
  42. int yShow;
  43. int wShow;
  44. int hShow;
  45. char szTip[ TOOLTIPTEXT_MAX_LEN + 1 ]; // Text to show as tip.
  46. char* pSaveRect;
  47. // Used only if bIconList.
  48. int iLastIconListIndex;
  49. bool bLastShowNoText;
  50. int xLastShow;
  51. int yLastShow;
  52. int wLastShow;
  53. };
  54. #endif
  55. #endif