1 ///////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/tipwin.h
3 // Purpose:     wxTipWindow is a window like the one typically used for
4 //              showing the tooltips
5 // Author:      Vadim Zeitlin
6 // Modified by:
7 // Created:     10.09.00
8 // Copyright:   (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence:     wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef _WX_TIPWIN_H_
13 #define _WX_TIPWIN_H_
14 
15 #if wxUSE_TIPWINDOW
16 
17 #include "wx/popupwin.h"
18 
19 class WXDLLIMPEXP_FWD_CORE wxTipWindowView;
20 
21 // ----------------------------------------------------------------------------
22 // wxTipWindow
23 // ----------------------------------------------------------------------------
24 
25 class WXDLLIMPEXP_CORE wxTipWindow : public wxPopupTransientWindow
26 {
27 public:
28     // the mandatory ctor parameters are: the parent window and the text to
29     // show
30     //
31     // optionally you may also specify the length at which the lines are going
32     // to be broken in rows (100 pixels by default)
33     //
34     // windowPtr and rectBound are just passed to SetTipWindowPtr() and
35     // SetBoundingRect() - see below
36     wxTipWindow(wxWindow *parent,
37                 const wxString& text,
38                 wxCoord maxLength = 100,
39                 wxTipWindow** windowPtr = NULL,
40                 wxRect *rectBound = NULL);
41 
42     virtual ~wxTipWindow();
43 
44     // If windowPtr is not NULL the given address will be NULLed when the
45     // window has closed
SetTipWindowPtr(wxTipWindow ** windowPtr)46     void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; }
47 
48     // If rectBound is not NULL, the window will disappear automatically when
49     // the mouse leave the specified rect: note that rectBound should be in the
50     // screen coordinates!
51     void SetBoundingRect(const wxRect& rectBound);
52 
53     // Hide and destroy the window
54     void Close();
55 
56 protected:
57     // called by wxTipWindowView only
58     bool CheckMouseInBounds(const wxPoint& pos);
59 
60     // event handlers
61     void OnMouseClick(wxMouseEvent& event);
62 
63     virtual void OnDismiss() wxOVERRIDE;
64 
65 private:
66     wxTipWindowView *m_view;
67 
68     wxTipWindow** m_windowPtr;
69     wxRect m_rectBound;
70 
71     wxDECLARE_EVENT_TABLE();
72 
73     friend class wxTipWindowView;
74 
75     wxDECLARE_NO_COPY_CLASS(wxTipWindow);
76 };
77 
78 #endif // wxUSE_TIPWINDOW
79 
80 #endif // _WX_TIPWIN_H_
81