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