]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/tipwin.h
Project file update
[wxWidgets.git] / include / wx / tipwin.h
... / ...
CommitLineData
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#ifdef __GNUG__
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
32class WXDLLEXPORT wxTipWindowView;
33
34// ----------------------------------------------------------------------------
35// wxTipWindow
36// ----------------------------------------------------------------------------
37
38class WXDLLEXPORT wxTipWindow : public wxTipWindowBase
39{
40public:
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
69protected:
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
83private:
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
97#endif // wxUSE_TIPWINDOW
98
99#endif // _WX_TIPWIN_H_