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