tooltip.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: tooltip.h
  3. // Purpose: interface of wxToolTip
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxToolTip
  9. This class holds information about a tooltip associated with a window (see
  10. wxWindow::SetToolTip()).
  11. The four static methods, wxToolTip::Enable(), wxToolTip::SetDelay()
  12. wxToolTip::SetAutoPop() and wxToolTip::SetReshow() can be used to globally
  13. alter tooltips behaviour.
  14. @library{wxcore}
  15. @category{help}
  16. */
  17. class wxToolTip : public wxObject
  18. {
  19. public:
  20. /**
  21. Constructor.
  22. */
  23. wxToolTip(const wxString& tip);
  24. /**
  25. Enable or disable tooltips globally.
  26. @note May not be supported on all platforms (eg. wxCocoa).
  27. */
  28. static void Enable(bool flag);
  29. /**
  30. Get the tooltip text.
  31. */
  32. wxString GetTip() const;
  33. /**
  34. Get the associated window.
  35. */
  36. wxWindow* GetWindow() const;
  37. /**
  38. Set the delay after which the tooltip disappears or how long a tooltip
  39. remains visible.
  40. @note May not be supported on all platforms (eg. wxCocoa, GTK).
  41. */
  42. static void SetAutoPop(long msecs);
  43. /**
  44. Set the delay after which the tooltip appears.
  45. @note May not be supported on all platforms (eg. wxCocoa).
  46. */
  47. static void SetDelay(long msecs);
  48. /**
  49. Set tooltip maximal width in pixels.
  50. By default, tooltips are wrapped at a suitably chosen width. You can
  51. pass -1 as @a width to disable wrapping them completely, 0 to restore
  52. the default behaviour or an arbitrary positive value to wrap them at
  53. the given width.
  54. Notice that this function does not change the width of the tooltips
  55. created before calling it.
  56. @note Currently this function is wxMSW-only.
  57. */
  58. static void SetMaxWidth(int width);
  59. /**
  60. Set the delay between subsequent tooltips to appear.
  61. @note May not be supported on all platforms (eg. wxCocoa, GTK).
  62. */
  63. static void SetReshow(long msecs);
  64. /**
  65. Set the tooltip text.
  66. */
  67. void SetTip(const wxString& tip);
  68. };