]> git.saurik.com Git - wxWidgets.git/blame - include/wx/tipwin.h
Applied [ 716064 ] Second part of wxFileCtrl & wxDirCtrl patch
[wxWidgets.git] / include / wx / tipwin.h
CommitLineData
01fa3fe7
VZ
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>
371a5b4e 10// Licence: wxWindows licence
01fa3fe7
VZ
11///////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_TIPWIN_H_
14#define _WX_TIPWIN_H_
15
af49c4b8 16#if defined(__GNUG__) && !defined(__APPLE__)
01fa3fe7
VZ
17 #pragma interface "tipwin.h"
18#endif
19
961c54c3 20#if wxUSE_TIPWINDOW
01fa3fe7 21
8962e1d9 22#if wxUSE_POPUPWIN
dafbe8c0
VZ
23 #include "wx/popupwin.h"
24
25 #define wxTipWindowBase wxPopupTransientWindow
961c54c3 26#else
dafbe8c0
VZ
27 #include "wx/frame.h"
28
29 #define wxTipWindowBase wxFrame
961c54c3 30#endif
f38bcae5 31
dafbe8c0
VZ
32class WXDLLEXPORT wxTipWindowView;
33
01fa3fe7
VZ
34// ----------------------------------------------------------------------------
35// wxTipWindow
36// ----------------------------------------------------------------------------
37
dafbe8c0 38class WXDLLEXPORT wxTipWindow : public wxTipWindowBase
01fa3fe7
VZ
39{
40public:
dafbe8c0
VZ
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
01fa3fe7
VZ
49 wxTipWindow(wxWindow *parent,
50 const wxString& text,
dafbe8c0
VZ
51 wxCoord maxLength = 100,
52 wxTipWindow** windowPtr = NULL,
53 wxRect *rectBound = NULL);
173e8bbf 54
dafbe8c0
VZ
55 virtual ~wxTipWindow();
56
57 // If windowPtr is not NULL the given address will be NULLed when the
58 // window has closed
173e8bbf 59 void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; }
01fa3fe7 60
dafbe8c0
VZ
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
8962e1d9
RD
67 void Close();
68
01fa3fe7 69protected:
dafbe8c0
VZ
70 // called by wxTipWindowView only
71 bool CheckMouseInBounds(const wxPoint& pos);
72
01fa3fe7 73 // event handlers
01fa3fe7 74 void OnMouseClick(wxMouseEvent& event);
dafbe8c0 75
961c54c3
RD
76#if !wxUSE_POPUPWIN
77 void OnActivate(wxActivateEvent& event);
78 void OnKillFocus(wxFocusEvent& event);
dafbe8c0
VZ
79#else // wxUSE_POPUPWIN
80 virtual void OnDismiss();
81#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN
01fa3fe7 82
01fa3fe7
VZ
83private:
84 wxArrayString m_textLines;
85 wxCoord m_heightLine;
dafbe8c0
VZ
86
87 wxTipWindowView *m_view;
88
173e8bbf 89 wxTipWindow** m_windowPtr;
dafbe8c0 90 wxRect m_rectBound;
01fa3fe7
VZ
91
92 DECLARE_EVENT_TABLE()
dafbe8c0
VZ
93
94 friend class wxTipWindowView;
22f3361e
VZ
95
96 DECLARE_NO_COPY_CLASS(wxTipWindow)
01fa3fe7
VZ
97};
98
961c54c3 99#endif // wxUSE_TIPWINDOW
dafbe8c0 100
01fa3fe7 101#endif // _WX_TIPWIN_H_