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