home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / toolti.zip / TOOLTIP.H < prev    next >
C/C++ Source or Header  |  1994-10-03  |  2KB  |  102 lines

  1. #ifndef __tooltip_h
  2. #define __tooltip_h
  3.  
  4. #include <owl\controlb.h>
  5. #include <owl\statusba.h>
  6. #include <owl\buttonga.h>
  7.  
  8. class TTipControlBar;
  9. class TTipStatusBar;
  10.  
  11. class TToolTipFont : public TFont
  12. {
  13.  
  14. public:
  15.     TToolTipFont ();
  16. };
  17.  
  18. class Tip
  19. {
  20. public:
  21.     enum Style {
  22.         SquareBorder    = 0x00,
  23.         RoundedBorder    = 0x01,
  24.         Shadow            = 0x02,
  25.         };
  26. };
  27.  
  28. class TToolTip : private TWindow
  29. {
  30.     friend    TTipControlBar;
  31.     friend    TTipStatusBar;
  32.  
  33.     UINT    uiTimer;
  34.     BOOL    bEnabled;
  35.     TSize    sizeText;
  36.  
  37.     Tip::Style    style;
  38.     TFont*     font;
  39.     
  40.     void    KillTipTimer ();
  41.     void    ShowNow ();
  42.     void    PositionTip ();
  43.  
  44. protected:
  45.     void    GetWindowClass (WNDCLASS &wc);
  46.     LPSTR    GetClassName ();
  47.  
  48.     void     Paint (TDC &dc, BOOL erase, TRect &rc);
  49.     void    EvTimer (UINT uiTimerId);
  50.  
  51.     void    SetCaption (const char far* title);
  52.  
  53. public:
  54.     TToolTip (Tip::Style style = Tip::SquareBorder, TFont* font = new TToolTipFont);
  55.     ~TToolTip ();
  56.  
  57.     BOOL    AreTipsEnabled ()                     { return bEnabled; }
  58.     void    EnableTips (BOOL bEnable = TRUE)     { bEnabled = bEnable; }
  59.     void    HideTip ()                            { SetCaption (NULL) ; }
  60.  
  61.     DECLARE_RESPONSE_TABLE (TToolTip);
  62. };
  63.  
  64. class TTipControlBar : public TControlBar
  65. {
  66.     TToolTip&    tooltip;
  67.  
  68. public:
  69.     TTipControlBar (TToolTip& tip, TWindow* parent = 0, TTileDirection direction = Horizontal, TFont* font = new TGadgetWindowFont, TModule* module = 0);
  70.  
  71.     void     EvMouseMove (UINT modKeys, TPoint& point);
  72.     void     EvLButtonDown (UINT modKeys, TPoint& point);
  73.  
  74.     void     SetHintText (const char *lpszText);
  75.  
  76.     DECLARE_RESPONSE_TABLE (TTipControlBar);
  77. };
  78.  
  79. class TTipStatusBar : public TStatusBar
  80. {
  81.     TToolTip&    tooltip;
  82.     BOOL        bShowTips;
  83.  
  84. public:
  85.     TTipStatusBar (    TToolTip&                 tip,
  86.                     TWindow*                parent = 0,
  87.                     TGadget::TBorderStyle     borderStyle = TGadget::Recessed,
  88.                     UINT                      modeIndicators = 0,
  89.                     TFont*                    font = new TGadgetWindowFont,
  90.                     TModule*                  module = 0);
  91.  
  92.     void             EvMouseMove (UINT modKeys, TPoint& point);
  93.     void             EvLButtonDown (UINT modKeys, TPoint& point);
  94.  
  95.     void             SetHintText (const char *lpszText);
  96.     virtual void     SetTextEx (const char *lpszText) { SetText (lpszText); }
  97.     void            UseTips ();
  98.  
  99.     DECLARE_RESPONSE_TABLE (TTipStatusBar);
  100. };
  101.  
  102. #endif