X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01fa3fe74d0fadc5126fc27fb5729f08b10da606..b02dd12239c8a59b9a545d9fcb04974f8ad02c6b:/include/wx/tipwin.h?ds=sidebyside diff --git a/include/wx/tipwin.h b/include/wx/tipwin.h index feaddc11b6..a805fc6b66 100644 --- a/include/wx/tipwin.h +++ b/include/wx/tipwin.h @@ -7,42 +7,92 @@ // Created: 10.09.00 // RCS-ID: $Id$ // Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_TIPWIN_H_ #define _WX_TIPWIN_H_ -#ifdef __GNUG__ - #pragma interface "tipwin.h" +#if wxUSE_TIPWINDOW + +#if wxUSE_POPUPWIN + #include "wx/popupwin.h" + + #define wxTipWindowBase wxPopupTransientWindow +#else + #include "wx/frame.h" + + #define wxTipWindowBase wxFrame #endif +#include "wx/arrstr.h" -#include "wx/frame.h" +class WXDLLIMPEXP_FWD_CORE wxTipWindowView; // ---------------------------------------------------------------------------- // wxTipWindow // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTipWindow : public wxFrame +class WXDLLIMPEXP_CORE wxTipWindow : public wxTipWindowBase { public: + // the mandatory ctor parameters are: the parent window and the text to + // show + // + // optionally you may also specify the length at which the lines are going + // to be broken in rows (100 pixels by default) + // + // windowPtr and rectBound are just passed to SetTipWindowPtr() and + // SetBoundingRect() - see below wxTipWindow(wxWindow *parent, const wxString& text, - wxCoord maxLength = 100); + wxCoord maxLength = 100, + wxTipWindow** windowPtr = NULL, + wxRect *rectBound = NULL); + + virtual ~wxTipWindow(); + + // If windowPtr is not NULL the given address will be NULLed when the + // window has closed + void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; } + + // If rectBound is not NULL, the window will disappear automatically when + // the mouse leave the specified rect: note that rectBound should be in the + // screen coordinates! + void SetBoundingRect(const wxRect& rectBound); + + // Hide and destroy the window + void Close(); protected: + // called by wxTipWindowView only + bool CheckMouseInBounds(const wxPoint& pos); + // event handlers - void OnPaint(wxPaintEvent& event); void OnMouseClick(wxMouseEvent& event); - // calculate the client rect we need to display the text - void Adjust(const wxString& text, wxCoord maxLength); +#if !wxUSE_POPUPWIN + void OnActivate(wxActivateEvent& event); + void OnKillFocus(wxFocusEvent& event); +#else // wxUSE_POPUPWIN + virtual void OnDismiss(); +#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN private: wxArrayString m_textLines; wxCoord m_heightLine; + wxTipWindowView *m_view; + + wxTipWindow** m_windowPtr; + wxRect m_rectBound; + DECLARE_EVENT_TABLE() + + friend class wxTipWindowView; + + wxDECLARE_NO_COPY_CLASS(wxTipWindow); }; +#endif // wxUSE_TIPWINDOW + #endif // _WX_TIPWIN_H_