]> git.saurik.com Git - wxWidgets.git/blob - include/wx/tipwin.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / tipwin.h
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 #if wxUSE_POPUPWIN
18 #include "wx/popupwin.h"
19
20 #define wxTipWindowBase wxPopupTransientWindow
21 #else
22 #include "wx/frame.h"
23
24 #define wxTipWindowBase wxFrame
25 #endif
26 #include "wx/arrstr.h"
27
28 class WXDLLIMPEXP_FWD_CORE wxTipWindowView;
29
30 // ----------------------------------------------------------------------------
31 // wxTipWindow
32 // ----------------------------------------------------------------------------
33
34 class WXDLLIMPEXP_CORE wxTipWindow : public wxTipWindowBase
35 {
36 public:
37 // the mandatory ctor parameters are: the parent window and the text to
38 // show
39 //
40 // optionally you may also specify the length at which the lines are going
41 // to be broken in rows (100 pixels by default)
42 //
43 // windowPtr and rectBound are just passed to SetTipWindowPtr() and
44 // SetBoundingRect() - see below
45 wxTipWindow(wxWindow *parent,
46 const wxString& text,
47 wxCoord maxLength = 100,
48 wxTipWindow** windowPtr = NULL,
49 wxRect *rectBound = NULL);
50
51 virtual ~wxTipWindow();
52
53 // If windowPtr is not NULL the given address will be NULLed when the
54 // window has closed
55 void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; }
56
57 // If rectBound is not NULL, the window will disappear automatically when
58 // the mouse leave the specified rect: note that rectBound should be in the
59 // screen coordinates!
60 void SetBoundingRect(const wxRect& rectBound);
61
62 // Hide and destroy the window
63 void Close();
64
65 protected:
66 // called by wxTipWindowView only
67 bool CheckMouseInBounds(const wxPoint& pos);
68
69 // event handlers
70 void OnMouseClick(wxMouseEvent& event);
71
72 #if !wxUSE_POPUPWIN
73 void OnActivate(wxActivateEvent& event);
74 void OnKillFocus(wxFocusEvent& event);
75 #else // wxUSE_POPUPWIN
76 virtual void OnDismiss();
77 #endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN
78
79 private:
80 wxArrayString m_textLines;
81 wxCoord m_heightLine;
82
83 wxTipWindowView *m_view;
84
85 wxTipWindow** m_windowPtr;
86 wxRect m_rectBound;
87
88 DECLARE_EVENT_TABLE()
89
90 friend class wxTipWindowView;
91
92 wxDECLARE_NO_COPY_CLASS(wxTipWindow);
93 };
94
95 #endif // wxUSE_TIPWINDOW
96
97 #endif // _WX_TIPWIN_H_