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